> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/ai-for-your-readers/mcp-servers-for-published-docs.md).

# 公開ドキュメント向け MCP サーバー

GitBook で公開されたドキュメントは、自動的に MCP サーバーを生成し、外部ツールに接続できます

公開されているすべてのGitBookサイトには、Model Context Protocol（MCP）サーバーが自動的に含まれます。

AIツールはこのサーバーを使って、公開済みのドキュメントを直接読み取れます。Claude、Claude Code、Cursor、Codex、VS CodeなどのMCPクライアントで利用できます。

### 適切なエンドポイントを選ぶ <a href="#choose-the-right-endpoint" id="choose-the-right-endpoint"></a>

MCPサーバーは、公開サイトのURLに次のいずれかのエンドポイントを追加したURLで利用できます。

| サイトの設定が次の場合                                   | 使用するURL                             | 例                                            |
| --------------------------------------------- | ----------------------------------- | -------------------------------------------- |
| 公開、共有リンクで共有されていて公開済みコンテンツがすべて表示可能、または完全に認証が必要 | `{docs-site-url}/~gitbook/mcp`      | `https://gitbook.com/docs/~gitbook/mcp`      |
| 一部のみ認証が必要で、公開または共有リンクで閲覧可能なコンテンツもある           | `{docs-site-url}/~gitbook/mcp/auth` | `https://gitbook.com/docs/~gitbook/mcp/auth` |

