For the complete documentation index, see llms.txt. This page is also available as Markdown.

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:

If your site is...
Use this URL
Example

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 customizationPage 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

1

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.

2

Add the server to your tool

Use the tab for your tool below. Replace {docs-site-url} with your own published site URL.

If your site uses the second endpoint, swap /~gitbook/mcp for /~gitbook/mcp/auth.

3

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 SettingsConnectors.

Click Add custom connector. Then paste your MCP server URL, such as {docs-site-url}/~gitbook/mcp.

Example:

https://gitbook.com/docs/~gitbook/mcp

If Claude doesn’t show remote connectors, your current plan or rollout might not support them yet.

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 customizationPage 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. stdio and SSE aren’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.

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 stdio or SSE, 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.

1

Discover the OAuth server

During the MCP handshake, the client discovers your site's OAuth server.

2

Register a client with DCR

The client registers an OAuth client with Dynamic Client Registration.

You don’t need to create a client ID manually.

3

Sign in with your site auth provider

The client redirects you to your site's auth provider.

You sign in with the same provider your docs site already uses.

4

Exchange the code for a token

After sign-in, the client exchanges the authorization code for an access token.

5

Reuse the token

The client sends that token with later MCP requests until it expires.

This flow works with these authenticated access backends:

To set this up, start with Authenticated access and Enabling authenticated access.

Last updated

Was this helpful?

Powered by GitBook