Skip to main content

Crate brainos_mcphost

Crate brainos_mcphost 

Source
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 MCPHost decorator.
rmcp_host
MCPHost implementation backed by the rmcp Rust SDK.
types
Public types for the MCP host: server configs, tool descriptors, and outcomes.

Structs§

InMemoryMcpHost
In-memory MCPHost with 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::Stdio to keep env maps deterministic.
stdio_cfg
Helper for callers building stdio configs from path+args.