概览
What is MCP Runner?
MCP Runner is a Rust library for running and interacting with Model Context Protocol (MCP) servers locally. It provides a complete solution for managing MCP server processes, communicating via JSON-RPC, and optionally proxying Server-Sent Events (SSE) to enable client connections.
How to use MCP Runner?
Add mcp-runner = "0.3.1" to your Cargo.toml, then create a McpRunner from a JSON config file, a JSON string, or programmatically. Use start_all_with_proxy() to start servers and the SSE proxy, then get a client with get_client() to list tools or call them.
Key features of MCP Runner
- Start and manage MCP server processes locally
- Configure multiple servers through a unified interface
- Communicate with MCP servers using JSON-RPC
- List and call tools exposed by MCP servers
- Access resources provided by MCP servers
- Proxy Server-Sent Events (SSE) to enable HTTP clients
Use cases of MCP Runner
- Integrate MCP servers into a Rust application
- Manage multiple MCP servers from a single codebase
- Expose MCP servers to web clients via HTTP and SSE
- Automate tool calling across different MCP servers
FAQ from MCP Runner
What is MCP Runner?
MCP Runner is a Rust library that manages the lifecycle of MCP server processes and provides a client API for interacting with them via JSON-RPC.
How do I install MCP Runner?
Add mcp-runner = "0.3.1" to your Cargo.toml dependencies.
How do I configure MCP Runner?
Create a JSON configuration file with mcpServers (each with command and args) and optionally an sseProxy block. Load it via McpRunner::from_config_file("config.json")?.
What is the SSE proxy and how do I use it?
The SSE proxy exposes MCP servers over HTTP, allowing web clients to connect via SSE for real‑time updates. Enable it by adding an sseProxy section to your config; start it with start_all_with_proxy().
How do I handle errors in MCP Runner?
MCP Runner uses a custom Error type covering configuration, server lifecycle, communication, and serialization errors. Match on variants like Error::ServerNotFound or Error::Communication for detailed handling.