feat: add Rust binary calculator example#207
Conversation
First example of the binary server type — a compiled Rust MCP server packaged as an MCPB. Based on the official Rust SDK calculator example (rmcp 1.2.0, 2 tools: sum/sub, ~80 LOC). Includes Cargo.toml, Dockerfile for Docker-based builds, .mcpbignore to exclude source from the bundle, and README with build/pack/test instructions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Align with other examples — no example ships a Dockerfile or its own .gitignore. Rust build artifacts are now covered by the repo-level .gitignore instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Review by Claude Code
Good first example of the binary server type — clean manifest, minimal Rust code, proper .mcpbignore to keep source out of the bundle.
One minor observation: Missing schema description on SumRequest.b — SumRequest.a has #[schemars(description = "the left hand side number")] but b has no description. SubRequest has descriptions on both fields. Consider adding for consistency.
Otherwise: manifest is correct (v0.3, binary type, ${__dirname} variable, darwin/linux platforms), .mcpbignore excludes the right files, and the README build/test instructions are clear.
tobinsouth
left a comment
There was a problem hiding this comment.
Good first binary server-type example. Manifest is clean (v0.3, ${__dirname} path, correct .mcpbignore), Rust code is minimal and idiomatic rmcp. The missing schemars description on SumRequest.b is a trivial nit, not blocking. Note: the .gitignore hunk at line 88 is identical to #206's — whichever lands second will have a trivial conflict resolve.
Summary
binaryserver type — a compiled Rust MCP server packaged as an MCPBsum/sub, ~80 LOC)Cargo.toml, Dockerfile for Docker-based builds,.mcpbignoreto exclude source from the bundle, and README with build/pack/test instructionsMotivation
All existing examples use interpreted runtimes (Node.js, Python/UV). This fills the gap for compiled languages (Rust, Go, C++) where a pre-built binary is packaged directly. The calculator is intentionally minimal — zero API keys, no external dependencies, two tools — so it serves as a clear template.
What's included
manifest.jsonserver.type = "binary"Cargo.tomlsrc/main.rsDockerfile.mcpbignoreREADME.mdCross-platform test results
Cross-compiled from WSL2 (Linux) using
cargo-xwin(Windows) andcargo-zigbuild(macOS):The managed Mac failure is OS-level security (Gatekeeper + MDM), not a CD or MCPB bug. Binary MCPBs on enterprise Macs require Apple Developer ID codesigning + notarization. This is inherent to
server.type: "binary"and should be documented.Related: This example also serves as a test fixture for #209, which adds validation and pack-time enforcement of executable permissions on binary entry points.
Test plan
mcpb pack examples/calculator-rustvalidates manifest and produces correct bundle (only manifest.json + server/mcp-calculator)yarn lintandyarn testpass (218 tests)0755on binary entry point — verified via external_attr inspection🤖 Generated with Claude Code