Overview
Handler provides an MCP (Model Context Protocol) server that exposes A2A protocol capabilities as tools for AI assistants. This enables assistants like Claude Desktop, Cursor, and other MCP clients to interact with A2A agents. The MCP server acts as a bridge: your AI assistant calls MCP tools, and Handler translates those into A2A protocol operations.Architecture
Starting the MCP Server
- Default (stdio)
- SSE Transport
- Python
Start the MCP server with stdio transport (for CLI integration):This starts the server and waits for MCP client connections via standard input/output.
mcp/server.py:529-541:
Configuring Claude Desktop
Add Handler to your Claude Desktop configuration:Locate config file
Open Claude Desktop’s configuration file:macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows: %APPDATA%\Claude\claude_desktop_config.jsonLinux: ~/.config/Claude/claude_desktop_config.jsonAvailable MCP Tools
Handler exposes the following tools:Card Tools
validate_agent_card
validate_agent_card
Validate an A2A agent card from a URL or local file.Parameters:Implementation in
source(string): URL or file path to agent cardfrom_file(boolean): Treat source as file path if true
mcp/server.py:63-128.get_agent_card
get_agent_card
Retrieve an agent’s full card with all details.Parameters:
agent_url(string): Base URL of the A2A agent
mcp/server.py:130-150
Message Tools
send_message
send_message
Send a message to an A2A agent and receive a response.Parameters:Example usage from Claude:Implementation in
agent_url(string, required): Agent base URLmessage(string, required): Text message to sendcontext_id(string, optional): Context ID for continuitytask_id(string, optional): Task ID to continueuse_session(boolean): Use saved session contextbearer_token(string, optional): Bearer token for authapi_key(string, optional): API key for auth
mcp/server.py:152-213.Task Tools
get_task
get_task
Get the current status and details of a task.Parameters:
agent_url(string): Agent base URLtask_id(string): Task ID to retrievehistory_length(integer, optional): Number of history messagesbearer_token(string, optional): Bearer tokenapi_key(string, optional): API key
cancel_task
cancel_task
Cancel a running task.Parameters:
agent_url(string): Agent base URLtask_id(string): Task ID to cancelbearer_token(string, optional): Bearer tokenapi_key(string, optional): API key
set_task_notification
set_task_notification
Configure push notifications for a task.Parameters:
agent_url(string): Agent base URLtask_id(string): Task IDwebhook_url(string): Webhook URL to receive notificationswebhook_token(string, optional): Webhook auth tokenbearer_token(string, optional): Bearer tokenapi_key(string, optional): API key
get_task_notification
get_task_notification
Get push notification configuration for a task.Parameters:
agent_url(string): Agent base URLtask_id(string): Task IDconfig_id(string, optional): Specific config IDbearer_token(string, optional): Bearer tokenapi_key(string, optional): API key
Session Tools
list_sessions
list_sessions
List all saved sessions.Returns:Implementation in
mcp/server.py:389-419:get_session_info
get_session_info
Get session information for a specific agent.Parameters:
agent_url(string): Agent base URL
clear_session_data
clear_session_data
Clear saved session data.Parameters:
agent_url(string, optional): Agent URL to clear, or null for all
clear_agent_credentials for that.Auth Tools
set_agent_credentials
set_agent_credentials
Set authentication credentials for an agent.Parameters:Credentials are saved to
agent_url(string): Agent base URLbearer_token(string, optional): Bearer tokenapi_key(string, optional): API key
~/.handler/sessions.json.Implementation in mcp/server.py:472-504:clear_agent_credentials
clear_agent_credentials
Clear saved credentials for an agent.Parameters:
agent_url(string): Agent base URL
Session Management
The MCP server automatically manages sessions:mcp/server.py:188-204
Example Workflows
- Basic Interaction
- With Authentication
- Validating Cards
Using Claude Desktop with Handler MCP:User: “Connect to my local agent at http://localhost:8000 and ask what it can do”Claude: [Calls Result:User: “Now ask it about the weather in Seattle”Claude: [Calls
send_message tool]send_message with saved context]MCP Server Configuration
The MCP server is created with metadata:mcp/server.py:51-61
Configuring Other MCP Clients
- Cursor
- Custom Client
Add to Cursor’s MCP settings:
Credential Resolution
The MCP server resolves credentials in this priority order:- Explicit
bearer_tokenorapi_keyparameters - Saved credentials from sessions
- No credentials (if neither provided)
mcp/server.py:38-48
Troubleshooting
MCP server not appearing in Claude
MCP server not appearing in Claude
-
Check Handler is installed and in PATH:
-
Verify config file path:
-
Check Claude Desktop logs:
- macOS:
~/Library/Logs/Claude/ - Look for MCP connection errors
- macOS:
-
Test MCP server manually:
Tools not working
Tools not working
-
Verify agent is accessible:
-
Check session file permissions:
-
Test with CLI first:
Authentication failures
Authentication failures
-
Verify credentials are saved:
-
Test credentials directly:
-
Clear and reset credentials:
Best Practices
Use Sessions
Enable
use_session: true for conversation continuity across tool calls.Validate First
Call
validate_agent_card before sending messages to check agent capabilities.Save Credentials
Use
set_agent_credentials instead of passing tokens in every call.Check Task State
Use
get_task to poll long-running tasks until completion.