Claude CodeでリモートMCPがサポートされました
AnthropicからClaude CodeがリモートMCPをサポートしたとの発表がありました
リモートMCPは、MCPサーバーがローカル環境ではなく、クラウドやリモートサーバー上で実行されているMCPサーバーと接続する際の総称です。
以下の図の赤枠がリモートMCPサーバーで、SSEやStreamable HTTPといった接続レイヤーがよく使われています。
リモートMCPがサポートされることによって、以下のようなメリットがあります。
ローカルMCPと比較すると以下になります
- 設定が簡単
- アップデートをしなくて良い
- ローカルMCPの場合、PC内のプログラムを更新する必要があります
また今回Claude Codeのアップデートには、リモートMCPサーバー向けのOAuthサポートも含まれているため、ローカルにクレデンシャルを持たなたくて良いためセキュアと言えます。
試してみる
リモートMCPサーバーと接続
まずはパブリックなリモートMCPサーバーを試します。
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
に設定が書き込まれました)
(中略)
"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が確認できます。
Claude Codeのplanモードでhttps://github.com/vercel/ai このリポジトリの概要を教えてください
で質問してみます。わかり辛いので画像を貼ります。(画像にはありませんがツール実行の許可、不許可の選択が挟まりました)
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サーバーとの接続方法が紹介されているので試してみます。
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
に準拠する必要があります。こちらが関連していそうです。
MCP auth implementations SHOULD support the OAuth 2.0 Dynamic Client Registration Protocol (RFC7591).
Claude(Web)のIntegrations機能でも似たissueを発見しました。
また似た問題として、公開されたリモート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を使います。
GitHub OAuth AppsはDirect Client Registrationに対応していませんが、こちらのSDKを利用することで、Confused deputy problem
をケアしたSDKになっています
GitHub OAuth Appsを使ったサンプル
構築手順は割愛します。接続します。
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を押します。
認可の画面でApproveをします。
接続が完了しました。
GitHubの画面でAuthorization Appする画面が出てきませんでしたが、これは既に別のMCPクライアントで認可をしているためと思われます。
/mcp
でConnectedの状態になりました。
そのままMCPサーバーを選択するとツールが確認できました。連携できていそうです。
私のGitHubのプロファイルを教えて
で聞いてみます。(画像にはありませんがツール実行の許可、不許可の選択が挟まりました)
無事連携されました!
さいごに
Claude CodeでリモートMCPサポートを試しました。Claude Code自体はPCの中で動作するのでローカルMCPで代用はある程度聞きますが、設定の簡易さやセキュアさはメリットが大きいのではないでしょうか。
余談ですが、MCPサーバーは現状.claude.jsonで認証情報と一緒に持っていますが、静的な設定ファイルに持たせて欲しいところですね!