> 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-to/mcp-servers-for-published-docs.md).

# 公開ドキュメント向け 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 を使用                          | 例                                            |
| --------------------------------------------- | ----------------------------------- | -------------------------------------------- |
| 公開、共有リンクで共有され、公開済みコンテンツがすべて公開されている、または完全に認証済み | `{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 サーバーを動作させるには有効にする必要があります。 **サイトのカスタマイズ** → **ページアクション**をオフにすると、GitBook は `~gitbook/mcp` を無効にし、エンドポイントは `404`. **MCP サーバーに接続する** ページアクションメニューに MCP リンクを表示するかどうかだけを制御します。
{% 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 %}

#### に置き換えてください。

テスト用の質問を 1 つ試してください [試してみる](#try-it)。ツールがドキュメントを検索してそこから回答できれば、接続は成功です。
{% endstep %}
{% endstepper %}

{% tabs %}
{% tab title="Claude" %}
これらの手順は、Web 版 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 transport のサーバーエントリを追加します:

```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 サーバーによって公開されているツールを一覧表示してください。次に、それらを使ってページアクションに関するページを見つけてください。`

エージェント型ツールを使う場合は、このセットアップ用プロンプトを与えることもできます:

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

### 要件

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

* サイトは公開されている必要があります。MCP サーバーは公開済みコンテンツのみを公開します。
* **ページアクション** で有効になっている必要があります **サイトのカスタマイズ** → **ページアクション**.
* 使用するツールは HTTP 経由の MCP をサポートしている必要があります。
* サイトが [認証済みアクセス](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access.md)を使用している場合、ツールは [MCP 認可仕様](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization).
* サイトが共有リンクを使用している場合は、共有リンクのサイト URL を使用し、次をエンドポイントとして追加してください。 [適切なエンドポイントを選択する](#choose-the-right-endpoint).
* GitBook は HTTP transport のみをサポートしています。 `stdio` と `SSE` はサポートされていません。

〜の中で **ページアクション** あなたの [カスタマイズ](/docs/documentation/ja-gitbook-documentation/docs-site/customization.md) 設定のセクションでは、 **MCP サーバーに接続する** オプションを有効にできます。これにより、訪問者はサイトの MCP サーバー URL を [ページアクションメニュー](/docs/documentation/ja-gitbook-documentation/docs-site/customization/extra-configuration.md#page-actions).

### サイトに MCP リンクを追加する

〜で [サイトのカスタマイズ](/docs/documentation/ja-gitbook-documentation/docs-site/customization.md)を開きます。 [ページアクション](/docs/documentation/ja-gitbook-documentation/docs-site/customization/extra-configuration.md#page-actions)がオンになっていることを確認してください。次に **ページアクション** をオンにします **MCP サーバーに接続する**.

これにより、ページアクションメニューにコピー可能な MCP リンクが追加されます。ツールが使用するエンドポイントは変わりません。

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

次のエンドポイントを使用してください [適切なエンドポイントを選択する](#choose-the-right-endpoint).

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

非表示のページは MCP 経由でも引き続き利用できます。ページを非表示にしても、公開済みの目次から削除されるだけです。

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

最新の公開バージョンのみを提供します。下書きや未公開の変更はプライベートのままです。

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

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

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

### 認証済みサイトで MCP を使用する

GitBook サイトが [認証済みアクセス](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access.md)を使用している場合、MCP サーバーは `/~gitbook/mcp` 同じ認証を使用します。次をサポートする MCP クライアントは [MCP 認可仕様](https://modelcontextprotocol.io/docs/tutorials/security/authorization) — Claude と Claude Code を含む — は、OAuth と Dynamic Client Registration (DCR) を使用して自動的に接続できます。

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

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

サポートされている MCP クライアント — Claude を含む — は、 [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](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access/setting-up-auth0.md)
* [Azure AD](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access/setting-up-azure-ad.md)
* [Okta](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access/setting-up-okta.md)
* [AWS Cognito](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access/setting-up-aws-cognito.md)
* [OIDC](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access/setting-up-oidc.md)
* [カスタムバックエンド](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access/setting-up-a-custom-backend.md) （Fallback URL が設定されているもの）

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

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

この設定を行うには、まず [認証済みアクセス](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/authenticated-access.md) と [認証済みアクセスを有効にする](/docs/documentation/ja-gitbook-documentation/saitohenoakusesu/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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
