# MCP server for API docs: give AI assistants access

AI coding assistants are only as good as what they can read. Ask one to call your internal billing API and it will guess
field names. SelfDocHub has a built-in **MCP server** (Model Context Protocol), so an assistant reads the real,
current documentation instead: the endpoints, the schemas, the version history and the notes your team wrote.

## What the assistant can do

Through MCP an assistant can list services and endpoints, read the parameters and responses of an endpoint with the schemas
they use, search the documentation including your text pages, browse the version history, read the change log and diff two
versions, and read your Markdown overlays. The tools include `list_services`, `list_endpoints`, `get_endpoint_schema`,
`search_docs`, `list_versions`, `get_version_changelog`, `diff_versions` and `get_overlay`.

By default the integration is **read-only**. It never exposes license data and never creates, edits or deletes anything.

## Scoped tokens

Access is granted by tokens, and any number can be active at once. Each token has its own settings, so one client can see a
couple of services while another sees more:

- the **services** it may read: any other service is refused by every tool;
- an **IP/CIDR allowlist**;
- the maximum number of **search results**;
- whether **overlay text** is included in answers;
- independent switches for the **schema**, **version-history** and **search** tool categories;
- whether the model may see other **branches** and **historical versions**.

The secret is generated by the server, shown once and stored only as a salted hash. Replacing it invalidates the old one at
once, and changes to a token take effect immediately without a restart. The page also shows when each token was last used.

## Connect a client

In an MCP-capable client, such as a connector setting in Claude or Cursor, enter the URL `https://<your-domain>/mcp` and the
header `Authorization: Bearer <token>`. A quick check with curl works too:

```bash
curl -X POST https://<your-domain>/mcp \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
```

## Optional: Try-It through MCP

If you want the assistant to verify an answer with a real call, you can enable **Try-It** for a token and open selected
environments to it. This is a potentially dangerous feature, so it is off by default and has its own controls: the model can
only use environments an administrator opened to it, with the credentials configured there, and limits keep it in check. Try
it on test environments first, keep the limits low and prefer tokens with a narrow list of services. Try-It through MCP is
part of the Business and Unlimited plans.

## Why self-hosted matters here

Your API documentation describes your internals. With SelfDocHub the server that answers the assistant is your own, behind
your own network rules, with an optional IP allowlist per token, and every rejected request is logged. The request quota
depends on the plan: 20,000 requests per month on Free, 100,000 on Team and 500,000 on Business.

---
Source: https://selfdochub.com/features/mcp-server-api-docs
