OAuth MCP服务器

一个符合OAuth标准的MCP服务器,用于与Claude Web的“连接”按钮配合使用,实现连接状态显示。

  • by dgmulei
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 dgmulei/oauth-mcp-server

使用说明

OAuth MCP服务器

一个符合OAuth标准的MCP(模型上下文协议)服务器,旨在与Claude Web的“连接”按钮配合使用。

目标

让Claude Web通过“连接”按钮连接,并显示“已连接”状态。

建筑

  • 平台:Cloudflare员工
  • 运输:服务器发送事件(SSE)
  • 认证OAuth 2.0 与 PKCE
  • 协议:MCP(模型上下文协议)

项目结构

oauth-mcp-server/
├── src/
│   ├── index.ts           # Main worker entry point
│   ├── oauth/             # OAuth implementation
│   │   ├── endpoints.ts   # OAuth endpoints (/authorize, /token, etc.)
│   │   └── utils.ts       # JWT utilities, crypto functions
│   ├── mcp/               # MCP protocol implementation
│   │   ├── protocol.ts    # MCP message handling
│   │   ├── tools.ts       # Minimal tools (echo, ping)
│   │   └── transport.ts   # SSE transport layer
│   └── types.ts           # TypeScript type definitions
├── wrangler.toml          # Cloudflare Workers configuration
├── package.json           # Dependencies and scripts
├── tsconfig.json          # TypeScript configuration
└── deployment.md          # Deployment instructions for Windsurf

开发设置

  1. 安装依赖项:

    npm install
    
  2. 设置Cloudflare环境:

    npx wrangler login
    
  3. 设置秘密:

    npx wrangler secret put JWT_SECRET
    
  4. 在本地运行:

    npm run dev
    
  5. 部署:

    npm run deploy
    

使用Claude Web进行测试

  1. 部署worker以获取您的URL
  2. 在Claude Web中,单击“连接”
  3. 使用您的工作URL作为服务器端点
  4. 完整的OAuth流程
  5. 验证是否显示“已连接”状态

Windsurf的下一步

看 deployment.md 了解详细的部署和测试说明。