agnt-mcp
Synchronous Model Context Protocol
stdio client for the agnt agent
runtime. Spawns an MCP server as a child process, runs the
2024-11-05 initialize handshake, and bridges every remote tool into
the native agnt_core::Tool trait.
use ;
use Tool;
use ;
#
Design notes
- No async runtime. The stdout reader runs in a dedicated
std::thread, draining JSON-RPC frames into anmpsc::Receiver. Requests time out at 30 seconds (REQUEST_TIMEOUT). - Bounded reader. v0.3.1 caps the inner reader at
MAX_LINE_BYTES(4 MiB) so a hostile or buggy server cannot OOM the agent with a multi-gigabyte line. Overflow surfaces asMcpError::Protocoland closes the stream. - Typed errors.
McpErrorsplits intoIo,Protocol,Timeout, andClosedso callers can tell DoS from protocol bugs from an exited child. - Off by default in the flagship crate.
cargo add agnt --features mcppulls this in; without the feature the flagship stays lean.
See the flagship agnt crate for the
agent runtime this plugs into.
License
Dual-licensed under MIT OR Apache-2.0.