MCP servers for published docs
Each published GitBook site includes an MCP server you can connect to external tools
Every published GitBook site includes a Model Context Protocol (MCP) server.
AI tools can use it to read your published docs directly. This works with tools like Claude Desktop, Cursor, and VS Code extensions.
Your MCP server lives at your published site URL plus /~gitbook/mcp.
For example, GitBook’s docs live at https://gitbook.com/docs. Its MCP server is https://gitbook.com/docs/~gitbook/mcp.
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.
Connect an AI tool
Requirements
To use an MCP server:
Your site must be published. The MCP server exposes published content only.
Your tool must support MCP over HTTP.
If your site uses authentication, the MCP server must use the same access rules.
GitBook supports HTTP transport only.
stdioandSSEaren’t supported.
Add the MCP link to your site
In Site customization, open the Page actions section. Then turn on Connect with MCP server.
Visitors can then copy the server URL from the page actions menu.
Privacy and access
The MCP server gives read-only access to your published docs.
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 ends with
/~gitbook/mcp.If the site uses authentication, use a client that supports MCP authorization.
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 to the server automatically using OAuth and Dynamic Client Registration (DCR).
How it works
When a supported MCP client connects to your authenticated site's MCP server, it:
Discovers the OAuth server via the MCP handshake
Dynamically registers an OAuth client (no manual client ID setup required)
Redirects you to your site's upstream auth provider to sign in
Exchanges the auth code for an access token and stores it locally for all subsequent requests
GitBook prompts you to authenticate the first time you connect. After that, the client reuses the token until it expires.
Requirements
For this flow to work, your site must use one of GitBook's supported authentication backends:
Auth0, Azure AD, Okta, AWS Cognito, or OIDC via the native integrations
A custom backend with a Fallback URL configured
GitBook doesn't support share-link-only sites or sites using visitor auth tokens passed as static headers for MCP authentication.
Last updated
Was this helpful?