About Workers Rs MCP
Workers Rs MCP is an MCP server in the Cloud category: rust MCP server template for Cloudflare workers.
Install
git clone https://github.com/tinybeachthor/workers-rs-mcpThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Workers Rs MCP
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
workers-rs-mcp
An example MCP (Model Context Protocol) server written in Rust, running on Cloudflare Workers.
The server compiles to WebAssembly and runs on Cloudflare's edge infrastructure, handling MCP JSON-RPC requests over HTTP.
How it works
HTTP routing is handled by Axum via the workers-rs SDK. MCP protocol logic is handled by the mcpserver crate.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | / |
Server name and version |
| GET | /healthz |
Health check — returns OK |
| POST | /mcp |
MCP JSON-RPC endpoint |
Session management
initializerequests generate a newmcp-session-id(UUID v4) returned in the response header- All subsequent requests should include the
mcp-session-idheader
Tools
Includes one example tool:
- echo — echoes the input
messageback to the caller
Getting started
Prerequisites
- Rust with the
wasm32-unknown-unknowntarget:rustup target add wasm32-unknown-unknown - Wrangler CLI:
npm install -g wrangler
Local development
wrangler dev
Deploy to Cloudflare Workers
wrangler deploy
Pushing to main also deploys automatically via GitHub Actions (requires CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID secrets).
Adding tools
- Implement the
ToolHandlertrait insrc/lib.rs:
struct MyToolHandler;
#[async_trait]
impl ToolHandler for MyToolHandler {
async fn call(&self, args: Value, _context: Value) -> Result<ToolResult, McpError> {
// your logic here
Ok(text_result("result".to_string()))
}
}
- Register the tool with the MCP server:
mcp_router.handle_tool("my-tool", Arc::new(MyToolHandler));
- Add the tool schema to
mcp/tools.json.
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.