MCP Server for AgentStudio - enables A2A (Agent-to-Agent) communication in Cursor CLI and other MCP-compatible environments
npm install agent-studio-mcpAgentStudio 的 MCP Server,为 Cursor CLI 和其他 MCP 兼容环境提供 A2A(Agent-to-Agent)通信能力。
在 AgentStudio 的 Claude Agent SDK 引擎中,A2A Client 作为 in-process MCP server 被直接注入到会话中。但在 Cursor CLI 引擎下,由于 Cursor CLI 是独立进程,无法使用同样的注入方式。
本项目通过创建一个独立的 stdio MCP server 来解决这个问题。它可以一次性注册到 ~/.cursor/mcp.json,为 Cursor Agent 提供调用外部 A2A Agent 的能力。
发现当前 workspace 下可用的外部 A2A Agent(延迟加载,不暴露敏感信息)。
参数:
- workspace (string, required) - 工作区的绝对路径
返回:
- 可用 Agent 的列表(name, url, description, enabled)
- 配置文件路径
调用外部 A2A 兼容 Agent,委派任务或获取信息。
参数:
- agentUrl (string, required) - 目标 A2A Agent URL
- message (string, required) - 发送给外部 Agent 的消息
- workspace (string, required) - 工作区的绝对路径(用于查找配置和 API Key)
- agentName (string, optional) - Agent 名称
- sessionId (string, optional) - 会话 ID(多轮对话)
- useTask (boolean, optional) - 使用异步任务模式
安全设计:
- API Key 仅在 MCP Server 内部使用,永远不会暴露给调用方
- 支持 allowlist 验证
本 MCP Server 复用 AgentStudio 的 A2A 配置文件,查找顺序:
1. {workspace}/.a2a/config.json(直接路径)
2. ~/.cursor/projects/{hash}/.a2a/config.json(Cursor 引擎路径)
3. ~/.claude/projects/{hash}/.a2a/config.json(Claude 引擎路径)
``json`
{
"allowedAgents": [
{
"name": "PPT Editor",
"url": "https://ppt-editor.example.com/a2a/agent-1",
"apiKey": "your-api-key",
"description": "AI 驱动的 PPT 编辑器",
"enabled": true
}
],
"taskTimeout": 300000,
"maxConcurrentTasks": 5
}
`bash`
cd agent-studio-mcp
npm install
npm run build
在 ~/.cursor/mcp.json 中添加:
`json`
{
"mcpServers": {
"agent-studio-mcp": {
"command": "node",
"args": ["/absolute/path/to/agent-studio-mcp/dist/index.js"]
}
}
}
``
1. Agent 收到需要委派的任务
2. 调用 discover_agents(workspace) 发现可用 Agent
3. 选择合适的 Agent
4. 调用 call_external_agent(agentUrl, message, workspace)
5. 获取结果并继续处理
`bash安装依赖
npm install