Enables deployment of the MCP server on Cloudflare Workers, providing a remote environment for hosting MCP tools with OAuth authentication.
Remote MCP 服务器
这是一个基于Cloudflare Worker的MCP (Model Context Protocol) 服务器,用于提供各种工具API,包括Gmail、Google Calendar等功能。该项目使用TypeScript开发,并使用@remote-mcp/server库来简化MCP服务器的实现。
功能特点
- 基于 Cloudflare Workers 的无服务器架构
- 提供Gmail邮件发送和读取功能
- 提供Google Calendar事件创建和列表功能
- 集成OAuth2认证
- 使用Durable Objects进行状态管理
安装
配置
OAuth 配置
- 在 Google Cloud Console 创建一个项目
- 启用 Gmail API 和 Google Calendar API
- 创建 OAuth 客户端ID和密钥
- 修改
src/config.ts
文件中的 OAuth 配置
Cloudflare KV 命名空间配置
对于生产环境,你需要配置KV命名空间来存储OAuth令牌:
- 在Cloudflare Dashboard创建KV命名空间
- 获取KV命名空间ID
- 取消注释
wrangler.jsonc
中的KV配置部分,并添加你的命名空间ID:
构建和部署
本地开发
部署到Cloudflare Workers
项目结构
API端点
/tools
- 获取可用工具列表/api/mcp
- MCP API端点/oauth/gmail
- Gmail OAuth认证/oauth/gmail/callback
- Gmail OAuth回调
故障排除
常见问题
- 部署错误 - KV命名空间无效: 确保在
wrangler.jsonc
中配置了正确的KV命名空间ID,或者暂时注释掉KV配置部分进行测试部署 - OAuth错误: 检查重定向URI是否正确配置在Google Cloud Console和项目配置中
- 编译错误: 确保TypeScript配置中
noEmit
设置为false
,允许生成JavaScript文件
日志和调试
使用Cloudflare Workers控制台查看日志和调试信息。
贡献指南
- Fork仓库
- 创建功能分支 (
git checkout -b feature/amazing-feature
) - 提交更改 (
git commit -m 'Add some amazing feature'
) - 推送到分支 (
git push origin feature/amazing-feature
) - 创建Pull Request
许可证
MIT
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.
A server for hosting Model Context Protocol (MCP) tools on Cloudflare Workers with OAuth authentication, allowing Claude AI and other MCP clients to access extended capabilities.
Related MCP Servers
- -securityFlicense-qualityA deployable server that implements the Model Context Protocol (MCP) on Cloudflare Workers, enabling integration of custom tools with AI assistants like Claude without requiring authentication.Last updated -TypeScript
- -securityFlicense-qualityA server implementation for the Model Context Protocol (MCP) that runs on Cloudflare Workers and supports OAuth login, allowing Claude AI to use custom tools through local or remote connections.Last updated -585TypeScript
- -securityFlicense-qualityA server implementation of the Model Context Protocol (MCP) that runs on Cloudflare Workers, allowing AI assistants like Claude to access tools through OAuth authentication.Last updated -TypeScript
- AsecurityFlicenseAqualityA server that enables Model Context Protocol (MCP) functionality on Cloudflare Workers with OAuth login, allowing applications like Claude Desktop to access custom tools through a standardized interface.Last updated -25TypeScript