Content
# A2A MCP Server
Expose the A2A (Agent-to-Agent) protocol as MCP tools, allowing Goose to invoke remote A2A agents through the External Subagent mechanism.
## Features
- `a2a_discover` - Discover and register remote A2A agents
- `a2a_list_agents` - List all discovered agents
- `a2a_send` - Send a message to an agent and wait for the result (supporting polling)
- `a2a_get_task` - Query the status of a task
- `a2a_cancel_task` - Cancel a running task
- `a2a_list_tasks` - List tasks on an agent
## Environment Variables
| Variable | Description | Default Value |
|------|------|--------|
| `A2A_GATEWAY_URL` | A2A Gateway URL (e.g., LiteLLM) | `http://localhost:4000` |
| `A2A_API_KEY` | Authentication API Key | Empty |
| `A2A_TIMEOUT` | HTTP request timeout (milliseconds) | `30000` |
## Installation
```bash
cd a2a-mcp-server
npm install
npm run build
```
## Configuring Goose External Subagent
Add the following to `~/.config/goose/config.yaml`:
```yaml
extensions:
a2a-mcp-server:
type: stdio
cmd: node
args:
- /path/to/a2a-mcp-server/dist/server.js
env:
A2A_GATEWAY_URL: "http://localhost:4000"
A2A_API_KEY: "your-api-key"
timeout: 300
bundled: false
enabled: true
```
Alternatively, use an absolute path wrapper script:
```bash
#!/bin/bash
# /usr/local/bin/a2a-mcp-server
export A2A_GATEWAY_URL="http://localhost:4000"
export A2A_API_KEY="your-api-key"
exec node /path/to/a2a-mcp-server/dist/server.js
```
Then configure:
```yaml
extensions:
a2a-mcp-server:
type: stdio
cmd: /usr/local/bin/a2a-mcp-server
timeout: 300
bundled: false
enabled: true
```
## Usage Examples
### 1. Discover Agent
```
Use a2a_discover to discover the agent at http://localhost:10001
```
### 2. Send a Message
```
Use a2a_send to send a message to my-agent: "Help me analyze the performance issues of this code"
```
### 3. Query Task
```
Use a2a_get_task to query the status of task task-12345
```
### 4. List All Agents
```
Use a2a_list_agents to see available agents
```
## Architecture
```
Goose Main Agent (GUI)
│
├── LLM: Claude/GPT/etc.
│
├── External Subagent: a2a-mcp-server (stdio MCP)
│ │
│ └── A2A Client
│ │
│ └── HTTP/JSON-RPC (A2A Protocol)
│ │
│ ▼
│ LiteLLM Gateway
│ │
│ ┌───────┼───────┐
│ ▼ ▼ ▼
│ Agent1 Agent2 Agent3
│
└── Other extensions...
```
## Integration with LiteLLM
If using LiteLLM as the A2A Gateway:
```bash
# Start LiteLLM
litellm --config config.yaml
# Configure A2A MCP Server
export A2A_GATEWAY_URL="http://localhost:4000"
export A2A_API_KEY="sk-xxx"
```
LiteLLM will automatically proxy A2A requests to upstream agents and provide:
- Authentication management
- Request logging
- Spend tracking
- Load balancing
## Development
```bash
# Development mode
npm run dev
# Build
npm run build
# Run
npm start
```
## License
MIT