Expand description
§Brain MCP Host
Host-side integration for external Model Context Protocol servers.
The sibling brainos-mcp crate is a server (Brain exposes its own
tools); this crate is the host side — Brain mounts and routes
through other people’s tool servers.
Supported transports (per MCP spec 2025-11-25):
- stdio — child process speaking JSON-RPC on stdin/stdout
- Streamable HTTP — current spec transport
- HTTP+SSE — legacy transport, still spec-required for compatibility
This crate currently provides the trait surfaces (MCPHost,
MCPClient), the ServerConfig / OAuthConfig / ToolDescriptor
/ CallOutcome types, the McpHostError taxonomy, and an
InMemoryMcpHost no-transport stub so downstream wiring can be built
against the trait before transports are implemented.
Re-exports§
pub use aud_check::validate_token_aud;pub use aud_check::AudCheckOutcome;pub use capability_index::InMemoryToolCapabilityIndex;pub use capability_index::ToolCapabilityIndex;pub use error::McpHostError;pub use oauth::manager_from_vault;pub use oauth::VaultCredentialStore;pub use resilient::ResilienceConfig;pub use resilient::ResilientMcpHost;pub use rmcp_host::RmcpHost;pub use types::CallOutcome;pub use types::MountedServer;pub use types::OAuthConfig;pub use types::ServerConfig;pub use types::ServerInfo;pub use types::ServerStatus;pub use types::ToolDescriptor;
Modules§
- aud_
check - OAuth access-token audience-claim (
aud) validation. - capability_
index - Per-host index of tools published by mounted MCP servers.
- error
- MCP host error taxonomy.
- oauth
- OAuth 2.1 + PKCE for HTTP MCP transports.
- resilient
- Resilience-layered
MCPHostdecorator. - rmcp_
host MCPHostimplementation backed by thermcpRust SDK.- types
- Public types for the MCP host: server configs, tool descriptors, and outcomes.
Structs§
- InMemory
McpHost - In-memory
MCPHostwith no transport — records mounts so downstream wiring (Signal, Thalamus intents, tests) can be built against the trait before the real stdio / HTTP clients are wired in.
Constants§
- MCP_
PROTOCOL_ VERSION - MCP protocol version Brain negotiates against. Per spec 2025-11-25.
Traits§
- MCPClient
- A single transport-bound MCP client (one per mounted server).
- MCPHost
- The host: manages the lifecycle of mounted servers and routes tool calls.
Functions§
- empty_
env - Helper used by
ServerConfig::Stdioto keep env maps deterministic. - stdio_
cfg - Helper for callers building stdio configs from path+args.