> ## Documentation Index
> Fetch the complete documentation index at: https://developer.qaip.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP

> Model Context Protocol (MCP) を用いて外部サービスと連携する

## MCP 連携

QAIP は **Remote MCP ([Model Context Protocol](https://modelcontextprotocol.io/)) サーバ** を提供しています。
[Claude Code](https://www.anthropic.com/claude-code) などの MCP クライアントから接続することで、データソースをコンテクストとして簡単に活用できます。

## Claude Code と連携する

以下の手順で、QAIP と Claude Code を MCP 連携できます。

<Steps>
  <Step title="Claude Code をセットアップする">
    [公式ガイド](https://docs.anthropic.com/ja/docs/claude-code/overview)に従ってClaude Codeをインストールし、初回ログインを完了します。
    完了後、Claude Codeを終了し次の手順に進みます。
  </Step>

  <Step title="QAIP の Remote MCP サーバを追加する">
    ```bash title="コマンドライン" theme={null}
    claude mcp add qaip https://mcp.developer.qaip.com/mcp --transport http
    ```
  </Step>

  <Step title="Claude Code 起動後に認証を行う">
    Claude Code を起動し、プロンプトで `/mcp` と入力します。

    * 一覧から `qaip` を選択し、「Authenticate」を実行します。
    * Web ブラウザが開くので、ログインを完了すると接続が有効になります。
  </Step>

  <Step title="利用を開始する">
    * 以降、Claude Code 上で QAIP のデータソースを参照した検索・回答補強が可能です。
  </Step>
</Steps>

<Info>
  初回は認証が必要です。接続時に 401 が表示された場合は、Claude Code の `/mcp`
  から再認証を実施してください。
</Info>

## Codex CLI と連携する

以下の手順で、QAIP と Codex CLI を MCP 連携できます。

<Steps>
  <Step title="Codex CLI をセットアップする">
    [公式リポジトリ](https://github.com/openai/codex#quickstart)に従ってCodex CLIをインストールし、初期設定を完了します。

    ```bash title="コマンドライン" theme={null}
    npm install -g @openai/codex
    ```

    バージョンを確認します（**v0.64.0 以降**が必要です）。

    ```bash title="コマンドライン" theme={null}
    codex --version
    ```
  </Step>

  <Step title="RMCP クライアント機能を有効化する">
    `~/.codex/config.toml` を編集し、次の設定を追加します。

    ```toml title="~/.codex/config.toml" theme={null}
    [features]
    rmcp_client = true
    ```
  </Step>

  <Step title="QAIP の Remote MCP サーバを登録する">
    Codex の MCP 管理コマンドで QAIP の Remote MCP サーバを登録します。

    ```bash title="コマンドライン" theme={null}
    codex mcp add qaip --url https://mcp.developer.qaip.com/mcp
    ```

    * OAuth が自動検出され、Web ブラウザが開きます。
    * ログインを完了すると接続が有効になります。
  </Step>

  <Step title="利用を開始する">
    以降、Codex CLI 上で QAIP のデータソースを参照した検索・回答補強が可能です。
  </Step>
</Steps>
