Writing an MCP server in Rust is the fun part. Packaging it so someone else can actually install, verify, and run it without cloning your repo or blindly trusting a curl | sh script is where most of the real friction lives.
Over the past few releases of xgbtxy/ap — starting with the v2.96.2 milestone (361/361 tests passing and 0 bundle validation findings) and continuing through v2.98.0 — I wired up four distribution surfaces from the same single-binary Rust codebase:
- The Official MCP Registry (
io.github.xgbtxy/ap) with five per-platform.mcpbbundles and GitHub OIDC publishing. - Glama (
glama.json) + a minimal non-root Docker image (Dockerfile). - A strict Antigravity plugin bundle (
.antigravity-plugin/plugin.json+plugin/). - Pinned GitHub Release binaries with
SHA256SUMS.
Here is how the pieces fit together, the trade-offs I ran into, and the parts I am still unsure about.
1. Official MCP Registry (io.github.xgbtxy/ap) without long-lived secrets
You can query the live registry entry directly right now:
curl -s https://registry.modelcontextprotocol.io/v0.1/servers/io.github.xgbtxy%2Fap/versions/latest
The registry manifest (server.json) targets schema https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json and declares five mcpb packages over stdio transport:
ap-mcp-windows-x64.mcpbap-mcp-darwin-arm64.mcpbap-mcp-darwin-x64.mcpbap-mcp-linux-x64.mcpbap-mcp-linux-arm64.mcpb
One detail that tripped me up early is the hash chicken-and-egg problem: server.json requires a fileSha256 for every .mcpb archive, but you do not know the final archive hashes until CI finishes building the release artifacts.
The cleanest pattern I landed on in .github/workflows/release.yml was to keep placeholder zeros in the checked-in server.json, build all five .mcpb bundles via scripts/make-mcpb.sh, generate SHA256SUMS, and then have the publish-mcp-registry job stamp each real fileSha256 into server.json right before publishing.
Publishing itself uses zero static registry API keys:
- Download
mcp-publisherand verify its provenance against the GitHub Actions OIDC issuer (https://token.actions.githubusercontent.com). - Run
./mcp-publisher validate. - Authenticate via
./mcp-publisher login github-oidc. - Run
./mcp-publisher publish.
That means a GitHub tag release either produces verifiable checksums and publishes atomically, or fails closed before anything hits the registry.
2. Glama + minimal non-root Docker packaging
For Glama indexing and containerized MCP runners, the repo ships two small files:
glama.jsonpointing tohttps://glama.ai/mcp/schemas/server.jsonwithmaintainers: ["xgbtxy"].Dockerfileusing a two-stage build:- Stage 1 (
rust:1-slim-bookworm):cargo build --release --locked --bin ap. - Stage 2 (
debian:bookworm-slim): installs onlyca-certificates, creates a non-rootappuser(uid 10001), attachesio.modelcontextprotocol.server.name="io.github.xgbtxy/ap"plus standard OCI source/license labels, copies/usr/local/bin/ap, and setsENTRYPOINT ["/usr/local/bin/ap", "mcp"].
- Stage 1 (
Locking --locked in the builder stage and running as appuser in a slim runtime image is boring, which is exactly what you want for a tool that touches someone else's workspace.
3. Strict Antigravity plugin bundle (.antigravity-plugin/ + plugin/)
An MCP server binary alone does not teach a coding agent when to reach for AST reads or log compression instead of dumping a 2,000-line file into context. That is why the repo also ships a plugin bundle:
.antigravity-plugin/plugin.jsonandplugin/plugin.json: metadata, suggested prompts, and version alignment (agent-primitives).plugin/mcp_config.json: launchesap mcp --profile core.plugin/hooks.json: a lightweightSessionStarthook (node ./scripts/session-boot.mjs,5stimeout).plugin/rules/andplugin/skills/: concise usage guidance so the agent prefers structured primitives over raw full-file dumps.
Notice --profile core in plugin/mcp_config.json. Even though ap implements 37 MCP tools across its 7 Rust crates (atlas, splice, probe, sieve, guard, recall, baton), exposing every single tool schema on every session wastes context tokens before the user even asks a question. Defaulting the plugin to core keeps the initial tool surface tight while letting users opt into the full set when they need it.
At v2.96.2, the full Rust suite ran 361/361 passing tests with 0 manifest/security findings across the bundle checks.
Architectural trade-offs I actually felt
- Single-binary Rust (
stdio) vs. Node/Python MCP servers: Users get zero runtime dependencies and fast startup, andcargo build --lockedmakes builds reproducible. The tax is mine: maintaining a 5-target cross-compile matrix and.mcpbpackaging scripts in CI. - Dynamic
fileSha256stamping in CI vs. committed hashes: Avoids double-tagging releases, but anyone inspectingserver.jsondirectly onmainsees placeholder zeros instead of the live release hashes (the live hashes live on the MCP Registry endpoint and inSHA256SUMSon GitHub Releases). - Minimal Docker image vs. batteries-included container: Keeping the runtime image on
debian:bookworm-slimwith onlyca-certificateskeeps the image small and auditable, at the cost that headless browser (CDP) commands require a host or sidecar browser rather than a bundled Chromium inside the container. - Profile-scoped tools (
--profile core) vs. exposing all 37 tools: Better default token hygiene for agents, but a user who installs the plugin expecting every niche sub-tool immediately visible has to know profiles exist.
What I am unsure about
- Registry presence is not adoption. Getting
io.github.xgbtxy/aplive on the Official MCP Registry and Glama makes installation cleaner and more verifiable, butxgbtxy/apstill has a tiny star count (2stars right now). Packaging removes friction; it does not create demand on its own. - Four packaging surfaces create real maintenance drag. Keeping
server.json,glama.json,Dockerfile, and.antigravity-plugin/+plugin/aligned across releases is fine when CI catches drift, and annoying whenever an upstream schema changes (2025-12-11will not be the last MCP schema revision). 361/361tests and0findings only validate what I thought to test. Cross-platformstdioquirks, corporate proxies, and Windows path edge cases still tend to show up only when someone outside my own setup tries the binary.
If you are packaging an MCP server in Rust, Go, or TypeScript and have found a cleaner way to keep Registry manifests, Docker, and IDE plugin bundles in sync without duplicating metadata, I would genuinely love to compare notes.
Links
github.com/xgbtxy/ap(MIT, v2.98.0)- Official MCP Registry ·
io.github.xgbtxy/ap - Glama MCP Index
- Essay #9: What 91 Merged OSS PRs Taught Me About Rust, Go, and AI Agent Tooling
我觉得技术没有壁垒,在合适的时间做合适的事情就好,hhh