mcp-rust-server
High-performance Model Context Protocol (MCP) server for code analysis, security scanning, and project insights—written in Rust 🦀.
Table of Contents
Features
- Fast & Scalable: Built with async Rust on the Tokio runtime
- Multi-Protocol: Supports both stdio and SSE (Server-Sent Events) transports
- Security Scanning: Static analysis and vulnerability detection
- Extensible: Easily add new MCP handlers and custom tools
- Production-Ready: Optimized release profile, structured logging, and CI integration
Installation
mcp-rust-server is published on crates.io. You need a recent Rust toolchain (1.70+ recommended).
CLI Binaries
This installs two binaries into your Cargo bin
directory (usually ~/.cargo/bin
):
mcp-stdio
— stdin/stdout-based MCP servermcp-sse
— HTTP/SSE-based MCP server
Library
Add to your project’s Cargo.toml
:
[]
= "0.1.0"
Usage
CLI Binaries
# Run the stdio-based server
# Run the SSE-based server
By default, both servers will:
- Read framed MCP requests (JSON-RPC) from the chosen transport
- Dispatch to your registered handlers
- Write framed MCP responses
Library
use ;
async
start_stdio()
initializes logging, registers tools, and listens on stdin/stdout.start_sse()
spins up an HTTP server athttp://0.0.0.0:8000/mcp
and streams MCP responses.
Examples
See the [examples/
] directory for full end-to-end demos:
examples/stdio_client.rs
— launchmcp-stdio
and send sample requestsexamples/sse_client.html
— web page that connects tomcp-sse
and renders events
Documentation
Full API documentation is generated on docs.rs:
Or browse online: https://docs.rs/mcp-rust-server
Contributing
Contributions are welcome! Please:
- Fork the repo
- Create a feature branch (
git checkout -b feat/your-feature
) - Commit your changes (
git commit -m "Add feature"
) - Push to your fork (
git push origin feat/your-feature
) - Open a pull request
Run tests and lint before submitting:
License
Licensed under the MIT License. See [LICENSE] for details.
Acknowledgments
- Built on top of the rust-mcp-sdk
- Inspired by the Syncable CLI MCP Server
- Thanks to the Rust community and all contributors