SSE MCP Server with JWT Authentication
🔐 JWT 認証を備えた SSE MCP サーバー
これは、JWT ベースの認証を備えたモデル コンテキスト プロトコル (MCP) SSE サーバーです。
安全なベアラー トークン フローによって保護された SSE トランスポートを介して複数の AI ツールを公開できます。
搭載コンポーネント:
🚀 Node.js + エクスプレス
🧩 @modelcontextprotocol/sdk
🔒 認証のためのJSON Web Token(JWT)
⚙️ 入力検証のための Zod
✅
@modelcontextprotocol/inspectorで完全にテスト済み
📂 プロジェクト構造
server/
├── index.ts # Main Express + MCP server
├── .env # Environment variables
├── package.json # Project metadata & scripts
├── tsconfig.json # TypeScript config
└── README.md # You are here!Related MCP server: MCP Boilerplate
✨ 特徴
✅ Bearer JWT トークンを使用した安全な SSE 接続
✅ 動的ツールの登録(エコー、時間、乱数など)
✅ MCP Inspectorでテスト済み
✅ すべてのリクエストライフサイクルイベントをログに記録します
✅ /message エンドポイントのセッション管理
🚀 本番環境での使用に拡張可能
⚙️ セットアップ
1. リポジトリをクローンする
git clone https://github.com/anisirji/mcp-server-remote-setup-with-jwt-auth.git
cd mcp-server-remote-setup-with-jwt-auth2. 依存関係をインストールする
npm install3. .envファイルを作成する
echo "JWT_SECRET=your-secret-key" > .env4. サーバーを実行する
npm run dev✅ サーバーは以下で実行されます:
http://localhost:3001/sse🧪 MCP Inspector でサーバーをテストする
ステップ1 - MCP Inspectorをインストールする
📖 公式ドキュメント: MCP インスペクター
npx @modelcontextprotocol/inspectorステップ2 — トークンを生成する
cURL を使用して JWT トークンを取得します。
curl "http://localhost:3001/auth/token?username=aniket&scope=mcp:access"✅ 回答例:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}ステップ3 - MCP Inspectorを接続する
インスペクターUIを開く
トランスポートタイプを設定: SSE
URL:
http://localhost:3001/sse認証ヘッダーを追加します:
Authorization: Bearer <your-token>**「接続」**をクリック
🎉 成功しました!サーバーが接続されました。
ステップ4 — テストツール
インスペクタの**「ツール」**タブに移動し、 「リスト ツール」をクリックします。
次のように表示されます。
✅
test✅
echo✅
get-time✅
random-number
ぜひテストして楽しんでください!
📖 APIリファレンス
🔑 トークンを生成する
GET /auth/token?username=<username>&scope=mcp:access🔌 SSEエンドポイント(トークンが必要)
GET /sse
Authorization: Bearer <token>📩 アクティブセッションにメッセージを送信する
POST /message?sessionId=<sessionId>
Authorization: Bearer <token>🧩 ツールリファレンス
ツール名 | 説明 |
| テスト接続(セキュリティチェック) |
| 提供されたメッセージをエコーバックする |
| 現在のサーバー時刻を返します |
| 乱数(最小/最大)を返します |
🗓️ 今後の変更点
[ ] トークン失効リスト(ブラックリスト)
[ ] ロールベースのツールアクセス(スコープチェック)
[ ] セッションハートビート/キープアライブ
[ ] レート制限とログ記録
[ ] デプロイメントのためのDocker化
📚 役立つリソース
👨💻 メンテナー
アニケット
📄 ライセンス
このプロジェクトはオープンソースであり、無料で使用できます。
🚀 構築する。保護する。強化する。
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
- AlicenseNot gradedqualityDmaintenanceA high-performance Model Context Protocol (MCP) server designed for large language models, enabling real-time communication between AI models and applications with support for session management and intelligent tool registration.2MIT
- AlicenseNot gradedqualityDmaintenanceA server that implements the Model Context Protocol, providing a standardized way to connect AI models to different data sources and tools.1011MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server with HTTP transport that implements JWT authentication, allowing secure tool execution and prompt handling with role-based access control.61
- FlicenseNot gradedqualityNot gradedmaintenanceA Model Context Protocol (MCP) server implementation that uses Server-Sent Events (SSE) to enable real-time, server-pushed updates between AI models and tools over HTTP connections.1
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
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/anisirji/mcp-server-remote-setup-with-jwt-auth'
If you have feedback or need assistance with the MCP directory API, please join our Discord server