A Rust SDK for building high-performance, asynchronous servers and clients that implement the Model Context Protocol (MCP). MCP is designed for scalable, concurrent, and extensible model-serving infrastructure, supporting tools, resources, and prompt management.
This SDK leverages Rust's async ecosystem (tokio, reqwest, etc.) to provide non-blocking, highly concurrent server implementation. The MCP server can handle hundreds of simultaneous client connections, making it ideal for real-time model serving and interactive applications.
- Async Server: MCP servers are built using async Rust, allowing efficient handling of requests without blocking threads.
- Multi-threaded Execution: Example servers use multi-threaded async runtimes for maximum throughput.
- Concurrent Clients: Simulation tests demonstrate the server's ability to manage hundreds of concurrent clients performing protocol actions.
- Rust (latest stable recommended)
- Cargo
Clone the repository:
git clone https://github.com/Ketankhunti/Rust-MCP.git
cd Rust-MCPBuild the project:
cargo build --releaseStart the example async server:
cargo run --example http_macro_tool_serverThe server starts on 127.0.0.1:8080 and uses an async runtime to handle requests efficiently.
To test the server under heavy concurrent load:
cargo run --example http_all_test_load_simulationThis launches 400 async clients, each simulating a full MCP session for 30 seconds. The test showcases the server’s ability to process many requests in parallel.
For a simple async client simulation:
cargo run --example single_client_load_testexamples/http_macro_tool_server.rs: Asynchronous MCP server with macro-based resource and tool registration.examples/http_all_test_load_simulation.rs: Async load test simulating many MCP clients.examples/single_client_load_test.rs: Simple async single-client simulation.
src/: Main SDK source codeexamples/: Example servers and simulation testsmcp_macros/: Macro definitions for resources and tools
Pull requests and issues are welcome!
MIT