- Explore MCP Servers
- mcp_daemon
Mcp Daemon
What is Mcp Daemon
mcp_daemon is a Rust implementation of the Model Context Protocol (MCP), which facilitates communication between LLM applications and external data sources and tools under the MIT license.
Use cases
Use cases for mcp_daemon include building applications that need to access external APIs, integrating LLMs with databases, and developing tools that require standardized communication with external services.
How to use
To use mcp_daemon, include it in your Cargo.toml file as a dependency. You can create a client to connect to an MCP server and initialize it to access resources and tools.
Key features
Key features of mcp_daemon include a client and server implementation, complete schema definitions for the MCP protocol, comprehensive error handling, and support for asynchronous operations.
Where to use
mcp_daemon can be used in fields that require integration between LLM applications and various external systems, such as data processing, machine learning, and software development.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Daemon
mcp_daemon is a Rust implementation of the Model Context Protocol (MCP), which facilitates communication between LLM applications and external data sources and tools under the MIT license.
Use cases
Use cases for mcp_daemon include building applications that need to access external APIs, integrating LLMs with databases, and developing tools that require standardized communication with external services.
How to use
To use mcp_daemon, include it in your Cargo.toml file as a dependency. You can create a client to connect to an MCP server and initialize it to access resources and tools.
Key features
Key features of mcp_daemon include a client and server implementation, complete schema definitions for the MCP protocol, comprehensive error handling, and support for asynchronous operations.
Where to use
mcp_daemon can be used in fields that require integration between LLM applications and various external systems, such as data processing, machine learning, and software development.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Daemon: A Rust implementation of the Model Context Protocol (MCP)
This crate provides a standards-compliant implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.
Overview
The Model Context Protocol (MCP) is a standardized protocol for communication between LLM applications and external systems. It allows LLM applications to access external data sources, tools, and services in a consistent and standardized way.
This implementation includes both client and server components, along with the necessary schema definitions and utilities for working with the protocol.
Features
- Client Implementation: Connect to MCP servers and access their resources and tools
- Server Implementation: Create an MCP server to expose resources and tools to LLM applications
- Schema Definitions: Complete schema definitions for the MCP protocol (03.26.2025)
- Error Handling: Comprehensive error handling for all protocol operations
- Async Support: Built on top of the async ecosystem for efficient operation
Installation
Add this to your Cargo.toml:
[dependencies]
mcp_daemon = "0.3.0"
OR
Run cargo add mcp_daemon
Usage
Client Example
use mcp_daemon::client::Client;
use mcp_daemon::schema::*;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client
let client = Client::new("http://localhost:8080");
// Initialize the client
let init_result = client.initialize().await?;
println!("Connected to server: {}", init_result.server_info.name);
// List available tools
let tools = client.tools_list(ListToolsRequestParams::default()).await?;
println!("Available tools: {}", tools.tools.len());
Ok(())
}
Server Example
use mcp_daemon::server::{Server, DefaultServer};
use mcp_daemon::schema::*;
use std::sync::Arc;
struct MyServer;
impl Server for MyServer {
// Implement required methods
// ...
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a server
let server = Arc::new(MyServer);
// Start the server
let addr = "127.0.0.1:8080";
println!("Starting server on {}", addr);
// server.listen(addr).await?;
Ok(())
}
Documentation
The full API documentation is available at docs.rs/mcp_daemon.
You can also build the documentation locally:
cargo doc --open
Key Modules
- client: Client implementation for connecting to MCP servers
- server: Server implementation for creating MCP servers
- schema: Schema definitions for the MCP protocol
- error: Error handling for the MCP protocol
- utility: Utility functions, macros, and types
- transport: Transport layer implementations (HTTP/2, WebSockets, etc.)
TLS Configuration
Server TLS Configuration
Self-Signed Certificates for Development
For local development, you can generate self-signed certificates using the included script:
# Generate certificates for localhost
./scripts/generate_cert.sh
# Generate certificates with custom options
./scripts/generate_cert.sh --dir my_certs --domain example.com --days 730
Then use the certificates in your server configuration:
use mcp_daemon::transport::http2::{Http2ServerConfig, TlsConfig};
use std::net::SocketAddr;
let config = Http2ServerConfig {
addr: "127.0.0.1:8443".parse().unwrap(),
tls_config: Some(TlsConfig::Manual {
cert_path: "certs/localhost.example.crt".to_string(),
key_path: "certs/localhost.example.key".to_string(),
}),
};
Let’s Encrypt Integration
For production environments, you can use Let’s Encrypt for automatic certificate management by enabling the acme feature:
[dependencies]
mcp_daemon = { version = "0.3.0", features = ["acme"] }
Then configure your server to use ACME:
use mcp_daemon::transport::http2::{Http2ServerConfig, TlsConfig};
use std::net::SocketAddr;
use std::path::PathBuf;
let config = Http2ServerConfig {
addr: "0.0.0.0:443".parse().unwrap(),
tls_config: Some(TlsConfig::Acme {
domains: vec!["example.com".to_string()],
contact_email: "[email protected]".to_string(),
cache_dir: Some(PathBuf::from(".certificates")),
use_staging: false, // Set to true for testing
}),
};
Client TLS Configuration
The client supports various TLS configurations for secure connections to MCP servers:
Basic TLS (System Root Certificates)
use mcp_daemon::transport::http::Http2Builder;
// Create a client with TLS enabled (using system root certificates)
let transport = Http2Builder::new()
.with_tls(true)
.with_host("example.com".to_string())
.with_port(443)
.build()?;
Custom Root Certificate
use mcp_daemon::transport::http::Http2Builder;
// Create a client with a custom root certificate
let transport = Http2Builder::new()
.with_custom_tls("path/to/root.crt".to_string(), true)
.with_host("example.com".to_string())
.with_port(443)
.build()?;
Client Certificate (Mutual TLS)
use mcp_daemon::transport::http::Http2Builder;
// Create a client with a client certificate for mutual TLS
let transport = Http2Builder::new()
.with_custom_tls("path/to/root.crt".to_string(), true)
.with_client_cert("path/to/client.crt".to_string(), "path/to/client.key".to_string())
.with_host("example.com".to_string())
.with_port(443)
.build()?;
Server Name Indication (SNI)
use mcp_daemon::transport::http::Http2Builder;
// Create a client with SNI
let transport = Http2Builder::new()
.with_custom_tls("path/to/root.crt".to_string(), true)
.with_sni("example.com".to_string())
.with_host("192.168.1.100".to_string()) // IP address
.with_port(443)
.build()?;
Note: The client TLS implementation is currently in development. While the API is in place, some advanced features like client certificates and SNI may not be fully functional in all scenarios. We’re actively working on improving this and welcome feedback from users. Please see our GitHub Discussions for more information and to provide input.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Resources
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










