MCP HTTP认证服务器
快速开始
启动服务器
uv run main.py使用MCP检查员进行测试
npx @modelcontextprotocol/inspector http://127.0.0.1:5000/mcp测试终点
# Test MCP endpoint
curl -i http://127.0.0.1:5000/mcp
# Test OAuth protected resource discovery
curl -s http://127.0.0.1:5000/.well-known/oauth-protected-resource | jq
# Test OAuth authorization server discovery
curl -s http://127.0.0.1:5000/.well-known/oauth-authorization-server | jqOAuth测试工作流程
- 运行上述明确方法之一
- 完全关闭光标
- 重新打开光标
- 尝试再次连接到MCP服务器
- 身份验证流程将重新开始
配置
服务器使用以下环境变量(默认值):
MCP_HOST:服务器主机(默认值:“127.0.0.1”)MCP_PORT:服务器端口(默认值:5000)MCP_PATH:MCP端点路径(默认值:“/MCP”)GOOGLE_CLIENT_ID:谷歌OAuth客户端IDGOOGLE_CLIENT_SECRET:谷歌OAuth客户端机密REQUIRED_SCOPES:OAuth作用域(默认值:“openidhttps://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile")
