Skip to content

Protocol Coverage

Heartbit implements three protocols for tool connectivity, agent interoperability, and secure delegation.

ProtocolVersionCoverage
MCP (Model Context Protocol)2025-11-25Tools only (tools/list + tools/call over Streamable HTTP and stdio)
A2A (Agent-to-Agent)0.2.xAgent card + 8-state task lifecycle
RFC 8693stableToken exchange for MCP on-behalf-of

Heartbit includes an MCP client that connects to external tool servers. The protocol version is 2025-11-25.

OperationDescription
tools/listDiscover available tools from an MCP server
tools/callExecute a tool on an MCP server

Two transports are supported:

  • Streamable HTTP — Connect to MCP servers over HTTP (the primary transport)
  • stdio — Connect to MCP servers via standard input/output (for local processes)

MCP servers are configured per-agent in TOML:

[[agents]]
name = "researcher"
mcp_servers = ["http://localhost:8000/mcp"]
# With authentication
# mcp_servers = [{ url = "http://localhost:8000/mcp", auth_header = "Bearer tok_xxx" }]

Or via environment variable:

Terminal window
export HEARTBIT_MCP_SERVERS="http://localhost:8000/mcp,http://localhost:8001/mcp"

Heartbit implements tools-only MCP. Resources, prompts, and other MCP capabilities are not currently supported. The client sends clientInfo.version matching the crate version.

Heartbit supports the A2A protocol version 0.2.x for inter-agent communication. Requires the a2a feature flag.

The daemon exposes an A2A agent card at /.well-known/agent.json describing the agent’s capabilities, supported content types, and task lifecycle.

A2A tasks follow an 8-state lifecycle:

StateDescription
submittedTask received and queued
workingAgent is actively processing (serde alias: working)
input-requiredAgent needs additional input from the caller
auth-requiredAuthentication or authorization needed
completedTask finished successfully
failedTask failed with an error
canceledTask was canceled (serde alias: canceled)
rejectedTask was rejected by the agent

A2A agents are configured via environment variable:

Terminal window
export HEARTBIT_A2A_AGENTS="http://agent1.example.com,http://agent2.example.com"

Heartbit implements RFC 8693 OAuth 2.0 Token Exchange for secure delegation when MCP servers need to act on behalf of the authenticated user.

  1. The daemon receives a request authenticated with a JWT (via [daemon.auth] JWKS configuration)
  2. When calling an MCP server that requires user context, Heartbit exchanges the original token for a new scoped token
  3. The exchanged token is passed to the MCP server via the authentication header
  4. The MCP server can verify the token and act on behalf of the original user

This enables multi-tenant scenarios where:

  • Users authenticate to the Heartbit daemon via JWT
  • MCP tool servers need to know which user is making the request
  • Token exchange provides scoped, auditable delegation without sharing the original credential

The token exchange follows the standard RFC 8693 flow with urn:ietf:params:oauth:grant-type:token-exchange grant type.