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
Draft
anandgupta42
wants to merge
52
commits into
main
Choose a base branch
from
feat/mcp-serve-toolkit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,327
−225
Draft
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
7215ddd
feat(mcp): serve native data tools over stdio without an LLM
anandgupta42 d88dd20
fix(mcp): enforce source read-only queries and clean up server output
anandgupta42 8ad54e6
feat(schema_inspect): list tables when no table is given; run MCP tes…
anandgupta42 a203a79
fix(schema_inspect): bound table discovery for very large warehouses
anandgupta42 9b89b5b
feat(mcp): send analyst-method instructions in the initialize response
anandgupta42 15d2766
feat: enforce requested items and number provenance in `answer_commit…
anandgupta42 d5d1ce0
Merge commit '15d2766115' into feat/mcp-serve-toolkit
anandgupta42 7b10603
fix: trim over-long `answer_commit` basis, challenge size-based readi…
anandgupta42 7684b38
feat(mcp): serve answer_commit with requested-item and number-provena…
anandgupta42 461fd24
test: update help snapshot for `mcp serve`
anandgupta42 8edbe3d
test: pin the bound-definition sentence in the analyst prompt
anandgupta42 e8934cc
fix: keep supplied definitions from moving the requested entity
anandgupta42 f583018
fix: drop the supplied-definition-is-binding rule from the analyst pr…
anandgupta42 3707cd1
feat(mcp): add a resource_link for spilled sql_execute results
anandgupta42 9680417
feat(mcp): give answer_commit an outputSchema and structuredContent
anandgupta42 fd78790
feat(mcp): expose an `analyze` prompt; ask which reading was meant vi…
anandgupta42 2c2dc01
fix(mcp): bound the `answer_commit` reading question so a silent clie…
anandgupta42 2a74dca
Merge commit 'f583018234' into feat/mcp-serve-toolkit
anandgupta42 5e0edda
fix(mcp): return `answer_commit` as `FINAL ANSWER` text only, without…
anandgupta42 67f0f82
test(mcp): drive the stdio server with raw JSON-RPC so SDK client moc…
anandgupta42 0361529
feat(mcp): keep the basis off the FINAL ANSWER line
anandgupta42 259401c
Revert "feat(mcp): keep the basis off the FINAL ANSWER line"
anandgupta42 8b612b0
feat(mcp): answer-only FINAL ANSWER line for complete commits, plus a…
anandgupta42 9540e83
feat(mcp): batch independent `sql_execute` queries and list local tab…
anandgupta42 26af169
fix(mcp): keep discovery notices inside its byte cap; forward `full_t…
anandgupta42 1602aea
feat(mcp): accept client-computed numbers in `answer_commit`
anandgupta42 3f74028
feat(mcp): advertise compact tool schemas and shorter instructions
anandgupta42 303265b
fix(mcp): keep `sql_check.join` values and the `query_from` target ru…
anandgupta42 1812c0c
feat(mcp): store spilled `sql_execute` rows as a scratch table and sh…
anandgupta42 68dcafe
feat(mcp): compact MCP output: CSV spills, no rule lines, hints once …
anandgupta42 d2d9edc
fix(mcp): do not call the CSV spill copy exact
anandgupta42 e544a58
fix(mcp): restore the compound-request rule in the compact `answer_co…
anandgupta42 0028a4b
fix: point the `warehouse_list` no-connections hint at the real confi…
anandgupta42 1ee2d31
fix: keep warehouse connection registry state per project directory (…
anandgupta42 2f2ff27
feat(mcp): add connections from an empty MCP session with `warehouse_…
anandgupta42 8f3c986
feat(mcp): describe tables and run queries in one `sql_execute` call;…
anandgupta42 d4abef2
docs(mcp): describe the five-tool default, `tables`, `--all-tools` an…
anandgupta42 873d18a
fix(warehouse): open SQLite/DuckDB stores this process cannot write r…
anandgupta42 24b4538
refactor(mcp): shorter property descriptions for `sql_execute` and `s…
anandgupta42 b9dbc21
feat(mcp): chain dependent `sql_execute` batch steps with `{{label.co…
anandgupta42 07b3c80
fix(mcp): expand `{{label.column}}` to bare comma-separated values
anandgupta42 4c8490f
feat(mcp): list connections and small local catalogs in the server in…
anandgupta42 496359b
feat(mcp): make `answer_commit` optional in the server instructions
anandgupta42 0e0b21e
Merge `origin/main` into `feat/mcp-serve-toolkit`
anandgupta42 e65cfa5
fix: MCP review findings: config limits, CLI flags, scratch writes, m…
anandgupta42 79839d4
fix: tolerate a non-string connection type in `canonicalType`; substi…
anandgupta42 00bc909
fix: list connections at MCP startup from config without querying rem…
anandgupta42 e959a1f
fix: skip SSH-tunneled file connections in the MCP startup listing
anandgupta42 eca7576
fix: list local tables from catalog metadata without per-table `COUNT…
anandgupta42 c4c8a55
fix: keep the profiling cap for remote DuckDB and treat SSH-tunneled …
anandgupta42 6dd2f27
fix: drop the column-profiling cap for every SQLite store, including …
anandgupta42 e3940d5
Merge remote-tracking branch 'origin/main' into HEAD
anandgupta42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.