pulseengine-mcp-server
Framework for building MCP servers with pluggable backends
This crate provides the server infrastructure for building Model Context Protocol servers in Rust. You implement a backend trait, and this handles the protocol details, transport layer, and infrastructure concerns.
What This Crate Does
The main idea is simple: you implement the McpBackend trait for your domain (databases, APIs, file systems, etc.), and this crate handles all the MCP protocol work.
Infrastructure handled for you:
- Protocol compliance and message routing
- Multiple transport support (stdio, HTTP, WebSocket)
- Authentication and security middleware integration
- Request validation and error handling
- Monitoring and health checks
You focus on:
- Your domain logic (what tools/resources you provide)
- How to execute operations in your system
- Your specific business rules and validation
Real-World Example
This framework currently powers the Loxone MCP Server, which implements 30+ tools for home automation. It successfully works with MCP Inspector, Claude Desktop, and HTTP clients like n8n.
Quick Start
[]
= "0.2.0"
= "0.2.0"
= "0.2.0"
= { = "1.0", = ["full"] }
= "0.1"
use ;
use *;
use TransportConfig;
use async_trait;
use HashMap;
// Your backend implementation
async
Current Status
Works well for basic to complex use cases. The Loxone implementation proves this can handle real-world complexity with multiple tools, resources, and concurrent operations.
What's solid:
- ✅ Backend trait is stable and well-tested
- ✅ Transport integration works (stdio, HTTP, WebSocket)
- ✅ Authentication middleware integrates cleanly
- ✅ Error handling and protocol compliance
- ✅ Async/await throughout with good performance
Areas for improvement:
- 📝 More examples for different use cases
- 🧪 Better testing utilities for backend implementations
- 🔧 Some advanced features could be more polished
- 📊 More comprehensive monitoring hooks
Features
Multiple Transports
// For Claude Desktop integration
Stdio
// For HTTP clients (n8n, web apps)
Http
// For real-time applications
WebSocket
Built-in Security
When enabled, you get authentication, rate limiting, and input validation automatically:
let mut config = default;
config.auth_config.enabled = true; // Requires API keys
config.security_config.rate_limit = Some; // Requests per minute
Monitoring Integration
The framework provides hooks for monitoring and observability:
// Health checks, metrics, and request tracing work automatically
// Custom monitoring can be added through the backend trait
Comparing to the Loxone Implementation
The Loxone MCP Server is our main reference implementation. It shows how to:
- Handle 30+ tools with complex business logic
- Integrate with external systems (HTTP APIs)
- Manage connection pooling and caching
- Structure tools by domain (lighting, climate, security)
- Handle real-world error conditions
If you're building something similar in complexity, the Loxone code is a good reference for patterns and organization.
Contributing
This crate is actively used and maintained as part of the Loxone MCP server. Improvements often come from real-world usage patterns we discover.
Most useful contributions:
- Better examples - Show patterns for different domains
- Testing utilities - Make it easier to test backend implementations
- Documentation - Especially for complex integration scenarios
- Performance improvements - Based on real usage patterns
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Repository: https://github.com/avrabe/mcp-loxone
Note: This crate is part of a larger MCP framework that will be published as a separate repository.