Decorative Curve
Back to Field Notes

What is an MCP Server? How to Connect One to Your Docs

An MCP server lets an AI agent discover, read, and call your API directly. Here's how MCP works and how to connect one to your docs with ReadMe.

ReadMe TeamAugust 11, 202613 min read

There are a few ways to give an AI agent access to your docs. You could point it at the markdown version of any page you need it to know about, or you could use the “Copy Page” button and paste the text directly into the terminal. You can build skills that select the right documentation for whatever the agent needs to do, or you can just leave it to fate and watch as Claude Code goes through the dreaded Web Search(“readme docs 2025”) routine and wonder when AI will learn what year it is.

But the most agentic way to provide access to documentation is through an MCP server. MCP gives an AI agent a structured way to access an external system, discover what's there, and use it. This could be your documentation, but the strength of MCP is that it can work for anything, whether that system is a database, a third-party service, or your own API with its docs.

This post covers what an MCP server is and how it works, concentrating on one of the most useful cases for an API company: connecting your documentation so a developer's AI agent can read it, search it, and call your API in a single loop.

What is an MCP Server?

An MCP server is a program that exposes an outside system, like an API, a database, or a set of docs, to an AI model through a standard protocol, so the model can discover what the system offers and use it directly. MCP stands for Model Context Protocol: a protocol to give a model more context.

MCP started as a project from Anthropic. They wanted a way to connect AI assistants to outside tools and data, one that any model and any system could use without a custom integration for every pairing.

With MCP, a system exposes each of its capabilities as a named tool, with a description of what the tool does and a schema for what it expects. The model reads that list, picks the tool that fits the task, and calls it; the server runs the call and hands back the result. When you wrap an API that way, every endpoint becomes a tool an assistant can discover and invoke on its own.

The word server works like a web server. It sits at a URL, waits for requests, and answers them. The difference is who's asking. A web server answers browsers; an MCP server answers AI agents, speaking a protocol built for how agents work.

So a developer using Cursor, Claude Code, or any other MCP-compatible tool can point it at a server, and the assistant immediately knows what that system offers. What that buys the agent depends on the backend:

Connect an MCP server to...And the agent can...
A databaseInspect the schema and run queries
A code host like GitHubOpen pull requests, read issues, check CI
A file systemList, read, and write files in a directory
A messaging tool like SlackSearch channels, read threads, post updates
A tracker like Jira or LinearFind tickets, create issues, update status
Your API and its docsDiscover every endpoint, read schemas, make live calls

In every case, the agent works from the live system instead of copy-pasted snippets or a stale memory of how the API looked months ago.

MCP Servers vs. Traditional APIs

An MCP server doesn't replace traditional APIs. It adds the discovery and calling layer that a raw API leaves out, and standardizes it, so something that has to learn the system on the fly can actually use it.

REST APIs assume the caller already knows what it wants. A human developer reads the docs, learns the paths and parameters, and hardcodes the calls ahead of time. Calling the API itself advertises nothing; there's no standard way for it to tell a caller what endpoints exist, what each one expects, or how to authenticate. A human fills that gap by reading the documentation.

An agent has no human in that loop. It's reasoning about a task in the moment, and every API describes itself differently, so there's nothing uniform for a model to read across them. MCP gives every server the same way to advertise its tools and the same protocol for calling them, so a model can walk up to any MCP server, ask what's available, and use it without a bespoke integration written for that one API.

Authenticated MCP Servers

An authenticated MCP server is one that verifies who's connecting before it responds, so you can expose your tools to specific users rather than anyone with the URL. Plenty of the systems you'd connect to aren't public. Maybe it's a partner-only API, an internal one, or docs behind a login you want to keep that way. An MCP server can respect all of that.

Picture a fintech company with a partner API that only licensed customers can touch. Those customers' engineering teams have all moved to AI-assisted editors, and the company wants their tools to query the API directly, but it can't throw the whole thing open to anyone who finds the URL. The connection has to be authenticated, so only credentialed partners get in, and scoped, so each partner's calls run against their own data.

That's two separate questions, and they stay separate: who's allowed to read your docs and discover your endpoints, and who's allowed to make a live API call and under whose credentials. The setup section below covers both.

