MCP Integration
TalkOps uses Model Context Protocol (MCP) as the standardized interface between sub-agents and external tools.
Where MCP Fits​
Key Principle: MCP connects sub-agents to TOOLS. A2A connects agents to AGENTS.
A2A vs MCP​
| Aspect | A2A (Agent-to-Agent) | MCP (Sub-Agent-to-Tool) |
|---|---|---|
| Purpose | Agent collaboration | Tool/data access |
| Stateful | Yes (task state) | Stateless (request/response) |
| Used By | Supervisor ↔ Agents | Sub-agents ↔ MCP Servers |
| Discovery | Agent registry | Tool discovery at runtime |
Sub-Agent Lifecycle​
1. INITIALIZATION
└─ Discover MCP servers, cache tool schemas
2. REQUEST (via A2A)
└─ Receive task from parent agent
3. TOOL DISCOVERY
└─ list_tools() → filter by task requirements
4. AUTHORIZATION
└─ Request task-scoped OAuth token
5. TOOL INVOCATION (MCP)
└─ Call tool with ephemeral token
6. RESPONSE (via A2A)
└─ Return results to supervisor
Task-Scoped Tokens​
Sub-agents receive ephemeral tokens that expire after task completion:
| Token Property | Value |
|---|---|
| Scope | Specific tool + operation only |
| Constraints | Limits from task context |
| Expires | Task completion + 30 minutes |
This prevents compromised sub-agents from performing unauthorized operations.
Error Handling​
| Error | Response |
|---|---|
| Tool Not Found | Suggest alternatives, escalate |
| Invalid Args | Show schema, request correction |
| Auth Denied | Request approval via supervisor |
| Connection Failed | Retry with backoff (3 attempts) |
| Rate Limited | Queue, retry after backoff |
Security​
| Control | Implementation |
|---|---|
| Authentication | OAuth 2.0, mTLS per MCP server |
| Authorization | Task-scoped tokens, least privilege |
| Audit | Every tool call logged with context |
| Token Binding | Tokens valid only for specified resource |
Adding MCP Servers​
mcp_servers:
- name: custom-mcp
transport: http
url: https://mcp-custom.internal:8443
auth: oauth2
Steps:
- Implement MCP server interface
- Register with OAuth authorization server
- Configure in sub-agent
- Grant RBAC permissions