mcp-oauth-dcr
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-oauth-dcrrun the OAuth demo with Inspector"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-oauth-dcr
ローカル MCP サーバを OAuth(DCR)で保護するハンズオン用リポジトリです。
認可サーバ (AS):
node-oidc-provider@http://localhost:4000MCP サーバ (RS):
@modelcontextprotocol/sdk@http://localhost:3000/mcp
デモのセットアップ
1. 依存関係のインストール
npm ci2. サーバを起動(ターミナルを 2 つ使う)
# ターミナル 1: 認可サーバ
npm run auth
# ターミナル 2: MCP サーバ
npm run mcp起動確認:
サービス | URL |
認可サーバ | |
MCP サーバ | |
保護リソースメタデータ (PRM) | http://localhost:3000/.well-known/oauth-protected-resource/mcp |
3. 自動検証(任意)
両方起動した状態で:
npx tsx src/verify.ts401 → メタデータ発見 → DCR → トークン検証 → 接続確立 が成功すれば、サーバ側は問題ありません。
4. MCP Inspector で手動デモ
npx @modelcontextprotocol/inspectorターミナルに表示される トークン付き URL(例: http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=...)をブラウザで開きます。
Inspector の設定:
項目 | 値 |
Transport Type | Streamable HTTP |
URL |
|
Connection Type | Via Proxy(Direct は CORS で失敗しやすい) |
Connect を押すと OAuth フローが始まります。
最初に 401(
Missing Authorization header)が出る → 正常DCR でクライアント登録
ブラウザで
http://localhost:4000のログイン画面が開くSign-in → 任意のユーザー名・パスワード(例:
test/password)Continue(同意)
Inspector に戻り、接続完了
whoami/addツールを呼び出せる
5. よくあるトラブル
invalid_client / client is invalid
認可サーバ(npm run auth)を再起動すると、DCR で登録したクライアント情報は メモリ上から消えます。Inspector の sessionStorage には古い client_id が残っていると、このエラーになります。
対処:
Inspector で Connect をやり直す(新規 DCR)
直らなければブラウザの DevTools → Application → Session Storage →
localhost:6274をクリアしてから再接続
Continue 後に Failed to fetch
トークン交換(POST /token)の CORS 問題です。最新の auth-server.ts では clientBasedCORS を設定済みです。npm run auth が最新コードで動いているか確認してください。
Direct 接続で Failed to fetch
Connection Type は Via Proxy を使ってください。
Related MCP server: MCP Auth
jwks.json について
誰が: 認可サーバ(src/auth-server.ts)
いつ: npm run auth の初回起動時(リポジトリ直下に jwks.json が無い場合)
処理の流れ:
loadOrCreateJwks()がjwks.jsonの有無を確認無ければ
joseで RS256 の鍵ペアを生成し、jwks.jsonに書き込むあれば 既存ファイルを読み込んで使う(再起動しても
kidが変わらない)
用途:
AS が JWT アクセストークンに署名する 秘密鍵(ファイル内に含まれる)
AS が
http://localhost:4000/jwksで公開する 公開鍵MCP サーバ(RS)がその JWKS を取りに行き、Bearer トークンの署名を検証する
verify.ts も同じ jwks.json を読んで、デモ用にトークンを自前署名します(本番フローでは AS が /token で発行します)。
.gitignore に入っているので Git にはコミットしません。削除して npm run auth し直すと新しい鍵が生成されます(その間に発行済みトークンは検証できなくなります)。
構成
src/
├── config.ts 共有設定(ポート、issuer、resource URL)
├── auth-server.ts 認可サーバ :4000
├── mcp-server.ts MCP サーバ(リソースサーバ) :3000
└── verify.ts 自動検証スクリプト
jwks.json AS 署名鍵(初回起動時に自動生成・gitignore)スクリプト
コマンド | 説明 |
| 認可サーバ起動 |
| MCP サーバ起動 |
| TypeScript 型チェック |
| OAuth フロー自動検証 |
ライセンス
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA self-hostable OAuth 2.0 server designed for the Model-Context-Protocol (MCP) that enables you to secure your MCP applications with a robust implementation you control.2,903112ISC
- Alicense-qualityDmaintenanceA remote MCP server implementation that demonstrates authentication and authorization capabilities using OAuth 2.1. This is a workshop project for learning how to build secure MCP servers with user authentication.26,498MIT
- Flicense-qualityCmaintenanceA proof-of-concept MCP server implementing OAuth 2.1 authorization with CIMD client registration and PKCE, demonstrating protected resource access and step-up authentication.
- Flicense-qualityDmaintenanceA simple MCP server with OAuth 2.0 authentication for testing OAuth support in mcp-cli.
Related MCP Connectors
Self-hosted federated MCP gateway: one OAuth 2.1 MCP server in front of N apps, user-level scopes.
MCP server for verifying EUDI/Talao wallet data via OIDC4VP (pull) for AI agents.
MCP server for Argo RPG Platform — connects AI assistants to campaign data via OAuth2
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rc-kazu/mcp-oauth-sample'
If you have feedback or need assistance with the MCP directory API, please join our Discord server