Are you the author? Sign in to claim
Rust MCP framework for building AI agents
Production-ready Rust framework for building AI agents with built-in MCP support, multi-LLM integration, and web-based inspector. Deploy memory-safe, high-performance agent systems.
A Rust framework for building AI agents that can use any MCP server. Designed for production deployments where performance, safety, and reliability matter.
Core Components:
| Feature | Description |
|---|---|
| MCP Server | Build and deploy custom MCP servers with tool registration |
| MCP Client | Connect to multiple MCP servers simultaneously (HTTP, stdio) |
| AI Agent | Production-ready agents with conversation management |
| Web Inspector | Debug UI with tool testing and request/response viewer |
| Claude Integration | Full Anthropic API support with streaming |
| OpenAI Integration | GPT-4, o1, o3 models with function calling |
| Browser Automation | Playwright MCP integration for web tasks |
| Session Management | Persistent conversations with state tracking |
| Async/Await | Zero-cost async runtime built on Tokio |
| Feature | Priority | Status |
|---|---|---|
| Multi-Provider LLM | High | Planned (Gemini, Groq, DeepSeek, Mistral) |
| Vector Databases | High | Planned (Qdrant, Chroma, Pinecone) |
| Agent Orchestration | High | Planned (Graph-based workflows, handoffs) |
| Streaming Support | High | Planned (Token-by-token, tool streaming) |
| Resources | Medium | Planned (MCP resources protocol) |
| Prompts | Medium | Planned (MCP prompts protocol) |
| Authentication | Medium | Planned (OAuth, API keys) |
| Memory System | Medium | Planned (RAG, semantic retrieval) |
| Middleware | Low | Planned (Request/response hooks) |
• echo - String echo utility
• calculator - Math: add, subtract, multiply, divide, power, sqrt
• get_weather - Weather lookup for cities worldwide
• search_text - Find pattern occurrences in text
• string_length - Get character count
• text_reverse - Reverse text strings
• json_parser - Validate and format JSON
• http_status - Look up HTTP status codes
# Requires Rust 1.70+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/koki7o/mcp-framework
cd mcp-framework
# Create .env for API keys (optional but recommended)
cp .env.example .env
# Edit .env and add ANTHROPIC_API_KEY or OPENAI_API_KEY
Minimal Server (1 tool):
cargo run
Server with 8 Tools + Inspector UI:
cargo run --example server_with_tools
# Visit: http://localhost:8123
AI Agent with Claude:
# Requires ANTHROPIC_API_KEY in .env
cargo run --example anthropic_agent_demo_with_tools --release
AI Agent with OpenAI:
# Requires OPENAI_API_KEY in .env
cargo run --example openai_agent_demo_with_tools --release
Browser Automation (OpenAI):
# Requires OPENAI_API_KEY in .env
# Install: npm install -g @playwright/mcp@latest && npx playwright install firefox
cargo run --example browser_agent_openai
Browser Automation (Claude):
# Requires ANTHROPIC_API_KEY in .env
# Install: npm install -g @playwright/mcp@latest && npx playwright install firefox
cargo run --example browser_agent_anthropic
rmcp - the official Rust MCP implementationuse mcp_framework::prelude::*;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<()> {
mcp_framework::load_env();
let client = McpClient::new("http://localhost:3000");
let llm = AnthropicAdapter::from_env("claude-sonnet-4-5-20250929".to_string())?;
let mut agent = Agent::new(client, Arc::new(llm), AgentConfig::default());
let response = agent.run("What is 15 + 27?").await?;
println!("{}", response);
Ok(())
}
Run Examples:
cargo run --example anthropic_agent_demo_with_tools --release - Claude democargo run --example openai_agent_demo_with_tools --release - OpenAI demouse mcp_framework::prelude::*;
use mcp_framework::server::{McpServer, ServerConfig, ToolHandler};
use std::sync::Arc;
struct MyToolHandler;
#[async_trait::async_trait]
impl ToolHandler for MyToolHandler {
async fn execute(&self, name: &str, arguments: serde_json::Value)
-> Result<Vec<ResultContent>> {
match name {
"greet" => Ok(vec![ResultContent::Text {
text: format!("Hello, {}!", arguments.get("name").and_then(|v| v.as_str()).unwrap_or("stranger"))
}]),
_ => Err(Error::ToolNotFound(name.to_string())),
}
}
}
#[tokio::main]
async fn main() -> Result<()> {
let config = ServerConfig {
name: "My Server".to_string(),
version: "1.0.0".to_string(),
capabilities: ServerCapabilities {
tools: Some(ToolsCapability { list_changed: Some(false) }),
resources: None, // Not implemented yet
prompts: None, // Not implemented yet
},
};
let server = McpServer::new(config, Arc::new(MyToolHandler));
server.register_tool(Tool {
name: "greet".to_string(),
description: Some("Greet someone".to_string()),
input_schema: None,
});
Ok(())
}
Examples:
cargo run - Minimal server (1 tool)cargo run --example server_with_tools - Full example (8 tools + Inspector)use mcp_framework::prelude::*;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<()> {
let client = McpClient::new("http://localhost:3000");
// List all tools
let tools = client.list_tools().await?;
println!("Available tools: {:?}", tools);
// Call a tool
let result = client.call_tool("echo", json!({
"message": "Hello, MCP!"
})).await?;
println!("Result: {:?}", result);
Ok(())
}
Example:
cargo run --example client_usage - Full client usage exampleTest and debug MCP servers with a web UI.
cargo run --example server_with_tools
# Open browser to: http://localhost:8123
Features:
# Run all tests
cargo test
# Run with output
cargo test -- --nocapture
# Run specific test
cargo test test_name
# Run with release optimizations
cargo test --release
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
Made with ❤️ for the MCP community
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases
Official GitHub integration for repos, issues, PRs, and CI/CD workflows