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 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.
Use this endpoint for public sites, share-link sites where all published content is exposed, and fully authenticated sites.
For fully authenticated sites, MCP clients authenticate through the MCP discovery and OAuth flow before they can access tools. For more detail, see the MCP authorization flow.
If your site is partially authenticated and still exposes public or share-link content, use /~gitbook/mcp/auth instead. For example, https://gitbook.com/docs/~gitbook/mcp/auth.
Connect an AI tool
Find your MCP server URL
Take your published GitBook site URL and add the endpoint that matches your site:
Use
/~gitbook/mcpfor public sites, share-link sites where all published content is exposed, or fully authenticated sites that use MCP discovery and OAuth.Use
/~gitbook/mcp/authif your site is partially authenticated and still exposes public or share-link content.
Find your MCP server URL
Take your published GitBook site URL. Then add /~gitbook/mcp.
Configure your AI tool
Open your tool’s MCP settings. Then enter the server URL.
Each tool handles setup differently. Check your tool’s docs for exact steps.
Start using your docs
Once connected, the tool can search your docs, open pages, and answer questions with your content.
Requirements
The MCP server respects your site’s visibility settings. Use /~gitbook/mcp for public sites, share-link sites where all published content is exposed, or fully authenticated sites that use MCP discovery and OAuth. Use /~gitbook/mcp/auth if your site is partially authenticated and still exposes public or share-link content.
In the Page actions section of your Customization settings, you can enable the Connect with MCP server option. This enables visitors to your docs site to quickly copy a link to your site's MCP server right from the Page actions menu.
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, the MCP server uses the same access rules.
If your site uses share links, use the share-link site URL, then add
/~gitbook/mcp.GitBook supports HTTP transport only.
stdioandSSEaren’t supported.
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.
If Page actions is off, GitBook disables ~gitbook/mcp and the endpoint returns 404.
Connect with MCP server only controls whether GitBook shows the MCP server link in the page actions menu.
Visitors can then copy the server URL from the page actions menu.
Privacy and access
Make sure you’re using the correct URL format. Use /~gitbook/mcp for public sites, share-link sites where all published content is exposed, or fully authenticated sites that use MCP discovery and OAuth. Use /~gitbook/mcp/auth for partially authenticated sites with public or share-link content.
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 ends with
/~gitbook/mcp.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 to the server automatically using OAuth and Dynamic Client Registration (DCR).
If your site uses share links instead, MCP still works. Use the full share-link site URL, then add /~gitbook/mcp.
GitBook doesn't support share-link-only sites or sites using visitor auth tokens passed as static headers for MCP authentication.
If your site uses authenticated access, the MCP server uses the same access rules. Public sites stay public. Protected sites require the same sign-in.
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?