Claude CodeでリモートMCPがサポートされました

Claude CodeでリモートMCPがサポートされました

Clock Icon2025.06.19

AnthropicからClaude CodeがリモートMCPをサポートしたとの発表がありました

https://www.anthropic.com/news/claude-code-remote-mcp

リモートMCPは、MCPサーバーがローカル環境ではなく、クラウドやリモートサーバー上で実行されているMCPサーバーと接続する際の総称です。

以下の図の赤枠がリモートMCPサーバーで、SSEやStreamable HTTPといった接続レイヤーがよく使われています。

cal2-mcp+auth.drawio

リモートMCPがサポートされることによって、以下のようなメリットがあります。

ローカルMCPと比較すると以下になります

  • 設定が簡単
  • アップデートをしなくて良い
    • ローカルMCPの場合、PC内のプログラムを更新する必要があります

また今回Claude Codeのアップデートには、リモートMCPサーバー向けのOAuthサポートも含まれているため、ローカルにクレデンシャルを持たなたくて良いためセキュアと言えます。

試してみる

リモートMCPサーバーと接続

まずはパブリックなリモートMCPサーバーを試します。

https://mcp.deepwiki.com/

MCPサーバーを追加します。

claude mcp add --transport sse deepwiki https://mcp.deepwiki.com/sse
実行結果
Added SSE MCP server deepwiki with URL: https://mcp.deepwiki.com/sse to local config

