Skip to main content

Module mcp

Module mcp 

Source
Expand description

MCP (Model Context Protocol) integration — JSON-RPC client, tool bridging, lazy loading.

Re-exports§

pub use lease::McpLeaseCapability;
pub use lease::McpRuntimeManager;
pub use lease::McpSessionEndGuard;

Modules§

descriptors
Task 19 (Commit A) — safe local MCP descriptor cache and dormant deferred-tool integration (spec §7.4).
lease
Task 19 (Commit B) — session-scoped exact MCP runtime leases (spec §7.4).

Structs§

McpConfig
MCP config file format: { “mcpServers”: { “name”: { command, args, env } } }
McpConnectTool
A tool that lazily connects to MCP servers on demand. Instead of spawning all servers at startup (burning tokens on 65 tool schemas), this registers ONE tool that the model calls to activate a specific server.
McpServerConfig
MCP server configuration — matches claude-code/gemini-cli format.
McpTool
A dynamic tool backed by an MCP server connection. The connection is shared (Arc<Mutex<>>) across all tools from the same server.

Constants§

MCP_CONFIG_MAX_ARGS
MCP_CONFIG_MAX_ARG_BYTES
MCP_CONFIG_MAX_BYTES
Hard byte bound on mcp.json.
MCP_CONFIG_MAX_COMMAND_BYTES
MCP_CONFIG_MAX_ENV_ENTRIES
MCP_CONFIG_MAX_ENV_KEY_BYTES
MCP_CONFIG_MAX_ENV_VALUE_BYTES
MCP_CONFIG_MAX_SERVERS
Structural bounds on mcp.json (Task 19 review): the 1 MiB byte cap alone leaves server/env counts and string shapes unbounded. Violations fail the WHOLE config closed with a static reason.
MCP_CONFIG_MAX_SERVER_NAME_BYTES

Functions§

connect_mcp_servers
Connect to all configured MCP servers and register their tools. Returns the number of tools registered.
load_mcp_config
Load MCP config from ~/.synaps-cli/mcp.json (or profile variant).
setup_lazy_mcp
Set up MCP loading at engine boot, before any session tool set exists.
validate_mcp_config
Validate config structure before ANY use. Static reasons only — no config content is ever echoed.