使用说明
A2A客户端MCP服务器
充当代理到代理(A2A)协议客户端的MCP服务器,允许LLM通过模型上下文协议(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 build -t a2a-client-mcp-server .
配置Claude桌面:
{
"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(string):要发送给代理的消息taskId(字符串,可选):任务ID(如果未提供则生成)
a2a_get_task
获取任务的当前状态
taskId(string):要检索的任务的ID
a2a_cancel_task
取消正在运行的任务
taskId(string):要取消的任务的ID
a2a_send_task_订阅
发送任务并订阅更新(流媒体)
message(string):要发送给代理的消息taskId(字符串,可选):任务ID(如果未提供则生成)maxUpdates(数字,可选):要接收的最大更新数(默认值:10)
a2a_agent_info
获取有关连接的A2A代理的信息
- 无需参数
资源
服务器提供对两个MCP资源的访问:
a2a://agent-card:有关连接的A2A代理的信息a2a://tasks:最近A2A任务列表
示例用法
此示例显示了如何使用A2A客户端MCP服务器与编码器代理进行交互:
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
许可证
麻省理工学院
