Repository navigation
Answer questions about Data Hub through the MCP server - #301
Merged
Merged
Conversation
A script in the docs site writes every hand-written docs page as Markdown into web/lib/mcp/docs/, using the same text the site serves at /docs/<page>.md. make docs-catalogs runs it last, and docs-lint.yml fails when the committed copy is stale. The docs package becomes an ES module package so Node can load the Fumadocs output, and gains tsx to run the script. Co-authored-by: Wasim Amiri <wasimxyz@users.noreply.github.com>
Adds two MCP tools and a datahub://docs/{page} resource template that serve
the bundled docs pages and the changelog. search_docs returns up to five
matching sections with excerpts and links, and lists every page when nothing
matches. read_doc returns one page or one section, so no call loads all the
docs. Analytics record result counts and page IDs, never the query text.
Co-authored-by: Wasim Amiri <wasimxyz@users.noreply.github.com>
The old text was 2.2 KB, so Claude Code cut off the feedback guidance. The new text says what Data Hub is, points how-to questions at search_docs, and no longer sends agents to the glossary resource, which most clients cannot read on their own. Co-authored-by: Wasim Amiri <wasimxyz@users.noreply.github.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Adds 21 golden questions that each name the page that should answer them, tests for the Markdown helpers and page references, protocol tests for the two tools and the resource template, analytics tests, and a test that keeps the server instructions under 2 KB. The integration test also calls both tools against the production build, which proves the bundled docs and the changelog ship with the app. A test found that a card description ending in a period got a second one in search excerpts, so that is fixed too. Co-authored-by: Wasim Amiri <wasimxyz@users.noreply.github.com>
Adds a section to the MCP overview page, a changelog entry, a developer page on how the docs bundle and search work, and notes in AGENTS.md and docs/site/AGENTS.md that docs changes need make docs-catalogs. The bundled docs are regenerated to include the new MCP section. Co-authored-by: Wasim Amiri <wasimxyz@users.noreply.github.com>
Excerpts lost the closing > of text such as <token_id> and showed rows of table dashes. Docs resource names now add a page suffix only to the second and later pages that share a title, so the first stays plain. Co-authored-by: Wasim Amiri <wasimxyz@users.noreply.github.com>
wasimxyz
marked this pull request as ready for review
October 9, 2026 06:32
Co-authored-by: Cursor <cursoragent@cursor.com>
search_docs now counts a section as an answer only when it holds two thirds of the question's words and every word appears in the docs. Otherwise it adds a hint that names missing words and offers send_feedback, and analytics counts it in the 0 bucket. Watcher bump instructions now regenerate the docs bundle, the code uses 'bundle' instead of 'corpus', and the MCP catalog carries the tool group labels the docs site reads. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch was successfully deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this does
An AI assistant connected to the Data Hub MCP server can now answer how-to questions about Data Hub itself, using the docs that ship with that deployment.
search_docs(query)returns up to five matching sections from the docs pages and the changelog. Each result has a short excerpt, a page ID, and a link to cite. When nothing matches, it returns the list of all docs pages and tells the agent to offersend_feedbackfor the gap.read_doc(page, section?)returns one page or one section as Markdown. No tool returns all the docs at once, and the longest page is about 18,000 characters.datahub://docs/{page}is a resource template that lists the 26 docs pages (not the changelog) and autocompletes page IDs, for clients where people attach context by hand.search_docs. A unit test fails if it grows past 2,048 bytes.datahub://glossarystays, but the instructions no longer point to it, because most clients cannot read resources on their own.Why tools and not only resources: in claude.ai, Claude Desktop, VS Code, and ChatGPT, the model cannot read a resource by itself, and the MCP specification says model-controlled access should use tools. The resource template is there for people who attach pages by hand.
How the docs get into the web app
Each deployment answers from its own docs, so the pages are bundled with the web app:
docs/site/scripts/generate-docs-corpus.tswritesweb/lib/mcp/docs/docs-corpus.snapshot.jsonusing the same Markdown the site serves at/docs/<page>.md.make docs-catalogsruns it last.docs-lint.ymlregenerates it and fails when the committed copy differs, like the other generated files.cli-reference,mcp, andapi(the overview). It leaves out the generated API endpoint pages, the MCP catalog pages, anddocs/developer/."type": "module") and gainstsx, because Fumadocs can only load the site's MDX outside Next.js that way. The docs site's typecheck, lint, link check, and production build all still pass.minisearch(new dependency inweb/), with no embeddings, extra service, or API key.Analytics
mcp_docs_searchrecords only a result-count bucket, andmcp_docs_readrecords only a page ID that resolved against the bundle. Query text is never recorded, per the rule inweb/lib/analytics/track.ts. A rising share of empty searches shows where the docs have gaps.Testing
web/tests/unit/mcp-docs-search.test.ts, each with the page that should answer it, which must be in the top three results. I checked they can fail: turning off stop-word removal broke four of them.next buildandnext start, which proves the bundle and the changelog files ship with the app.mcp.test.tsandmcp-oauth.test.tspass (37 tests), the unit suite passes (550 tests), andmake checkpasses.npm cifollowed bymake docs-catalogsleaves no changes, so CI's drift check will pass.Excerpt from a recorded session over HTTP against the production build
Notes for reviewers
docslink, or none.web/, so the web app's Vercel project rebuilds for them. That is intended: the deployed MCP server has to carry the new text.uvwere missing on the VM I used, so I installed them to run the integration tests andmake check.