Instructions for coding agents (Codex and compatible tools) working in this repository. Self-contained — you do not need to read any other file to get oriented.
iap-https-rust is a multi-language, multi-variant MCP (Model Context Protocol)
server workspace. Each variant exposes the same system-utility tools (system
info, disk usage, process list) but differs in language, transport, and security
model. The comparison is the product.
Critically: there is no shared library. Every variant is an independent
project with its own manifest, Makefile, README.md, and GEMINI.md. The
duplication between variants is intentional. Do not consolidate variants into a
Cargo workspace, a shared Go package, or a Python package unless explicitly
asked.
iap/ manual/ local/ stdio/ stdiokey/ Rust
bearer-rust/ proxy-rust/ Rust (Cloud Run access patterns)
local-python/ manual-python/ stdiokey-python/ Python
bearer-python/ proxy-python/ Python
stdio-go/ stdiokey-go/ manual-go/ Go
bearer-go/ proxy-go/ Go
docs/ article drafts images/ article art
local-rust, manual-rust, stdio-rust, stdiokey-rust are symlinks into
local, manual, stdio, stdiokey. Always edit the real directory. Writing
through both paths creates phantom duplicate diffs.
| Directory | Lang | Transport | Auth |
|---|---|---|---|
iap/ |
Rust | Streamable HTTP | IAP JWT (x-goog-iap-jwt-assertion) |
manual/ |
Rust | Streamable HTTP | IAP + x-goog-api-key |
local/ |
Rust | Streamable HTTP | API key (gcloud fetch) |
stdio/ |
Rust | Stdio | none |
stdiokey/ |
Rust | Stdio | API key |
bearer-rust/ |
Rust | Streamable HTTP | bearer ID token / IAP |
proxy-rust/ |
Rust | Streamable HTTP | via gcloud run services proxy |
local-python/ |
Python | SSE | API key |
manual-python/ |
Python | SSE | API key |
stdiokey-python/ |
Python | Stdio | API key |
bearer-python/ |
Python | SSE | bearer ID token |
proxy-python/ |
Python | SSE | via Cloud Run proxy |
stdio-go/ |
Go | Stdio | none |
stdiokey-go/ |
Go | Stdio | API key |
manual-go/ |
Go | HTTP | IAP + API key |
bearer-go/ |
Go | HTTP | bearer ID token |
proxy-go/ |
Go | HTTP | via Cloud Run proxy |
Run commands from inside the variant directory. Every variant honors the same Makefile vocabulary:
| Target | Rust | Go | Python |
|---|---|---|---|
make build |
cargo build |
go build |
— (use make install) |
make test |
cargo test |
go test |
unittest |
make fmt |
cargo fmt --all -- --check |
go fmt ./... |
ruff format . |
make clippy / make lint |
cargo clippy -- -D warnings |
golangci-lint run |
ruff check . |
make release |
cargo build --release |
optimized build | — |
make run |
start the server | start the server | start the server |
make info / make disk |
one-shot CLI report | same | same |
make deploy |
gcloud builds submit |
same | same |
Two things that will bite you:
make fmtis a check, not a fix — in the Rust variants only. It runscargo fmt --checkand fails on unformatted code; runcargo fmt --allto actually format. The Go and Pythonmake fmttargets do rewrite files (go fmt ./...,ruff format .). Go'smake lintsilently skips ifgolangci-lintis not installed — a passing lint there may mean nothing ran.- The root
Makefiledoes not cover every variant. It fans out only overiap manual local stdio stdiokey local-python manual-python stdiokey-python. The Go,bearer-*, andproxy-*variants must be built and tested from their own directories. A greenmake testat the repo root is not full coverage.
Before you report work as done, run make fmt-equivalent formatting, the linter,
and make test in every directory you touched.
- Rust — edition 2024. Most variants pin
rmcp0.14.stdio/is onrmcp3.1.0 and is the reference implementation for the newer API. Alsotokio,axum,sysinfo,tracing/tracing-subscriber(JSON). - Go — 1.26,
github.com/mark3labs/mcp-go,github.com/shirou/gopsutil/v3. - Python — 3.11+,
mcp,starlette,uvicorn,psutil.
ServerInfo(InitializeResult) is#[non_exhaustive]— construct it withServerInfo::new(capabilities)and thewith_*helpers. A struct literal will not compile.- Bare
#[tool_handler]expands torouter = Self::tool_router(), which rebuilds the router on every tool call. Use#[tool_handler(router = self.tool_router)]to reuse the router built once innew().
docs/upgrade-rmcp-3-and-claude-code.md documents the full migration.
- Stdio variants must not write to stdout. stdout carries JSON-RPC frames
only. All diagnostics go to stderr through
tracing. A strayprintln!/fmt.Println/print()in a stdio variant silently corrupts the protocol. - Tool names are a public interface.
local_system_info,disk_usage,iap_system_info,sysutils_manual_rust,sysutils_bearer_rust,sysutils_proxy_rust,list_processes. Renaming one breaks every client.mcp.jsonthat registers it — treat renames as breaking changes and say so. - Never commit secrets. The root
.gitignoreexcludes.mcp.jsonat any depth,.env, and*.key..mcp.jsonis a per-developer local file that may contain an injected API key. Do not commit one, and do not echo key material into logs, docs, or commit messages. - Do not change a sibling variant unprompted. Fixing a bug in
stdio/does not license you to editstdio-go/too. Flag the parallel, let the user decide.
- Rust: inline
#[cfg(test)] mod testsat the bottom ofsrc/main.rs. - Go:
main_test.gonext tomain.go. - Python:
tests/directory per variant.
Follow the existing placement; do not introduce a new test layout.
source ./set_env.sh— exportsPROJECT_ID,PROJECT_NUMBER,REGION,ID_TOKEN,SHORT_SHA,RUST_LOG. Reads the project from~/project_id.txtand requires authenticatedgcloud. Must be sourced, not executed../init.sh— first-run setup: project ID, API enablement, ADC.set_key.sh,set_adc.sh— API key and ADC credential helpers.- API-key variants resolve a key named "MCP API Key" from the project via
google-apikeys2(ADC) orgcloud services api-keys. TheMCP_API_KEYenvironment variable overrides the lookup. - Deployment is Cloud Run via each variant's
cloudbuild.yaml. Service names vary per variant — read the variant'sMakefilerather than guessing.
Do not run make deploy, gcloud builds submit, or any other command that
mutates cloud state unless the user explicitly asks for a deploy.
docs/ contains long-form article drafts (with YAML frontmatter) about MCP
development in this repo. They are hand-written prose — edit conservatively.
Three agent guides coexist and should be kept consistent when project structure
changes: AGENTS.md (this file), CLAUDE.md (Claude Code), and GEMINI.md
(Gemini CLI, present at the root and in each variant). README.md is the
human-facing entry point.