🔐 带有 JWT 身份验证的 SSE MCP 服务器
这是一个基于 JWT 身份验证的模型上下文协议 (MCP) SSE 服务器。
它允许您通过 SSE 传输公开多个 AI 工具,并通过安全的 Bearer Token 流进行保护。
内置:
🚀 Node.js + Express
🧩@modelcontextprotocol/sdk
🔒 JSON Web Tokens(JWT)用于身份验证
⚙️ Zod 用于输入验证
✅ 已通过
@modelcontextprotocol/inspector
全面测试
📂 项目结构
✨ 特点
✅ 使用 Bearer JWT 令牌保护 SSE 连接
✅ 动态工具注册(回声、时间、随机数等)
✅ 经过 MCP Inspector 测试
✅ 记录所有请求生命周期事件
✅ /message 端点的会话管理
🚀 准备扩展用于生产用途
⚙️ 设置
1. 克隆存储库
2.安装依赖项
3.创建.env
文件
4.运行服务器
✅ 服务器将运行于:
🧪 使用 MCP Inspector 测试服务器
步骤 1 — 安装 MCP Inspector
📖 官方文档: MCP Inspector
步骤 2 — 生成令牌
使用 cURL 获取您的 JWT 令牌:
✅ 示例响应:
步骤 3 — 连接 MCP Inspector
打开检查器用户界面
设置传输类型: SSE
网址:
http://localhost:3001/sse添加授权标头:
Authorization: Bearer <your-token>单击**“连接”**
🎉 成功!您的服务器现已连接。
步骤 4 — 测试工具
转到检查器中的**“工具”选项卡,然后单击“列出工具”** 。
您将看到:
✅
test
✅
echo
✅
get-time
✅
random-number
测试它们并享受吧!
📖 API 参考
🔑 生成令牌
🔌 SSE 端点(需要令牌)
📩 向活动会话发送消息
🧩 工具参考
工具名称 | 描述 |
| 测试连接(安全检查) |
| 回显提供的消息 |
| 返回当前服务器时间 |
| 返回随机数(最小/最大) |
🗓️ 即将发生的变化
[ ] 令牌撤销列表(黑名单)
[ ] 基于角色的工具访问(范围检查)
[ ] 会话心跳/保持活动
[ ] 速率限制和日志记录
[ ] Docker化部署
📚 有用的资源
👨💻 维护者
阿尼克特
📄 许可证
该项目是开源的,可以免费使用。
🚀 构建。 安全。 赋能。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
模型上下文协议服务器通过基于 JWT 的安全身份验证通过 SSE 传输公开多个 AI 工具,从而实现动态工具注册和会话管理。
Related MCP Servers
- -securityFlicense-qualityA demonstration implementation of the Model Context Protocol server that facilitates communication between AI models and external tools while maintaining context awareness.Last updated -
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -331
- AsecurityFlicenseAqualityA server that enables AI to access external services through the Model Context Protocol, specifically integrating with an authentication system to obtain login tickets.Last updated -1