Repository navigation
feat(mcp): altimate-code mcp serve exposes data tools to MCP clients without an LLM
#1543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7215ddd
d88dd20
8ad54e6
a203a79
9b89b5b
15d2766
d5d1ce0
7b10603
7684b38
461fd24
8edbe3d
e8934cc
f583018
3707cd1
9680417
fd78790
2c2dc01
2a74dca
5e0edda
67f0f82
0361529
259401c
8b612b0
9540e83
26af169
1602aea
3f74028
303265b
1812c0c
68dcafe
d2d9edc
e544a58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,12 @@ jobs: | |
| - '.github/workflows/ci.yml' | ||
| # altimate_change end | ||
| drivers: | ||
| # altimate_change start — run real MCP drivers for MCP/tool-only changes | ||
| - 'packages/opencode/src/altimate/mcp-server/**' | ||
| - 'packages/opencode/test/altimate/mcp-server/**' | ||
| - 'packages/opencode/src/altimate/tools/schema-inspect.ts' | ||
| - 'packages/opencode/src/altimate/tools/schema-values.ts' | ||
| # altimate_change end | ||
| - 'packages/drivers/src/**' | ||
| - 'packages/opencode/src/altimate/native/connections/**' | ||
| - 'packages/opencode/test/altimate/drivers-e2e.test.ts' | ||
|
|
@@ -512,6 +518,14 @@ jobs: | |
| env: | ||
| ALTIMATE_DUCKDB_E2E: "1" | ||
|
|
||
| # Same reason as above: the in-process MCP server tests use real SQLite/DuckDB drivers, which the | ||
| # whole-package run replaces with module mocks, so they run in their own process. | ||
| - name: Run MCP server tests (real drivers, no mocks) | ||
| run: bun test --timeout 90000 test/altimate/mcp-server/server.test.ts | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
| working-directory: packages/opencode | ||
| env: | ||
| ALTIMATE_MCP_E2E: "1" | ||
|
Comment on lines
+521
to
+527
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
# Show the change-detection filter that controls the driver-e2e job.
rg -n -C12 'drivers:' .github/workflows/ci.yml | head -80
rg -n -C3 'outputs:' .github/workflows/ci.yml | head -40Repository: AltimateAI/altimate-code Length of output: 3118 🏁 Script executed: set -e
printf '%s\n' '--- workflow filters and jobs ---'
nl -ba .github/workflows/ci.yml | sed -n '24,115p;430,545p'
printf '%s\n' '--- MCP E2E guard and test declarations ---'
rg -n -C5 -F -- 'ALTIMATE_MCP_E2E' packages/opencode/test/altimate/mcp-server packages/opencode/src .github/workflows/ci.yml || test "$?" -eq 1Repository: AltimateAI/altimate-code Length of output: 13026 🏁 Script executed: set -e
rg -n -C8 -e '^ driver-e2e:' -e 'needs\.changes\.outputs\.drivers' -e 'bun test' .github/workflows/ci.ymlRepository: AltimateAI/altimate-code Length of output: 8869 Run the MCP E2E tests for MCP changes. The Add the MCP paths to the Suggested filter additions drivers:
+ - 'packages/opencode/src/altimate/mcp-server/**'
+ - 'packages/opencode/test/altimate/mcp-server/**'
- 'packages/drivers/src/**'🤖 Prompt for AI Agents |
||
|
|
||
| - name: Run Docker driver E2E (MySQL, SQL Server, Redshift) | ||
| run: bun test test/altimate/drivers-docker-e2e.test.ts | ||
| working-directory: packages/opencode | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // altimate_change start — schema discovery never materializes all collection metadata | ||
| import { expect, mock, test } from "bun:test" | ||
| import { connect } from "../src/mongodb" | ||
| import { restoreModuleMocksAfterTests } from "./module-mock" | ||
|
|
||
| await restoreModuleMocksAfterTests("mongodb") | ||
|
|
||
| test("two million MongoDB collections stop at 501 and close the cursor", async () => { | ||
| let fetched = 0 | ||
| let closed = 0 | ||
| const options: unknown[] = [] | ||
| const commands: unknown[] = [] | ||
| mock.module("mongodb", () => ({ | ||
| default: { | ||
| MongoClient: class { | ||
| async connect() {} | ||
| async close() {} | ||
| db() { | ||
| return { | ||
| databaseName: "large", | ||
| command: async (command: unknown) => { | ||
| commands.push(command) | ||
| return { collections: 2_000_000 } | ||
| }, | ||
| listCollections: (_filter: unknown, opts: unknown) => { | ||
| options.push(opts) | ||
| return { | ||
| async toArray() { | ||
| throw new Error("unbounded collection fetch") | ||
| }, | ||
| async close() { | ||
| closed++ | ||
| }, | ||
| async *[Symbol.asyncIterator]() { | ||
| for (let i = 0; i < 2_000_000; i++) { | ||
| fetched++ | ||
| yield { name: `c${i}`, type: "collection" } | ||
| } | ||
| }, | ||
| } | ||
| }, | ||
| } | ||
| } | ||
| }, | ||
| }, | ||
| })) | ||
| const connector = await connect({ type: "mongodb" }) | ||
| await connector.connect() | ||
| try { | ||
| const start = performance.now() | ||
| const result = await connector.execute( | ||
| JSON.stringify({ command: "listCollections", database: "large" }), | ||
| 500, | ||
| undefined, | ||
| { readOnly: true, queryTimeoutMs: 1000 }, | ||
| ) | ||
| expect(result.rows).toHaveLength(500) | ||
| expect(result.truncated).toBe(true) | ||
| expect(fetched).toBe(501) | ||
| expect(closed).toBe(1) | ||
| expect(performance.now() - start).toBeLessThan(1000) | ||
| expect(options[0]).toMatchObject({ nameOnly: true, authorizedCollections: true, batchSize: 501, maxTimeMS: 1000 }) | ||
| const counts = await connector.execute(JSON.stringify({ command: "dbStats", database: "large" }), 1, undefined, { | ||
| readOnly: true, | ||
| queryTimeoutMs: 1000, | ||
| }) | ||
| expect(counts.rows).toEqual([[2_000_000]]) | ||
| expect(fetched).toBe(501) | ||
| expect(commands).toEqual([{ dbStats: 1, maxTimeMS: 1000 }]) | ||
| } finally { | ||
| await connector.close() | ||
| } | ||
| }) | ||
| // altimate_change end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING:
driver-e2epath filters omit MCP server paths, so PRs touching onlymcp-serverskipserver.test.tsentirelyserver.test.tsgates all 15 tests onALTIMATE_MCP_E2E === "1"(test/altimate/mcp-server/server.test.ts:18), so the maintypescriptjob skips them. Thedriver-e2ejob only runs whenneeds.changes.outputs.drivers == 'true', and thedriverspath filter (ci.yml:89-112) does not includepackages/opencode/src/altimate/mcp-server/**orpackages/opencode/test/altimate/mcp-server/**. As noted atci.yml:97-100forduckdb-open-e2e.test.ts, add those paths to thedriversfilter so PRs modifying only MCP server files still runserver.test.ts.Reply with
@kilocode-bot fix itto have Kilo Code address this issue.