ReadMe can help you build this. For your API documentation specifically, ReadMe generates an MCP server straight from your existing API definition and handles both layers of auth for you, with no custom server code to write or maintain. More on that further down.

How an MCP Server Works

Three parties sit in every MCP interaction, and the mechanics are the same no matter what's behind the server. Here's how they interact:

PieceWhat it isIts job
The clientThe AI tool the developer uses: Cursor, Claude Code, an agentHolds the model and sends requests on its behalf
The MCP serverThe program exposing your systemAdvertises the available tools; runs the calls it receives
The backendThe system behind the server, like your API and docsDoes the real work: returns data; executes the request

The server advertises its capabilities as discrete tools, each with a description and a schema for what it expects. When the model picks one, the client sends it as a JSON-RPC request, the server runs it against the backend, and the result comes back. A single request runs this loop.

Three properties make MCP servers more useful than the alternatives:

  • Live. The agent sees the system as it is right now, not a snapshot someone exported last quarter.
  • Two-way. The agent can act, not just read. It calls tools and gets results back over the same connection.
  • Scales by search. Instead of dumping a whole system into the model's context, where it overflows the limit and buries the model in noise, the agent searches for the piece it needs and pulls only that. A thousand-table database stays as workable as a small one.

That pattern holds whether the backend is a database, a payment API, or your docs. In the rest of this article, docs are the case we're focusing on: how to connect your API documentation, why it's worth doing, and how to set one up.

How an MCP Server Works for Your Docs

The general pattern above is exactly what plays out when the backend is your API documentation. The tools just get specific.

An MCP server built from an OpenAPI spec offers:

  • list-endpoints to return every path and method
  • get-endpoint to pull full detail on one, including its parameters and security
  • A search tool that runs across the whole spec
  • execute-request to make a live call

The agent picks the tool that fits what it's doing.

Let’s work through this workflow with an actual example. OneTrust, the privacy and compliance platform, runs its developer docs on ReadMe, and its MCP server is public. Adding it to Claude Code is one command:

claude mcp add --transport http onetrust "https://developer.onetrust.com/mcp"

If we then boot up Claude Code and ask what's on the server, the first thing you notice is scale. OneTrust isn't one API. The server fronts dozens of separate OpenAPI specs, spanning consent management, cookie compliance, data discovery, risk assessments, and more. None of it loads up front. The agent lists the specs, picks the one it needs, and drills in from there.

Narrow to the Consent Receipts spec, ask for its endpoints, and three come back:

MethodPathDescription
POST/consentreceiptsCreate consent receipts
POST/consentreceipts/bulkCreate consent receipts in bulk
POST/consentreceipts/identifiedCreate identified consent receipts

Ask for the detail on the create endpoint and the agent gets the actual contract: the required fields (identifier and requestInformation), an optional authorization header carrying a signed JWT, a purposes array alongside a dozen other optional fields, the live server hostnames to call, and every response code from a 200 that returns the receipt down through 400, 401, and a 429 when you're rate limited. That's everything needed to write a correct request, pulled on demand instead of loaded in bulk.

A few things to note:

  • This is the search-don't-ingest design paying off. A connected assistant stays as workable against the whole OneTrust platform as against a five-endpoint API, because it never holds more than the slice in front of it.
  • Here, we’re literally asking Claude, “Tell me about the create consent endpoint.” In day-to-day coding, none of this is manual. The developer asks their assistant to write code against the API, and these same lookups happen in the background.
  • The live hostnames in the contract are where MCP pulls ahead of the alternatives. A static export, an OpenAPI file, or a docs PDF is a snapshot that goes stale the moment you ship a new endpoint, and it can't do anything. An MCP server is live and two-way.

Put the three side by side, and the difference is clear:

ApproachDirectionLive or snapshotCan the agent act?
Static export (OpenAPI file, PDF)None, it just sits thereSnapshot, stale the moment your API changesNo, it only describes
WebhookOne way: your system to theirsLive, but event-triggeredNo, it notifies
MCP serverTwo way: request and responseLive, generated from your current specYes, it can read and execute

