MCP代理服务器
一个MCP服务器,它使大型语言模型能够与兼容Agent-to-Agent (A2A)协议的代理进行交互,实现发送消息、跟踪任务和接收流式响应的功能。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"a2a-client": {
"args": [
"-y",
"a2a-client-mcp-server"
],
"command": "npx",
"env": {
"A2A_ENDPOINT_URL": "http://localhost:41241"
}
}
}
}
服务介绍
A2A 客户端 MCP 服务器
一个作为 Agent-to-Agent (A2A) 协议客户端的 MCP 服务器,允许 LLMs 通过 Model Context Protocol (MCP) 与 A2A 代理进行交互。
特性
- 连接到任何 A2A 兼容的代理
- 发送和接收消息
- 跟踪和管理任务
- 支持流式响应
- 查询代理功能和元数据
安装
# Install globally
npm install -g a2a-client-mcp-server
# Or run directly with npx
npx a2a-client-mcp-server
配置
环境变量
A2A_ENDPOINT_URL: 要连接的 A2A 代理的 URL(默认: "http://localhost:41241")
与 Claude Desktop 一起使用
将以下内容添加到你的 claude_desktop_config.json 文件中:
NPX
npm run build
npm link
{
"mcpServers": {
"a2a-client": {
"command": "npx",
"args": ["-y", "a2a-client-mcp-server"],
"env": {
"A2A_ENDPOINT_URL": "http://localhost:41241"
}
}
}
}
Docker
构建 Docker 镜像:
docker build -t a2a-client-mcp-server .
配置 Claude Desktop:
{
"mcpServers": {
"a2a-client": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"A2A_ENDPOINT_URL",
"a2a-client-mcp-server"
],
"env": {
"A2A_ENDPOINT_URL": "http://localhost:41241"
}
}
}
}
可用工具
a2a_send_task
向 A2A 代理发送任务
message(字符串): 发送给代理的消息taskId(字符串, 可选): 任务 ID(如果未提供则生成)
a2a_get_task
获取任务的当前状态
taskId(字符串): 要检索的任务 ID
a2a_cancel_task
取消正在运行的任务
taskId(字符串): 要取消的任务 ID
a2a_send_task_subscribe
发送任务并订阅更新(流式)
message(字符串): 发送给代理的消息taskId(字符串, 可选): 任务 ID(如果未提供则生成)maxUpdates(数字, 可选): 接收的最大更新次数(默认: 10)
a2a_agent_info
获取已连接 A2A 代理的信息
- 不需要参数
资源
该服务器提供了对两个 MCP 资源的访问:
a2a://agent-card: 关于已连接 A2A 代理的信息a2a://tasks: 最近 A2A 任务列表
示例用法
此示例展示了如何使用 A2A 客户端 MCP 服务器与 Coder 代理进行交互:
First, let me explore what A2A agent we're connected to.
I'll use the a2a_agent_info tool to check the agent details.
The agent provides a coding service that can generate files based on natural language instructions. Let's create a simple Python script.
I'll use the a2a_send_task tool to send a request:
Task: "Create a Python function that calculates the Fibonacci sequence"
Now I can check the task status using a2a_get_task with the task ID from the previous response.
The agent has created the requested Python code. I can now retrieve and use this code in my project.
开发
# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run watch
许可证
MIT