完全に認証が必要なサイトでは、クライアントはMCPのディスカバリーとOAuthを通じてサインインします。詳しくは、 [MCP認可フロー](https://modelcontextprotocol.io/docs/tutorials/security/authorization#the-authorization-flow-step-by-step).

{% hint style="info" %}
このURLをブラウザーで開くと、エラーが表示されます。AIアシスタントやIDEなど、HTTPリクエストを送信できるツールで使用してください。
{% endhint %}

{% hint style="info" %}
**MCPサーバーに接続** に含まれている必要があります **有効なアクション** のリスト **サイトのカスタマイズ** → **ページアクション** MCPサーバーを動作させるには、に含まれている必要があります。これを に移動するか **利用可能なアクション**、または をオフにすると **ページアクション**, `~gitbook/mcp` を返します `404`.
{% endhint %}

### AIツールを接続する

{% stepper %}
{% step %}

#### MCPサーバーのURLを確認する

公開済みドキュメントのURLを確認し、 [適切なエンドポイントを選ぶ](#choose-the-right-endpoint).

のエンドポイントを追加します。たとえば、ドキュメントサイトが `https://gitbook.com/docs`の場合、MCPサーバーのURLは `https://gitbook.com/docs/~gitbook/mcp`.
{% endstep %}

{% step %}

#### ツールにサーバーを追加する

以下から使用するツールのタブを選びます。 `{docs-site-url}` を、ご自身の公開サイトURLに置き換えてください。

サイトで2つ目のエンドポイントを使用する場合は、 `/~gitbook/mcp` を `/~gitbook/mcp/auth`.
{% endstep %}

{% step %}

#### テスト用の質問をする

「 [試してみる](#try-it)」にあるプロンプトを1つ実行します。ツールがドキュメントを検索し、その内容に基づいて回答できれば、接続は正常です。
{% endstep %}
{% endstepper %}

{% tabs %}
{% tab title="Claude" %}
次の手順は、ウェブ版ClaudeとClaude Desktopの両方で使用できます。

「 **設定** → **コネクタ**.

」をクリックします。 **カスタムコネクタを追加**を選択します。次に、以下のようなMCPサーバーのURLを貼り付けます： `{docs-site-url}/~gitbook/mcp`.

例:

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

Claudeにリモートコネクタが表示されない場合は、現在のプランまたはロールアウト状況ではまだサポートされていない可能性があります。
{% endtab %}

{% tab title="Claude Code" %}
ターミナルで次のコマンドを実行します：

```shell
claude mcp add --transport http my-docs https://gitbook.com/docs/~gitbook/mcp
```

次の `my-docs` を任意のサーバー名に置き換えてください。

サイトで認証付きパブリックエンドポイントを使用している場合は、URLの末尾を次のように置き換えてください： `/~gitbook/mcp/auth`.
{% endtab %}

{% tab title="Cursor" %}
「 **設定** 」→「 **MCP**.

」を開き、「 **新しいMCPサーバーを追加**」をクリックします。次に、以下を貼り付けます： `{docs-site-url}/~gitbook/mcp`.

次の内容を以下のファイルに追加することもできます： `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "my-docs": {
      "url": "https://gitbook.com/docs/~gitbook/mcp"
    }
  }
}
```

必要に応じて、 `my-docs` を任意のサーバー名に置き換えてください。
{% endtab %}

{% tab title="Codex" %}
次の `codex mcp add` コマンドを使用するか、サーバーを以下のファイルに追加します： `config.toml`.

コマンドの例：

```shell
codex mcp add my-docs https://gitbook.com/docs/~gitbook/mcp
```

設定の例：

```toml
[mcp_servers.my-docs]
url = "https://gitbook.com/docs/~gitbook/mcp"
```

必要に応じて、 `my-docs` を任意のサーバー名に置き換えてください。
{% endtab %}

{% tab title="VS Code（Copilot）" %}
次のファイルを開きます： `mcp.json` 次に、HTTPトランスポートを使用するサーバーエントリを追加します：

```json
{
  "servers": {
    "my-docs": {
      "type": "http",
      "url": "https://gitbook.com/docs/~gitbook/mcp"
    }
  }
}
```

必要に応じて、 `my-docs` を任意のサーバー名に置き換えてください。
{% endtab %}
{% endtabs %}

### 試してみる <a href="#try-it" id="try-it"></a>

以下のプロンプトのいずれかをアシスタントに貼り付けます：

* `my-docs MCPサーバーを使って、認証付きアクセスの設定方法を教えてください。`
* `ドキュメントでカスタムドメインに関する情報をすべて検索し、手順を要約してください。`
* `my-docs MCPサーバーが公開しているツールを一覧表示してください。次に、それらを使ってページアクションに関するページを見つけてください。`

エージェント型ツールを使用している場合は、次の設定プロンプトを渡すこともできます：

```
https://gitbook.com/docs/~gitbook/mcp にあるMCPサーバーを、HTTPトランスポートを使用してmy-docsという名前で追加してください。次に、利用可能なツールを一覧表示して、接続できることを確認してください。
```

### 要件

MCPサーバーを使用するには：

* サイトを公開しておく必要があります。MCP サーバーが公開済みのコンテンツのみを提供するためです。
* **MCP経由でドキュメントにアクセスする** サイトの **拡張機能 → MCPアクセス**.
* **MCPサーバーに接続** に含まれている必要があります **有効なアクション** のリスト内 **サイトのカスタマイズ** → **ページアクション**.
* お使いのツールは、HTTP 経由の MCP に対応している必要があります。
* サイトで [認証が必要なアクセス](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access.md)を使用している場合、お使いのツールは [MCP 認証仕様](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization).
* サイトで共有リンクを使用している場合は、共有リンク用のサイト URL を使い、次に「 [適切なエンドポイントを選択する](#choose-the-right-endpoint).
* GitBook がサポートしているのは HTTP トランスポートのみです。 `stdio` と `SSE` には対応していません。

### MCPサーバーをオンにする

サイトの **拡張機能 → MCPアクセス** を開き、 **「MCP経由でドキュメントにアクセスする」**&#x3092;オンにします。この画面には、サイトの **MCPエンドポイント** と **認証済みMCPエンドポイント**.

次に、 [サイトのカスタマイズ](https://gitbook.com/docs/documentation/ja-gitbook-documentation/manage-your-site/customization.md)で、 [ページアクション](https://gitbook.com/docs/documentation/ja-gitbook-documentation/manage-your-site/customization/extra-configuration.md#page-actions)を開きます。 **ページアクション** がオンになっていることを確認してください。 **MCPサーバーに接続** が **利用可能なアクション**の下にある場合は、 **有効なアクション**.

これにより、サイトのMCPサーバーがオンになり、ページアクションメニューにコピー可能なMCPリンクが追加されます。サーバーとリンクは連動しています。 を移動すると **MCPサーバーに接続** に戻す **利用可能なアクション** リンクを非表示にすると、GitBookはMCPサーバーもオフにします。

### 使用制限

現在、公開済みドキュメント用のMCPサーバーはすべてのプランで利用でき、実質的な呼び出し回数の上限はありません。

この `askQuestion` ツールはサイトのAIを使用するため、サイトでAIが有効になっている場合にのみ利用できます。たとえばAIクレジットがなくなるなど、組織のAIが一時停止されると、このツールは機能しなくなります。検索とページの閲覧は引き続き利用できます。

### プライバシーとアクセス

「 [適切なエンドポイントを選択する](#choose-the-right-endpoint).

」のエンドポイントを使用してください

MCP サーバーは、公開済みドキュメントへの読み取り専用アクセスを提供します。

アカウントデータ、分析データ、GitBook の内部データが公開されることはありません。

提供されるのは、最新の公開バージョンのみです。下書きや未公開の変更は非公開のままです。

### トラブルシューティング

ツールが接続できない場合：

* 公開済みサイトにアクセスできることを確認してください。
* URL に「 [適切なエンドポイントを選択する](#choose-the-right-endpoint).
* 」のエンドポイントが使われていることを確認してください。 [サイトで認証を使用している場合は、「](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization).
* MCP 認証仕様 `」に対応したクライアントを使用してください。` ツールが「stdio」または `SSE`の場合、GitBookでは動作しません。

### 認証が必要なサイトでMCPを使用する

GitBookサイトで [認証が必要なアクセス](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access.md)を使用している場合、 `/~gitbook/mcp` にあるMCPサーバーでは同じ認証が使用されます。 [MCP認可仕様](https://modelcontextprotocol.io/docs/tutorials/security/authorization) に対応しているMCPクライアント（ClaudeやClaude Codeなど）は、OAuthとDynamic Client Registration（DCR）を使用して自動的に接続できます。

代わりに共有リンクを使用している場合は、共有リンクのサイトURL全体を使用し、 [適切なエンドポイントを選択する](#choose-the-right-endpoint).

GitBookは、共有リンクのみのサイトや、MCP認証に静的ヘッダーとして渡される訪問者認証トークンを使用するサイトには対応していません。

Claudeなど、対応しているMCPクライアントは [MCP認可仕様](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization) に従って接続します。

{% stepper %}
{% step %}

#### OAuthサーバーを検出する

MCPのハンドシェイク中に、クライアントがサイトのOAuthサーバーを検出します。
{% endstep %}

{% step %}

#### DCRでクライアントを登録する

クライアントはDynamic Client Registrationを使用してOAuthクライアントを登録します。

クライアントIDを手動で作成する必要はありません。
{% endstep %}

{% step %}

#### サイトの認証プロバイダーでサインインする

クライアントによって、サイトの認証プロバイダーにリダイレクトされます。

ドキュメントサイトで既に使用しているものと同じプロバイダーでサインインします。
{% endstep %}

{% step %}

#### コードをトークンと交換する

サインイン後、クライアントは認可コードをアクセストークンと交換します。
{% endstep %}

{% step %}

#### トークンを再利用する

クライアントは、トークンの有効期限が切れるまで、そのトークンを後続のMCPリクエストに含めて送信します。
{% endstep %}
{% endstepper %}

このフローは、次の認証済みアクセスバックエンドで動作します。

* [Auth0](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-auth0.md)
* [Azure AD](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-azure-ad.md)
* [Okta](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-okta.md)
* [AWS Cognito](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-aws-cognito.md)
* [OIDC](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-oidc.md)
* [カスタムバックエンド](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-a-custom-backend.md) Fallback URLが設定されている場合

{% hint style="warning" %}
MCP認証は、リクエストヘッダー内の静的な訪問者認証トークンのみに依存するサイトには対応していません。

代わりに、上記の認証済みアクセスバックエンドのいずれかを使用してください。
{% endhint %}

設定するには、まず [認証が必要なアクセス](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access.md) と [認証が必要なアクセスを有効にする](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/enabling-authenticated-access.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/ja-gitbook-documentation/ai-for-your-readers/mcp-servers-for-published-docs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
