-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
enhancementNew feature or requestNew feature or request
Description
功能描述
实现 MCP 服务的自动发现和注册功能,允许服务主动向支持 MCP 的 Agent 平台(如 ChatGPT、Claude、Cursor 等)注册自己。
背景
目前用户需要手动复制 MCP 服务的 URL 到各个平台进行注册。本功能旨在简化这一流程,实现"一次部署,多处注册"。
使用场景
from lc2mcp_server import MCPServer
from lc2mcp_server.registry import PlatformRegistry
server = MCPServer()
# 配置要注册的平台
registry = PlatformRegistry(server)
registry.register_to("chatgpt",
client_id="your-client-id",
webhook_url="https://your-domain.com/mcp"
)
registry.register_to("cursor",
api_key="your-cursor-api-key"
)
# 或通过配置文件
# config.yaml:
# platforms:
# chatgpt:
# enabled: true
# client_id: "xxx"
# cursor:
# enabled: true
# api_key: "xxx"支持的平台
| 平台 | 注册方式 | 状态 |
|---|---|---|
| ChatGPT | OAuth Dynamic Registration | 🔴 待实现 |
| Claude (Anthropic) | API Key + Manifest | 🔴 待实现 |
| Cursor | Local Config + API | 🔴 待实现 |
| Windsurf | API Registration | 🔴 待实现 |
| Continue.dev | Local Config | 🔴 待实现 |
| Manus | WebSocket + API | 🔴 待实现 |
核心功能
1. 平台适配器
class PlatformAdapter(ABC):
@abstractmethod
async def register(self, server_info: ServerInfo) -> RegistrationResult:
"""注册服务到平台"""
@abstractmethod
async def unregister(self) -> bool:
"""取消注册"""
@abstractmethod
async def health_check(self) -> bool:
"""检查注册状态"""2. 自动重连
- 服务重启后自动重新注册
- 定期心跳保持连接活跃
- 注册失败自动重试
3. 状态管理
- 记录每个平台的注册状态
- 提供 API 查询注册情况
- 支持 Webhook 通知注册状态变更
实现建议
- 研究各平台的 MCP 注册协议
- 抽象统一的注册接口
- 实现各平台的具体适配器
- 添加注册状态持久化
- 实现自动重连机制
任务清单
- 调研 ChatGPT MCP 注册协议
- 调研 Claude MCP 注册协议
- 调研 Cursor MCP 注册协议
- 设计统一的平台适配器接口
- 实现 ChatGPT 适配器
- 实现 Claude 适配器
- 实现 Cursor 适配器
- 添加自动重连机制
- 添加注册状态 API
- 编写文档
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request