Skip to main content

lash_plugin_mcp/
lib.rs

1//! MCP (Model Context Protocol) integration for `lash`, packaged as a plugin.
2//!
3//! `lash-plugin-mcp` exposes MCP-compatible servers as a normal lash tool
4//! provider. Add the plugin once at [`LashCore::builder`] time, supply a
5//! `BTreeMap<String, McpServerConfig>`, and every session built from the
6//! core gets the configured servers' tools surfaced under
7//! `mcp__<server>__<tool>` names.
8//!
9//! Supported transports (selected per server via the `transport` field):
10//! - `stdio` — spawn a child process and speak JSON-RPC over its pipes.
11//! - `streamable_http` — HTTP/JSON streaming transport (newer MCP spec).
12//! - `sse` — older HTTP+SSE transport.
13//!
14//! Implementation note: the wire-level client is provided by the official
15//! [`rmcp`] SDK. The plugin owns a single connection pool (`McpConnectionPool`)
16//! that is shared across every session built from the same `LashCore`, so
17//! e.g. stdio servers are spawned once per process rather than per session.
18
19pub mod config;
20pub mod error;
21pub mod naming;
22pub mod plugin;
23pub mod pool;
24
25pub use config::McpServerConfig;
26pub use error::McpError;
27pub use plugin::{McpPluginFactory, McpToolProvider};
28pub use pool::McpConnectionPool;