That two-way reach is also what lets an agent go past a single call and run a whole task: find every record in a given state, update each one, and report back, reading with one tool and acting with another until the job is done. That is the difference between docs an agent can read and an API an agent can operate.

What Your API Documentation Gains From an MCP Server

The mechanics are nice, but the reason to create an MCP server for your docs is what it changes for the people who depend on your docs and the team maintaining them. Here’s why you should use an MCP server for your API docs:

  • A better developer experience. Your developers stop fighting their tools. No more flipping between tabs and pasting snippets that may be stale; the API knowledge shows up inside the AI assistant exactly when it's needed. The downstream effect is fewer wrong integrations, since so much bad API code traces back to an outdated example or a half-right guess at a parameter, and that mostly disappears when the assistant pulls from your live spec.
  • A lighter support load. Every question your docs answer on their own is a question that never becomes a ticket. Your team gets the genuinely novel problems instead of the same handful over and over.
  • Your docs stay the source of truth for AI. Developers will ask AI about your API, whether or not you've set anything up. With no MCP server, the AI guesses from whatever it picked up in training, which may be wrong, outdated, or about a competitor. With one, your documentation becomes the authoritative source it reaches for. That feeds Answer Engine Optimization, making sure AI systems represent you accurately, because an agent querying your live docs answers questions about your API correctly.

How to Connect Your API Docs to an MCP Server

Built from scratch, a docs MCP server means writing and hosting a service that speaks the protocol, parsing your spec into discoverable tools, adding a search layer, proxying live calls through to your endpoints, handling auth on both the docs and execution sides, and keeping all of it in sync as your API changes. It's an engineering project, and an ongoing one.

If you use ReadMe, you can skip all that. Because it already holds your spec, enabling an MCP server is a toggle in the AI panel, not a build. It goes live at a URL you can hand to your users, with nothing to run and nothing to rebuild when your API changes.

From the same panel, you can control which endpoints are exposed, add custom tools, and generate a ready-to-publish connection page for your users. ReadMe's MCP server docs walk through each of these.

Auth works in two independent layers, which matters if your API or docs aren't public:

  • Reading your docs. A private project authenticates users with a token on the MCP URL or an x-readme-auth header.
  • Making live calls. Any headers a user adds to their config are forwarded to the real request, so they supply their own API key, and ReadMe passes it through.

Start Building Your MCP-Enabled Docs With ReadMe Today

MCP is how developers expect to work with APIs, straight from the tools they're already in. An MCP server provides live, accurate docs instead of whatever a model half-remembers, and with ReadMe, you don't have to build or maintain any of it.

If your API is already in ReadMe, your MCP server is one toggle away. Start your first project, or talk to our team if you want to see it on your own docs first.

FAQs

Can I see which AI tools and agents are using my MCP server?

Yes. If you have ReadMe's developer analytics enabled, MCP usage shows up alongside your other metrics, including which tools agents called and what searches they ran. That tells you which parts of your API developers' AI tools reach for most and where they get stuck, which points you straight at the docs worth improving.

How is an MCP server different from just publishing an OpenAPI spec?

An OpenAPI spec is a static description of your API. It's valuable, and a good MCP server is generated from one, but on its own, it only describes your API. An MCP server makes that spec live and interactive: The agent can search it, pull detail on demand, and execute calls against your real endpoints, none of which a published spec does by itself. The spec is the blueprint; the MCP server is the working connection built from it.

Does an MCP server improve how AI answers questions about my API?

For developers and agents that connect to it, yes: They work from your live spec instead of guessing from training data. But an MCP server is opt-in, so it doesn't change what a cold query to ChatGPT or Google's AI overview returns when someone hasn't connected. That broader answer-engine visibility is a discoverability problem, and it's what a file like llms.txt addresses by helping AI crawlers find and index your docs. The two work together: llms.txt for being found on the open web, and an MCP server for being accurate once a tool is connected.

Connector
Everything to Build Great Docs
Connector
The Full Documentation Stack
Decorative CurveReady?
Get a preview
of your docs
ConnectorConnector
Decorative Curve
Terms of ServicePrivacy Policy
MSA