😺

MCP Inspector使用時のProxy Authentication Requiredエラー

に公開

先日MCP Inspector v0.14.2を使用していたところ以下のようなエラーが出て接続できなかった。

mcpのIP自体やネットワークの設定は問題なく、サーバーにも直接アクセスできる。
何が原因かわからず少し手間取ったのでメモを残しておく。
エラーメッセージを見ると

Proxy Authentication Required
Please enter the session token from the proxy server console in the Configuration settings.

とある。
調べてみると2日前にこんなものが出ていた。
https://github.com/modelcontextprotocol/inspector/security/advisories/GHSA-7f8r-222p-6f5g

クライアントとプロキシ間の認証が不十分という脆弱性の報告。
v0.14.1から認証機能が追加されたらしい。

確かによくみると起動時にトークンが発行されていた。

❯ npx @modelcontextprotocol/inspector
Starting MCP inspector...
⚙️ Proxy server listening on 127.0.0.1:6277
🔑 Session token: a52ad29551933ace8e81063ff16f25db6dbb9eb6d818f399d2b1ffeab72bc4
Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth

🔗 Open inspector with token pre-filled:
   http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=a52ad29551933ace8e81063ff16f25db6dbb9eb6d818f399d2b1ffeab72bc4cb
   (Auto-open is disabled when authentication is enabled)

🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀

ちゃんとやる場合は

http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=a4ce289568baa5fb2ffa0cc1f17c09a0821ea75f83537a00de396c2ffad374

でアクセスできる。今回はめんどくさかったのでDANGEROUSLY_OMIT_AUTH=trueオプションをつけて認証を一時的に回避する

DANGEROUSLY_OMIT_AUTH=true npx @modelcontextprotocol/inspector

Starting MCP inspector...
⚙️ Proxy server listening on 127.0.0.1:6277
⚠️  WARNING: Authentication is disabled. This is not recommended.
🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀

普通に接続できた。
終了。

Discussion