# Plan
## Goal
Implement the MCP stdio server described in README.md and docs/api.md, including config validation, Rails API client, MCP tools, and required tests (unit, integration, e2e).
## Impacted files
- package.json (scripts, bin, dependencies)
- tsconfig.json
- src/index.ts
- src/server.ts
- src/config.ts
- src/rails/client.ts
- src/tools/*.ts
- test/unit/*.test.ts
- test/integration/*.test.ts
- test/e2e/*.test.ts
- README.md (only if needed for corrections)
## Steps
1) Confirm approach and dependencies to add (TypeScript, MCP SDK), and confirm test strategy and required env vars (base URL, token, user slug).
2) Write failing tests for:
- unit: env validation, URL composition, error mapping
- integration: real API calls for start/state/open/flag/chord/end
- e2e: full flow from start to end using live server
3) Implement config, Rails client, tool handlers, and MCP server to satisfy README/API spec.
4) Run tests, refactor as needed, update issue status, and perform session wrap-up steps.