Skip to content

docs: example MCP server that answers API questions from a MrDocs corpus #1300

Description

@alandefreitas

An MCP server backed by a MrDocs corpus can answer questions about a library's API without the model having to read or scan the library. Add it as a worked example.

Why it is worth an example

An assistant asked about a C++ library today either guesses from training data or reads headers, which is slow and often wrong about overloads, template parameters, and which members a class inherits.

MrDocs already produces exactly the structured answer: a corpus with signatures, doc comments, parameters, return types, base classes, and cross-references, resolved by Clang rather than by pattern matching. Serving that over MCP puts a correct API reference in front of any MCP client, at the cost of one extraction run.

It also exercises a part of MrDocs the current examples do not: consuming the corpus as data rather than rendering pages.

Proposed solution

A generator or extension that emits whatever the server needs, most likely a JSON index. examples/generators/script-driven/search-index/ and examples/generators/script-driven/json/ are the closest existing examples and are the right starting point.

A small MCP server that loads that output and exposes a few tools. Something like: look up a symbol by qualified name, search symbols by name, get a symbol's full signature and documentation, and list a class's members including inherited ones.

A README showing the full path: run MrDocs over a library, start the server, point an MCP client at it, ask a question, get an answer with the real signature.

Keep the server small. The point is showing that the corpus is directly usable, not shipping a product.

The script-driven generator examples under examples/generators/script-driven/ show the layout to follow, including how each is registered as a test in examples/generators/CMakeLists.txt and driven by a run.sh.

The language for the server is open. Node keeps it close to the existing tooling and the MCP SDK, and Python is fine too. Pick a small library for the example so the extraction is fast enough to run in a test.

Reference: https://github.com/upstash/context7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsProject documentation

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions