Skip to content

feat: add Rust binary calculator example#207

Open
bryan-anthropic wants to merge 2 commits intomainfrom
examples/calculator-rust
Open

feat: add Rust binary calculator example#207
bryan-anthropic wants to merge 2 commits intomainfrom
examples/calculator-rust

Conversation

@bryan-anthropic
Copy link
Collaborator

Summary

  • 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

Motivation

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

File Purpose
manifest.json v0.3 manifest with server.type = "binary"
Cargo.toml Standalone Rust project (edition 2024, rmcp 1.2.0)
src/main.rs Combined calculator server (~80 LOC)
Dockerfile Build inside Docker (no local Rust needed)
.mcpbignore Excludes source, keeps only manifest + binary in bundle
README.md Build, pack, and test instructions

Test plan

  • mcpb pack examples/calculator-rust validates manifest and produces correct bundle (only manifest.json + server/mcp-calculator)
  • Binary built and tested end-to-end: initialize, tools/list, sum(3,4)→7, sub(10,3)→7
  • yarn lint and yarn test pass (218 tests)
  • Successfully tested as installed MCPB in Claude Desktop on macOS ARM64

🤖 Generated with Claude Code

bryan-anthropic and others added 2 commits March 13, 2026 16:36
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant