SolidMCP
A high-level Rust toolkit for building Model Context Protocol (MCP) servers with minimal boilerplate and maximum type safety.
Features
- 🚀 Minimal Boilerplate: Build MCP servers with just a few lines of code
- 🛡️ Type Safety: Compile-time guarantees with automatic JSON schema generation
- 🔌 Dual Transport: Built-in WebSocket and HTTP support
- 📚 Full MCP Support: Tools, Resources, and Prompts with a unified API
- 🏗️ Flexible Architecture: Generic context system for any application state
- 🔔 Notifications: Simple API for sending log messages and updates
- ✅ Battle-tested: Comprehensive test suite covering all MCP features
Quick Start
Add SolidMCP to your Cargo.toml
:
[]
= { = "https://github.com/jupitersoftco/solidmcp.git" }
= "1.0"
= "0.8"
= { = "1.0", = ["derive"] }
= { = "1.0", = ["full"] }
Create a simple MCP server:
use Result;
use JsonSchema;
use ;
use McpServerBuilder;
use Arc;
// Define your application context
// Define input/output schemas with automatic JSON schema generation
async
That's it! Your MCP server is now running with:
- Automatic JSON schema generation and validation
- WebSocket and HTTP endpoints
- Built-in error handling and logging
- Type-safe tool execution
Complete Example
For a comprehensive example demonstrating all MCP features (tools, resources, and prompts), see the toy notes server example. It shows how to build a complete note-taking MCP server with:
- Tools: Create, read, list, and delete notes
- Resources: Expose notes as MCP resources with
note://
URIs - Prompts: Provide templates for meeting notes, daily journals, and tasks
- Persistence: File-based storage with automatic loading
- Notifications: Real-time updates when notes are modified
Run the example:
Then connect with Claude Desktop or any MCP client at ws://localhost:3002/mcp
or http://localhost:3002/mcp
.
MCP Protocol Support
SolidMCP implements core MCP functionality with room for expansion:
✅ Fully Supported
- Protocol Versions:
2025-03-26
and2025-06-18
- Transport: WebSocket and HTTP with session management
- Tools: Execute functions with validated inputs and outputs (
tools/list
,tools/call
) - Resources: Expose data with URI-based access (
resources/list
,resources/read
) - Prompts: Provide templates with argument substitution (
prompts/list
,prompts/get
) - Notifications: Log messages and resource change notifications
- Initialization: Full handshake and capability negotiation
🚧 Planned/Partial Support
- Client Features: Sampling, roots, and completion (server-side features not yet implemented)
- Progress Tracking: Basic framework exists, needs expansion
- Cancellation: Basic support for
notifications/cancel
- Configuration: Environment variable support, needs structured config API
❌ Not Yet Implemented
- Sampling: LLM sampling requests from servers to clients
- Roots: Server-initiated boundary inquiries
- Completion: Advanced completion capabilities
- Advanced Security: Comprehensive consent flows and access controls
SolidMCP focuses on the server-side of MCP, providing everything needed to build robust MCP servers that work with existing MCP clients like Claude Desktop.
Advanced Usage
Custom Resource Providers
Expose your application data as MCP resources:
use async_trait;
use ResourceProvider;
use ;
;
// Add to your server
let server = new
.with_resource_provider
.build
.await?;
Custom Prompt Providers
Provide dynamic templates for AI interactions:
use PromptProvider;
use ;
;
Configuration
The framework supports various configuration options:
// Custom port
server.start.await?;
// Environment variables
// PORT=8080 - Server port
// RUST_LOG=debug - Logging level
Architecture
SolidMCP is built with a modular architecture:
- Framework Layer (
framework.rs
) - High-level builder API for easy server creation - Handler Traits (
handler.rs
) - Core traits for tools, resources, and prompts - Protocol Engine (
shared.rs
) - MCP protocol implementation and message routing - Transport Layer (
websocket.rs
,http.rs
) - WebSocket and HTTP server implementations - Core Server (
core.rs
) - Server lifecycle and connection management
The library abstracts away the complexity of the MCP protocol while providing full access to all its features.
Current Limitations
SolidMCP is a server-focused implementation. Some limitations to be aware of:
- Client Features: Does not implement client-side capabilities like sampling, roots, or completion
- Progress API: Basic progress tracking exists but needs expansion for complex operations
- Security Model: Basic session management, but enterprise-grade security features are planned
- Config Management: Relies on environment variables; structured configuration API coming
- Protocol Extensions: Focuses on core MCP; custom protocol extensions not yet supported
These limitations reflect our focus on providing an excellent server development experience. Client features and advanced capabilities are on the roadmap.
Testing
SolidMCP includes a comprehensive test suite:
# Run all tests
# Run integration tests
# Run with logging
RUST_LOG=debug
Examples
- Basic Server - Minimal MCP server setup
- Custom Tools - Implementing custom tools
- Toy Notes Server - Complete application with all MCP features
- HTTP Server - HTTP-only server configuration
- WebSocket Server - WebSocket-only server
Contributing
Contributions are welcome! Please see our Contributing Guidelines for details.
License
MIT