mcp-sse-rust
mcp-sse-rust is a library implemented in the Rust programming language aimed at providing specific functionalities. This project leverages the characteristics of Rust to achieve efficient code generation and data processing. While it may be somewhat challenging for beginners, it serves as a useful tool for developers familiar with Rust.
GitHub Stars
0
User Rating
Not Rated
Favorites
0
Views
16
Forks
0
Issues
0
๐งฎ MCP SSE Rust Calculator Server
A high-performance Model Context Protocol (MCP) server implemented in Rust that provides calculator functionality through Server-Sent Events (SSE) and JSON-RPC APIs.
โจ Features
- ๐ High Performance: Built with Rust and Axum for maximum performance
- ๐ Real-time Communication: Server-Sent Events (SSE) support
- ๐งฎ Calculator Tools: Addition, multiplication, square, and square root operations
- ๐ก JSON-RPC Protocol: Compliant with MCP 2024-11-05 specification
- ๐ CORS Enabled: Cross-origin resource sharing support
- ๐งช Well Tested: Comprehensive unit tests included
- โก Async/Await: Fully asynchronous implementation with Tokio
๐ ๏ธ Available Tools
| Tool | Description | Parameters |
|---|---|---|
add |
Add two numbers together | a: number, b: number |
multiply |
Multiply two numbers together | a: number, b: number |
square |
Calculate the square of a number | number: number |
sqrt |
Calculate the square root of a number | number: number (non-negative) |
๐ Quick Start
Prerequisites
Installation
Clone the repository
git clone https://github.com/SuyodhanJ6/mcp-sse-rust.git cd mcp-sse-rustInstall dependencies
cargo buildRun the server
cargo run
The server will start on http://localhost:3000 ๐
MCP Integration with Cursor
To use this server with Cursor IDE, add the following to your ~/.cursor/mcp.json:
{
"mcpServers": {
"mcp-calculator-sse": {
"url": "http://127.0.0.1:3000/mcp",
"transport": "sse"
}
}
}
After adding the configuration, restart Cursor to enable the calculator tools.
Development
For development with auto-reload:
cargo install cargo-watch
cargo watch -x run
๐ API Documentation
Endpoints
Health Check
GET /health
Returns server health status.
MCP Endpoint (for Cursor integration)
GET /mcp
Model Context Protocol endpoint with Server-Sent Events for Cursor IDE integration.
JSON-RPC Endpoint
POST /jsonrpc
Content-Type: application/json
Server-Sent Events
GET /sse
Establishes SSE connection for real-time communication.
JSON-RPC Methods
Initialize
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {}
}
List Tools
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}
Call Tool
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "add",
"arguments": {
"a": 5,
"b": 3
}
}
}
๐งช Examples
Using curl
Add two numbers:
curl -X POST http://localhost:3000/jsonrpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "add",
"arguments": {"a": 10, "b": 5}
}
}'
Calculate square root:
curl -X POST http://localhost:3000/jsonrpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "sqrt",
"arguments": {"number": 16}
}
}'
Server-Sent Events
Connect to the SSE endpoint:
curl -N http://localhost:3000/sse
๐งช Testing
Run the test suite:
cargo test
Run tests with output:
cargo test -- --nocapture
๐ Project Structure
mcp-sse-rust/
โโโ src/
โ โโโ main.rs # Main server implementation
โโโ Cargo.toml # Dependencies and project metadata
โโโ Cargo.lock # Dependency lock file
โโโ LICENSE # MIT License
โโโ README.md # This file
โโโ .gitignore # Git ignore patterns
๐ง Configuration
The server runs on port 3000 by default. You can modify this in the main() function in src/main.rs.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Axum - Web application framework
- Tokio - Asynchronous runtime
- Serde - Serialization framework
- Model Context Protocol - Protocol specification
- MCP SSE Rust - Related MCP server implementation
Made with โค๏ธ in Rust by Prashant Malge
0
Followers
0
Repositories
0
Gists
0
Total Contributions
๐ Terraform Model Context Protocol (MCP) Tool - An experimental CLI tool that enables AI assistants to manage and operate Terraform environments. Supports reading Terraform configurations, analyzing plans, applying configurations, and managing state with Claude Desktop integration. โก๏ธ
echokit_server is a high-performance server software built in Rust, offering efficient data processing and API management. Designed for developers, it boasts high scalability and adaptability for various applications. It is particularly well-suited for real-time data processing and microservices architecture.