#mcp #macro #status #define #uuid #axum #tool #logging #authentication #mmcp

mmcp

A modular, minimalistic and macro-powered MCP (Model Context Protocol) framework for Rust

1 unstable release

Uses new Rust 2024

new 0.1.0 Apr 12, 2025

#976 in Database interfaces

MIT/Apache

125KB
1.5K SLoC

MMCP

GitHub MIT/Apache 2.0 Crates.io docs.rs GitHub Repo stars

A modular, minimalistic and macro-powered MCP (Model Context Protocol) framework for Rust.

This is the main crate for the MMCP framework, providing core functionality and interfaces.

Implementation Status

  • STDIO server implementation
  • Protocol definitions
  • Tool macros
  • RPC implementation
  • HTTP transport with Axum
  • Client implementation
  • Authentication
  • Logging
  • Schemars 0.8 support

Example

use mmcp::{
    server::{MCPServer, primitives::tool::Text, stdio_server_rpc},
    tool,
};
use uuid::Uuid;

/// Generate a UUID
#[tool]
fn generate_uuid() -> Text<Uuid> {
    Text(Uuid::new_v4())
}

/// Generate multiple UUIDs
#[tool]
fn generate_uuid_many(count: usize) -> Vec<Text<Uuid>> {
    (0..count).map(|_| generate_uuid()).collect()
}

#[tokio::main]
async fn main() {
    let server = MCPServer::new("mmcp-uuid", env!("CARGO_PKG_VERSION")).with_tools_from_inventory();

    let adapter = stdio_server_rpc();
    server.start(adapter).await.unwrap();
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Dependencies

~3–10MB
~104K SLoC