Expand description
MCP Server configuration and runtime.
This module provides a clean API for creating and running MCP servers:
ⓘ
use mcp::macros::mcp_tool;
use mcp::{McpServerConfig, McpServer};
#[mcp_tool(description = "Add two numbers")]
fn add(a: f64, b: f64) -> f64 { a + b }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = McpServerConfig::builder()
.name("calculator")
.version("1.0.0")
.with_stdio_transport()
.with_tools(tools![AddTool])
.build();
McpServer::run(config).await?;
Ok(())
}Structs§
- McpServer
- MCP Server runtime.
- McpServer
Config - Configuration for an MCP server.
- McpServer
Config Builder - Builder for creating MCP server configurations.
Enums§
- Server
Error - Errors that can occur when running an MCP server.
- Server
Transport - Server transport configuration.