← Back to Blog

2026-09-22 • Updated 2026-09-26 • 7 min read • Build

How to Build an MCP for Your Developer Documentation

Turn an SDK or API reference into an MCP server with reference lookup and code example lookup, then check each answer cites the right kind of page.

To build an MCP server for your developer documentation, index the portal that holds your API reference and guides, add the repository with your official code samples, and turn on tools for reference lookup and code examples as well as search. Context MCP Studio does this with no code. A coding assistant like Cursor, Claude, or Codex can then pull the exact endpoint contract and a working sample while the developer writes the integration.

At the end you will have one server that answers "what does this endpoint require?" from the reference and "show me how to call it" from real code, with a citation for each, and a short test that proves it.

Why developer docs need more than search

A developer asks two kinds of question, and rarely says which. "What header does POST /v1/charges require?" is answered by the API reference. "How does the Node sample handle a failed charge?" is answered by a tutorial or the sample repository. Both questions mention charges, so a server with search alone can hand back the quickstart for either one.

The reference holds the contract. If your charges endpoint requires an Idempotency-Key header, that name has to come from the reference page, because it is the page your team keeps exact. A tutorial may abbreviate it or show it once in passing.

The sample holds the working code. Code in a repository is what your team actually runs, so it is the best citation for "show me how".

Which tools to choose

You select between 3 and 10 tools. For an SDK or API reference, these do most of the work:

  • find_api_reference locates endpoints, method signatures, and parameter documentation. This is what sends a contract question to the reference page.
  • get_code_examples returns code snippets, and accepts a programming language filter, so a developer can ask for the Python version specifically.
  • search_docs finds the best matching passages across everything on the server.
  • get_quickstart returns setup and getting started content for a new user.
  • extract_schema pulls out request and response types and data models.

If you publish release notes, add get_changelog. The tool selection guide has a recommended set for developer docs.

How to build the server

Before you start, pick one reference page and one tutorial you know well, such as the charges reference and the quickstart that calls it.

  1. Open the MCP Studio wizard.
  2. Name it for the portal. Payments developer docs is clearer later than My server.
  3. Paste the portal URL. Use the documentation root, such as /docs, rather than the marketing homepage, so every page on the server is developer content. A documentation site is crawled up to 5,000 pages.
  4. Add the sample repository as a second source if your official samples live on GitHub. Private repositories work too and make the server private.
  5. Select find_api_reference, get_code_examples, search_docs, and get_quickstart.
  6. Deploy, and wait until indexing finishes before you judge the answers.

The MCP Studio wizard, showing a source added and ready to deploy

Your server URL looks like this:

https://appatools.com/mcp-studio/api/mcp/your-server-name

If your docs are hosted on GitBook, you can add GitBook's own MCP endpoint as a source and put your repository beside it. That endpoint is queried when the question arrives and supports retrieval only; it does not expose GitBook's action tools. Your GitBook docs and your code walks through it.

How to connect it to a coding assistant

Paste the server URL into the assistant your developers already use. In Cursor it goes under Settings → MCP Servers. In Codex you can run codex mcp add payments-docs --url <your server URL> and start a new session so it connects. The Codex guide and Connect to AI tools cover each client step by step.

How to check that it works

Run these three questions in order.

  1. A contract question. "What header is required on POST /v1/charges?" The citation should be the reference page, and the header should match what that page says, such as Idempotency-Key.
  2. A code question. "Show me how the Node sample sends that header." The citation should be the sample repository or the tutorial, and the reply should contain code.
  3. A question the portal does not cover. Ask about an endpoint you never documented. The server should say its content does not cover it, rather than inventing one.

You: What are the parameters for POST /v1/refund-batches?

Assistant: Nothing in this server's content covers a refund batches endpoint. The closest material is the refunds reference, which is a different endpoint. You would need to add that documentation as a source.

Scoring questions like these over time is covered in How to test an MCP server for accuracy.

If answers keep citing the quickstart

Check that the reference is under the URL you added. Some portals host the reference on a separate path or subdomain. Add that path as its own source.

Confirm find_api_reference is selected. Without it, contract questions go through general search alone.

Prefer the reference with a rule. A retrieval rule such as "for questions about endpoints, headers, or parameters, prefer the API reference" raises that source for matching questions.

Keep internal pages off a public server. If your portal has staff-only sections, put them on a separate private server. Who can reach your MCP server explains the choice.

Frequently asked questions

Can Cursor use my API documentation through MCP?

Yes. Build an MCP server from your documentation, then add its URL in Cursor's MCP settings. Cursor can then call tools like find_api_reference and get_code_examples while it writes code, and cite the page each answer came from.

Should I index my GitHub repository or my docs site?

Index both when you can. The docs site holds the contract and the explanations, and the repository holds the code your team actually runs. The free tier includes two sources per server, which covers one of each.

How do I get code examples in a specific language?

Select the get_code_examples tool when you build the server. It accepts a programming language filter, so an assistant asked for Python can request Python snippets from your sources.

What happens when my API reference changes?

Website and repository sources refresh automatically every day, and you can refresh any source from the dashboard at any time. Pages that have not changed are skipped, so a refresh of a stable portal is quick.

Can I use GitBook or another docs platform as the source?

Yes. Any published documentation URL can be indexed, and GitBook's MCP endpoint can be added directly as a source. That endpoint supports retrieval only and does not expose remote action tools.

Build a developer docs server with MCP Studio

Add your portal and sample repository, turn on reference and code lookup, and ask for the charges header. The wizard takes about a minute and needs no code. Open MCP Studio and keep the server when the citation is the reference page.

Where to go next