MCP servers for published docs
Docs published on GitBook automatically generate an MCP server you can hook up to external tools
Every published GitBook site automatically includes a Model Context Protocol (MCP) server.
AI tools can use it to read your published docs directly. This works with Claude, Claude Code, Cursor, Codex, VS Code, and other MCP clients.
Choose the right endpoint
Your MCP server lives at your published site URL plus one of these endpoints:
Public, shared by share link with all published content exposed, or fully authenticated
{docs-site-url}/~gitbook/mcp
https://gitbook.com/docs/~gitbook/mcp
Partially authenticated, with some public or share-link content still exposed
{docs-site-url}/~gitbook/mcp/auth
https://gitbook.com/docs/~gitbook/mcp/auth
For fully authenticated sites, clients sign in through MCP discovery and OAuth. For more detail, see the MCP authorization flow.
If you open this URL in a browser, you’ll see an error. Use it in a tool that can make HTTP requests, such as an AI assistant or IDE.
Page actions must be enabled for the MCP server to work. If you turn off Site customization → Page actions, GitBook disables ~gitbook/mcp and the endpoint returns 404. Connect with MCP server only controls whether the MCP link appears in the page actions menu.
Connect an AI tool
Find your MCP server URL
Start with your published docs URL. Then add the endpoint from Choose the right endpoint.
For example, if your docs site is https://gitbook.com/docs, your MCP server URL is https://gitbook.com/docs/~gitbook/mcp.
Ask a test question
Run one of the prompts in Try it. If the tool can search your docs and answer from them, the connection works.
These steps work in Claude on the web and in Claude Desktop.
Open Settings → Connectors.
Click Add custom connector. Then paste your MCP server URL, such as {docs-site-url}/~gitbook/mcp.
Example:
https://gitbook.com/docs/~gitbook/mcpIf Claude doesn’t show remote connectors, your current plan or rollout might not support them yet.
Run this command in your terminal:
claude mcp add --transport http my-docs https://gitbook.com/docs/~gitbook/mcpReplace my-docs with any server name you want.
If your site uses the authenticated public endpoint, replace the URL suffix with /~gitbook/mcp/auth.
Open Settings → MCP.
Click Add new MCP server. Then paste {docs-site-url}/~gitbook/mcp.
You can also add this file in .cursor/mcp.json:
{
"mcpServers": {
"my-docs": {
"url": "https://gitbook.com/docs/~gitbook/mcp"
}
}
}Replace my-docs with your own server name if you want.
Use the codex mcp add command, or add the server to your config.toml.
Command example:
Config example:
Replace my-docs with your own server name if you want.
Open your mcp.json file. Then add a server entry with HTTP transport:
Replace my-docs with your own server name if you want.
Try it
Paste one of these prompts into your assistant:
Using the my-docs MCP server, how do I set up authenticated access?Search my docs for everything about custom domains and summarize the steps.List the tools exposed by the my-docs MCP server. Then use them to find the page about page actions.
If you use an agentic tool, you can also give it this setup prompt:
Requirements
To use an MCP server:
Your site must be published. The MCP server exposes published content only.
Page actions must be enabled in Site customization → Page actions.
Your tool must support MCP over HTTP.
If your site uses authenticated access, your tool must support the MCP authorization spec.
If your site uses share links, use the share-link site URL, then add the endpoint from Choose the right endpoint.
GitBook supports HTTP transport only.
stdioandSSEaren’t supported.
In the Page actions section of your Customization settings, you can enable the Connect with MCP server option. This lets visitors copy your site's MCP server URL from the Page actions menu.
Add the MCP link to your site
In Site customization, open Page actions. Make sure Page actions is turned on. Then turn on Connect with MCP server.
This adds a copyable MCP link to the page actions menu. It doesn’t change which endpoint your tool uses.
Privacy and access
Use the endpoint from Choose the right endpoint.
The MCP server gives read-only access to your published docs.
Hidden pages remain available through MCP. Hiding a page only removes it from the published table of contents.
It never exposes account data, analytics, or internal GitBook data.
It serves the latest published version only. Drafts and unpublished changes stay private.
Troubleshooting
If a tool can’t connect:
Confirm your published site is reachable.
Confirm the URL uses the endpoint from Choose the right endpoint.
If the site uses authentication, use a client that supports the MCP authorization spec.
If the tool needs
stdioorSSE, it won’t work with GitBook.
Use MCP with authenticated sites
If your GitBook site uses authenticated access, the MCP server at /~gitbook/mcp uses the same authentication. MCP clients that support the MCP authorization spec — including Claude and Claude Code — can connect automatically using OAuth and Dynamic Client Registration (DCR).
If your site uses share links instead, use the full share-link site URL, then add the endpoint from Choose the right endpoint.
GitBook doesn't support share-link-only sites or sites using visitor auth tokens passed as static headers for MCP authentication.
Supported MCP clients — including Claude — follow the MCP authorization spec to connect.
This flow works with these authenticated access backends:
Custom backend with a configured Fallback URL
MCP authentication doesn’t support sites that rely only on static visitor auth tokens in request headers.
Use one of the authenticated access backends above instead.
To set this up, start with Authenticated access and Enabling authenticated access.
Last updated
Was this helpful?