
async mcp
A minimalistic async Rust implementation of the Model Context Protocol (MCP).
Repository Info
About This Server
A minimalistic async Rust implementation of the Model Context Protocol (MCP).
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Async MCP
A minimalistic async Rust implementation of the Model Context Protocol (MCP). This library extends the synchronous implementation from mcp-sdk to support async operations and implements additional transports. Due to significant code changes, it is released as a separate crate.
Note: This project is still early in development.
Installation
Add this to your Cargo.toml:
[dependencies]
async-mcp = "0.1.2"
Overview
This is an implementation of the Model Context Protocol defined by Anthropic.
Features
Supported Transports
- Server-Sent Events (SSE)
- Standard IO (Stdio)
- In-Memory Channel
- Websockets
Usage Examples
Server Implementation
Using Stdio Transport
let server = Server::builder(StdioTransport)
.capabilities(ServerCapabilities {
tools: Some(json!({})),
..Default::default()
})
.request_handler("tools/list", list_tools)
.request_handler("tools/call", call_tool)
.request_handler("resources/list", |_req: ListRequest| {
Ok(ResourcesListResponse {
resources: vec![],
next_cursor: None,
meta: None,
})
})
.build();
Run Http Server supporting both SSE and WS
run_http_server(3004, None, |transport| async move {
let server = build_server(transport);
Ok(server)
})
.await?;
Local Endpoints
WebSocket endpoint: ws://127.0.0.1:3004/ws
SSE endpoint: http://127.0.0.1:3004/sse
Client Implementation
Setting up Transport
// Stdio Transport
let transport = ClientStdioTransport::new("<CMD>", &[])?;
// In-Memory Transport
let transport = ClientInMemoryTransport::new(|t| tokio::spawn(inmemory_server(t)));
// SSE Transport
let transport = ClientSseTransportBuilder::new(server_url).build();
// WS Transport
let transport = async_mcp::transport::ClientWsTransportBuilder::new("ws://localhost:3004/ws".to_string()).build();
Making Requests
// Initialize transport
transport.open().await?;
// Create and start client
let client = async_mcp::client::ClientBuilder::new(transport.clone()).build();
let client_clone = client.clone();
let _client_handle = tokio::spawn(async move { client_clone.start().await });
// Make a request
client
.request(
"tools/call",
Some(json!({"name": "ping", "arguments": {}})),
RequestOptions::default().timeout(Duration::from_secs(5)),
)
.await?
Complete Examples
For full working examples, check out:
- Ping Pong Example
- File System Example
- Knowledge Graph Memory Example
Related SDKs
Official
- TypeScript SDK
- Python SDK
Community
- Go SDK
For the complete feature set, please refer to the MCP specification.
Implementation Status
Core Protocol Features
- Basic Message Types
- Error and Signal Handling
- Transport Layer
- Stdio
- In-Memory Channel
- SSE
- Websockets
Server Features
- Tools Support
- Prompts
- Resources
- Pagination
- Completion
Client Features
Compatible with Claude Desktop:
- Stdio Support
- In-Memory Channel
- SSE Support
Monitoring
- Logging
- Metrics
Utilities
- Ping
- Cancellation
- Progress Tracking
Quick Start
Clone the repository
git clone https://github.com/v3g42/async-mcpInstall dependencies
cd async-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.