Repository navigation
MCP Server
For architects: how the Compass MCP server is built, what its 24 tools are, how it keeps writes safe and how it is configured.
The Compass server is a local MCP server published to npm as reinvent-compass (version 0.1.3, Node 24 or newer). An MCP client such as Kiro starts it on stdio with npx --yes reinvent-compass@0.1.3. It scans the code you work on (a project, a dev folder of git repositories or, through the read-only GitHub App, your GitHub repositories) to learn your AWS services, how deeply you use each one and the rest of your stack, then reads the AWS Events API catalog to find the sessions that match, with a reason for each. It plans a week, runs the guardrail before every booking and drives the Compass API for passes.
| Folder | Role |
|---|---|
| packages/mcp-server/src | The server: tool handlers, guardrail wiring, hooks, command line and runtime composition. |
| packages/core/src |
@compass/core, the shared library the server and the site use. |
| packages/contracts/src |
@compass/contracts: the zod schemas of every tool input and output (mcpTools in mcp-tools.ts), the pass fields and the generated API types. |
Inside the server package:
| Folder | Role |
|---|---|
| server |
createCompassServer, the tool registry, the write mutex, elicitation, result shaping and error messages. |
| tools | One handler per tool. |
| guardrail | Batch checks, rebooking suggestions and the in-memory ledger of pending safe swaps. |
| adapters and ports | The seams to the Events API, the rules engine, the pass client, GitHub, the file system and the QR page. |
| runtime | Builds the live or the simulated composition once, at start-up. |
| safety | Labelled data, identifier checks and path checks. |
| state | The schedule snapshot, the tech list and the per-session state. |
| hooks | What the optional Kiro hooks run. |
| cli and demo | The command line and the offline demo. |
| simulated | The in-process pass service and pinned clock of simulated mode. |
The library exports ten subpaths, listed in packages/core/package.json.
| Subpath | What it holds |
|---|---|
@compass/core/auth |
Builder ID sign-in with PKCE on a loopback port (8484 to 8489), the keychain token store, single-flight refresh and the one-audience-per-token check. |
@compass/core/api |
The 12 Events API operations, one file each, with the HTTP transport, the retry policy, the per-operation quota tracker and the confirmed write that reads the schedule back. |
@compass/core/catalog |
Catalog refresh by paged ListSessions, normalisation, the event window and the private catalog cache. |
@compass/core/simulated |
The synthetic catalog fixtures and the simulated transport. |
@compass/core/rules |
The rules engine: clashes, connections, boarding closes, energy budget, layovers, rebooking and safe swap. |
@compass/core/scanner |
The read-only repository scanner, run in a worker thread with a 20 second budget. |
@compass/core/spec |
The week planner and the Kiro spec renderer and writer. |
@compass/core/passes |
Pass fields, the Compass API client, pass sync, hand-off, calendar and itinerary export, forget-me and the local pass record. |
@compass/core/github |
The GitHub App device flow, the GitHub client, its token store and the archive scan worker. |
@compass/core/redact |
Redaction of tokens and other secrets from any log line. |
createCompassServer in create-server.ts registers every key of mcpTools, passing each contract input and output schema through. Each tool has a class in tool-registry.ts, which sets its MCP annotations: readOnlyHint for read, destructiveHint for write.
| Class | Count | Tools |
|---|---|---|
| read | 8 |
refresh_catalog, find_sessions, scan_repo, check_itinerary, show_schedule, show_my_tech, find_sessions_by_tech, scan_github
|
| write, changes the re:Invent schedule | 5 |
reserve_with_guardrails, cancel_reservation, add_standby, remove_standby, add_layover
|
| write, passes or data | 5 |
issue_all_boarding_passes, issue_boarding_pass, send_to_phone, sync_passes, forget_me
|
| local action | 6 |
sign_in, sign_out, plan_week, export_calendar, connect_github, disconnect_github
|
sync_passes is a write tool because it can void passes. The server exposes tools only: no MCP resources and no prompts. Every tool, with its inputs and outputs, is on MCP tools.
-
Reads nothing at start.
createCompassServertouches no catalog, network or keychain, so a cold start stays fast. - Fixed error messages. Every handler call is wrapped. A thrown error becomes a fixed plain-English message, and only its code is logged.
-
Codes for ids. A session code such as
BWP213is accepted wherever a session id is. - Writes run one at a time. Write tools run behind a mutex in mutex.ts. Two writes that arrive together would each read the same schedule and each pass the guardrail; queued, each re-reads the schedule when its turn comes.
-
Fresh schedule, confirmed write. Every schedule write reads
GetSchedulefresh, runs the guardrail, sends the write once, then reads the schedule back. A session counts as reserved only when the read-back lists it. If the read-back fails, the result says "unconfirmed" and the write is never resent. -
Safe swap. A blocked booking returns rebooking options and, when one exists, a safe swap: reserve the repeat first, cancel the original after.
cancel_reservationon a session in a pending swap re-checks the swap on a fresh schedule and cancels only when it is safe. -
Read-only mode. In live mode, unless
COMPASS_ALLOW_WRITES=1, the Events adapter is wrapped so every write is refused before any request. The schedule tools answer what they would have done. Passes still work. - Logs go to stderr. stdout carries MCP protocol messages only. Every log line passes through redaction.
Where the client declares the MCP elicitation capability, a tool asks the human directly before it changes anything: a ticked box for yes or no, or a single choice from a list. The server waits up to five minutes; a timeout changes nothing. Any answer that is not a ticked box is a no. Where the client cannot ask, the client's own approval of the tool call is the confirmation, and a few actions are refused outright (a bulk void, a swap override, scanning a folder outside the workspace, scanning GitHub). With COMPASS_ELICITATION=off the server asks nothing, even when the client declares the capability, and behaves as it does for a client that cannot ask. The Kiro Power sets it, because Kiro cancels every question a server asks through a Power (Kiro 1.4.86 logs "Elicitation request received but no handler is active, cancelling"), so each one would read as a no (compass-power task 65). See elicitation.ts.
Catalog text and the attendee's own text reach the agent only inside a labelled block: a fixed preamble that says the content is data, not instructions, followed by the data encoded as JSON. JSON encoding means a title can never close the block or pose as server text. Abstracts never leave the server. See labelled-data.ts and the prompt-injection test described on Security.
-
MCP over stdio to the client, built on
@modelcontextprotocol/sdk1.32.2 (see why the v1 SDK). -
HTTPS to
oauth.awsevents.com(sign-in, refresh, revoke) andapi.awsevents.com(the 12 operations; see Events API coverage). -
HTTPS to the Compass API at
https://reinvent-compass.vegaswith the ID token (see Pass API). -
HTTPS to
github.com,api.github.comandcodeload.github.com, only afterconnect_github. - Files in the OS app-data folder and the workspace (see Data and privacy).
run-cli.ts handles:
reinvent-compass # start the server on stdio
reinvent-compass demo [--repo <dir>] # run the simulated demo, no network
reinvent-compass hook <name> # pre-write-guardrail or post-write-sync, exits 0 or 2
reinvent-compass --version # or -v
reinvent-compass --help # or -hA hook command reads stdin only, starts no subprocess and exits only with 0 or 2. The demo forces simulated mode and runs on a temporary copy of the folder it scans.
Settings are environment variables of the server process, read in runtime-config.ts and github.ts.
| Variable | Effect |
|---|---|
COMPASS_MODE |
simulated runs on the synthetic catalog with a pinned clock and an in-process pass service. Anything else is live. |
COMPASS_ALLOW_WRITES |
1 lets the schedule tools change the real re:Invent schedule, each change still confirmed. Unset means read-only. |
COMPASS_API_URL |
An https Compass API base URL, used only together with COMPASS_ALLOW_API_OVERRIDE=1. The server then prints a warning naming the host. |
COMPASS_ALLOW_API_OVERRIDE |
1 allows COMPASS_API_URL. This is how the dev environment is tested. |
COMPASS_GITHUB_CLIENT_ID |
Another GitHub App's client id, for a self-hosted app. An empty value turns GitHub scanning off. The server warns that it cannot check the app is read-only. |
COMPASS_GITHUB_APP_SLUG |
The slug of that app, for its install page. |
COMPASS_ELICITATION |
off makes the server ignore the client's elicitation capability, so the client's own tool approval is the confirmation. The Kiro Power sets it. Any other value keeps the questions. |
COMPASS_ALLOW_SIMULATED |
1 allows simulated mode when NODE_ENV is production. |
The app-data folder follows the platform: %LOCALAPPDATA% (or %APPDATA%) on Windows, ~/Library/Application Support on macOS, $XDG_DATA_HOME or ~/.local/share elsewhere, each with a reinvent-compass folder.
The MCP server was built in the Build workstream (Build cards on the project board). The cards for it:
- REL1: the 0.1.0 release commit: version, private flag off, production API address
- BUG1: layover showed 8 hours late
- BUG2: layover refused on 29 November (badge pickup day)
- CTO1: package metadata and licences
re:Invent Compass is an independent community project and is not affiliated with, endorsed by, or sponsored by Amazon Web Services. Boarding passes are unofficial: your re:Invent badge is your ticket. Licensed under Apache-2.0. Disclaimer · Repository · Project board
Get started
User guide
Architecture
- Overview
- Kiro Power
- MCP server
- Pass service
- Showcase site
- Flows
- AWS architecture
- Security
- Data and privacy
- Quality
Key decisions
- Index
- Product and scope
- Architecture
- Infrastructure
- Passes and wallets
- Security and privacy
- Delivery and tooling
Developer guide
Operations
Runbooks
How it was built
Reference
Links