先ほどコマンドを実行することで、~/.claude.jsonに設定が書き込まれます。(私はexport CLAUDE_CONFIG_DIR="$HOME/.config/claudeを設定しているので、~/.config/claude/.claude.jsonに設定が書き込まれました)

~/.claude.json
(中略)
      "mcpServers": {
        "deepwiki": {
          "type": "sse",
          "url": "https://mcp.deepwiki.com/sse"
        }
      },
(中略)

claudeコマンドを実行してテキストボックスに/mcpを実行します

$ claude
╭────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                                  │
│                                                            │
│   /help for help, /status for your current setup           │
│                                                            │
│   cwd: /Users/shuntaka/repos/github.com/shuntaka9576/memo  │
╰────────────────────────────────────────────────────────────╯

 Tips for getting started:

 1. Run /init to create a CLAUDE.md file with instructions for Claude
 2. Use Claude to help with file analysis, editing, bash commands and git
 3. Be as specific as you would with another engineer for the best results

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > /mcp                                                                                                                                                                                                                      │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  /mcp     Manage MCP servers

すると接続が確認できます。

╭────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                                  │
│                                                            │
│   /help for help, /status for your current setup           │
│                                                            │
│   cwd: /Users/shuntaka/repos/github.com/shuntaka9576/memo  │
╰────────────────────────────────────────────────────────────╯

 Tips for getting started:

 1. Run /init to create a CLAUDE.md file with instructions for Claude
 2. Use Claude to help with file analysis, editing, bash commands and git
 3. Be as specific as you would with another engineer for the best results
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Manage MCP servers                                                                                          │
│                                                                                                             │
│ ❯ 1. deepwiki  ✔ connected · Enter to view details                                                          │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
   Esc to exit

選択するとMCPのtoolsが確認できます。
CleanShot 2025-06-19 at 09.28.32@2x
CleanShot 2025-06-19 at 09.29.38@2x
CleanShot 2025-06-19 at 09.30.00@2x

Claude Codeのplanモードでhttps://github.com/vercel/ai このリポジトリの概要を教えてくださいで質問してみます。わかり辛いので画像を貼ります。(画像にはありませんがツール実行の許可、不許可の選択が挟まりました)

CleanShot 2025-06-19 at 08.24.14@2x

read_wiki_contentsツールはtokenが溢れてしまっていますが、ask_questionツールは正常に動作してそうです!

結果ログ全文
> https://github.com/vercel/ai このリポジトリの概要を教えてください

⏺ vercel/aiリポジトリの概要を調査します。

⏺ vercel/aiリポジトリの概要を調査します。

⏺ deepwiki:read_wiki_structure (MCP)(repoName: "vercel/ai")
  ⎿  Available pages for vercel/ai:

     - 1 Overview
     … +23 lines (ctrl+r to expand)

⏺ deepwiki:read_wiki_contents (MCP)(repoName: "vercel/ai")
  ⎿  Error: MCP tool "read_wiki_contents" response (98202 tokens) exceeds maximum allowed tokens (25000).
     Please use pagination, filtering, or limit parameters to reduce the response size.

⏺ deepwiki:ask_question (MCP)(repoName: "vercel/ai", question: "What is Vercel AI SDK? Please provide a
                             comprehensive overview including its main features, supported providers, and
                             use cases.")
  ⎿ The Vercel AI SDK is a TypeScript toolkit designed to simplify the integration of AI models into appli
    cations built with frameworks like React, Next.js, Vue, Svelte, and Node.js. It provides a standardize
    d API to interact with various AI model providers, abstracting away their unique interfaces and reduci
    … +102 lines (ctrl+r to expand)

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Ready to code?                                                                                              │
│                                                                                                             │
│ Here is Claude's plan:                                                                                      │
│ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Vercel AI SDK の概要                                                                                    │ │
│ │                                                                                                         │ │
│ │ Vercel AI SDKは、React、Next.js、Vue、Svelte、Node.jsなどのフレームワークで構築されたアプリケーションに │ │
│ │ AIモデルを簡単に統合するためのTypeScriptツールキットです。                                              │ │
│ │                                                                                                         │ │
│ │ 主な特徴                                                                                                │ │
│ │                                                                                                         │ │
│ │ 2つの主要ライブラリ:                                                                                    │ │
│ │ - AI SDK Core: LLMと対話するための統一APIを提供                                                         │ │
│ │   - generateText(): テキスト生成とツール呼び出し                                                        │ │
│ │   - streamText(): リアルタイムでのテキストストリーミング                                                │ │
│ │   - generateObject(): Zodスキーマに基づく構造化データ生成                                               │ │
│ │   - embed(): テキストの埋め込み生成                                                                     │ │
│ │   - generateImage(): 画像生成                                                                           │ │
│ │   - transcribe(): 音声文字起こし                                                                        │ │
│ │ - AI SDK UI: チャットやジェネレーティブUIを構築するためのフレームワーク別フック                         │ │
│ │                                                                                                         │ │
│ │ サポートプロバイダー                                                                                    │ │
│ │                                                                                                         │ │
│ │ 公式サポート:                                                                                           │ │
│ │ - OpenAI、Anthropic、Google AI/Vertex                                                                   │ │
│ │ - Amazon Bedrock、Azure OpenAI                                                                          │ │
│ │ - Mistral、Cohere、DeepSeek                                                                             │ │
│ │ - Together.ai、Groq、Perplexity                                                                         │ │
│ │ - その他多数のAIプロバイダー                                                                            │ │
│ │                                                                                                         │ │
│ │ 主なユースケース                                                                                        │ │
│ │                                                                                                         │ │
│ │ 1. チャットボット・対話型AI: リアルタイムストリーミング対応                                             │ │
│ │ 2. コンテンツ生成: メール作成、文書要約、記事作成                                                       │ │
│ │ 3. 構造化データ抽出: JSON形式でのデータ生成                                                             │ │
│ │ 4. ツール呼び出し・エージェント: 外部システムとの連携                                                   │ │
│ │ 5. ジェネレーティブUI: AIによる動的UI生成                                                               │ │
│ │ 6. 画像生成・音声処理: マルチモーダル対応                                                               │ │
│ │                                                                                                         │ │
│ │ アーキテクチャ                                                                                          │ │
│ │                                                                                                         │ │
│ │ 3層構造で設計:                                                                                          │ │
│ │ 1. アプリケーション層(Next.js、React等)                                                               │ │
│ │ 2. UI統合層(フレームワーク別フック)                                                                   │ │
│ │ 3. コアSDK層(統一API)                                                                                 │ │
│ │ 4. プロバイダー抽象化層(各AIプロバイダーの差異を吸収)                                                 │ │
│ │                                                                                                         │ │
│ │ このSDKは、様々なAIプロバイダーの独自APIを標準化し、ボイラープレートコードを削減することで、AI機能の実  │ │
│ │ 装を大幅に簡素化します。                                                                                │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                             │
│ Would you like to proceed?                                                                                  │
│                                                                                                             │
│ ❯ 1. Yes                                                                                                    │
│   2. No, keep planning                                                                                      │
│                                                                                                             │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

設定削除は以下のコマンドで実行可能です。

claude mcp remove deepwiki

リモートMCPサーバー+Authorizationと接続

GitHubのリモートMCPサーバーを試す(失敗)

Claude Codeの公式ドキュメントににGitHubのリモートMCPサーバーとの接続方法が紹介されているので試してみます。
https://docs.anthropic.com/en/docs/claude-code/mcp#authenticate-with-remote-mcp-servers

claude mcp add --transport sse github-server https://api.github.com/mcp
実行結果
Added SSE MCP server github-server with URL: https://api.github.com/mcp to local config

同様に/mcpを実行したところ失敗していそうです。

❯ claude
╭─────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                                   │
│                                                             │
│   /help for help, /status for your current setup            │
│                                                             │
│   cwd: /Users/shuntaka/repos/github.com/shuntaka9576/gh-p2  │
╰─────────────────────────────────────────────────────────────╯

 Tips for getting started:

 1. Run /init to create a CLAUDE.md file with instructions for Claude
 2. Use Claude to help with file analysis, editing, bash commands and git
 3. Be as specific as you would with another engineer for the best results

 ※ Tip: Did you know you can drag and drop image files into your terminal?
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Manage MCP servers                                                                                          │
│                                                                                                             │
│ ❯ 1. github-server  ✘ failed · Enter to view details                                                        │
│                                                                                                             │
│ ※ Tip: Run claude --debug to see logs inline, or view log files in                                          │
│   /Users/shuntaka/Library/Caches/claude-cli-nodejs/-Users-shuntaka-repos-github-com-shuntaka9576-gh-p2      │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
   Esc to exit

詳細に進むとDynamic client registrationに失敗したとあります。

❯ claude
╭─────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                                   │
│                                                             │
│   /help for help, /status for your current setup            │
│                                                             │
│   cwd: /Users/shuntaka/repos/github.com/shuntaka9576/gh-p2  │
╰─────────────────────────────────────────────────────────────╯

 Tips for getting started:

 1. Run /init to create a CLAUDE.md file with instructions for Claude
 2. Use Claude to help with file analysis, editing, bash commands and git
 3. Be as specific as you would with another engineer for the best results

 ※ Tip: Did you know you can drag and drop image files into your terminal?
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Github-server MCP Server                                                                                    │
│                                                                                                             │
│ Status: ✘ failed                                                                                            │
│ URL: https://api.github.com/mcp                                                                             │
│                                                                                                             │
│ Error: Dynamic client registration failed: HTTP 404                                                         │
│                                                                                                             │
│ ❯ 1. Back                                                                                                   │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
   Esc to go back

MCPのAuthorizationの仕様には、OAuth 2.0 Dynamic Client Registration Protocolに準拠する必要があります。こちらが関連していそうです。

https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization

MCP auth implementations SHOULD support the OAuth 2.0 Dynamic Client Registration Protocol (RFC7591).

Claude(Web)のIntegrations機能でも似たissueを発見しました。
https://github.com/github/github-mcp-server/issues/549

また似た問題として、公開されたリモートMCPサーバー接続時にも本エラーを見たので、意図しない処理が入っていると考えられます。
╭─────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                                   │
│                                                             │
│   /help for help, /status for your current setup            │
│                                                             │
│   cwd: /Users/shuntaka/repos/github.com/shuntaka9576/gh-p2  │
╰─────────────────────────────────────────────────────────────╯

 ※ Tip: Use /memory to view and manage Claude memory
╭──────────────────────────────────────────────────────────────────────────────────────────╮
│ Ramen-api MCP Server                                                                     │
│                                                                                          │
│ Status: ✘ failed                                                                         │
│ URL: https://ramen-api.dev/mcp                                                           │
│                                                                                          │
│ Error: Dynamic client registration failed: HTTP 404                                      │
│                                                                                          │
│ ❯ 1. Back                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
   Esc to go back

公式ドキュメント書いてあるので接続確認している気がするので、私の接続方法が悪そうです。。うまく行った方いましたらご教授頂けるとありがたいです。

設定削除は以下のコマンドで実行可能です。

claude mcp remove github-server

workers-oauth-providerを使ったリモートMCPサーバーを試す

こちらのClaudeflareのサンプルを使うことで、認証、認可付きのリモートMCPサーバーを手軽に構築できます。サードパーティ認証としてGitHub OAuth Appsを使います。

https://dev.classmethod.jp/articles/mcp-server-without-local-credentials-cloudflare/#2.-github-oauth-app%25E3%2581%25AE%25E4%25BD%259C%25E6%2588%2590
https://blog.cloudflare.com/remote-model-context-protocol-servers-mcp/

GitHub OAuth AppsはDirect Client Registrationに対応していませんが、こちらのSDKを利用することで、Confused deputy problemをケアしたSDKになっています
https://github.com/cloudflare/workers-oauth-provider

GitHub OAuth Appsを使ったサンプル
https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-github-oauth

構築手順は割愛します。接続します。

claude mcp add --transport sse my-mcp https://my-mcp-server-github-auth-20250619.shuntaka9576.workers.dev/sse
実行結果
Added SSE MCP server my-mcp with URL: https://my-mcp-server-github-auth-20250619.shuntaka9576.workers.dev/sse to local config

/mcpを実行します。まだフローを開始していないので、接続されていない状態です。Enterを押します。

CleanShot 2025-06-19 at 08.52.54@2x

認可の画面でApproveをします。
CleanShot 2025-06-19 at 08.55.01@2x

接続が完了しました。
CleanShot 2025-06-19 at 08.56.33@2x

GitHubの画面でAuthorization Appする画面が出てきませんでしたが、これは既に別のMCPクライアントで認可をしているためと思われます。

/mcpでConnectedの状態になりました。
CleanShot 2025-06-19 at 08.56.53@2x

そのままMCPサーバーを選択するとツールが確認できました。連携できていそうです。
CleanShot 2025-06-19 at 08.59.08@2x
CleanShot 2025-06-19 at 08.59.49@2x
CleanShot 2025-06-19 at 09.00.32@2x

私のGitHubのプロファイルを教えてで聞いてみます。(画像にはありませんがツール実行の許可、不許可の選択が挟まりました)

CleanShot 2025-06-19 at 09.01.33@2x

無事連携されました!

さいごに

Claude CodeでリモートMCPサポートを試しました。Claude Code自体はPCの中で動作するのでローカルMCPで代用はある程度聞きますが、設定の簡易さやセキュアさはメリットが大きいのではないでしょうか。

余談ですが、MCPサーバーは現状.claude.jsonで認証情報と一緒に持っていますが、静的な設定ファイルに持たせて欲しいところですね!

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.