intervals-icu-mcp
CLAUDE.md0 starsChanged 50 days agoMITView on GitHub
Guidance for AI coding assistants working in this repository. An open-source MCP server for Intervals.icu, written in TypeScript on the official MCP SDK v2 (@modelcontextprotocol/server). It is published publicly, so code, docs and commit messages are in English and should be ready for contributors. - npm run check: lint + typecheck + tests + build. Run it before every commit. - npm test / npm run test:watch: Vitest. - npm run lint:fix: apply Biome formatting and safe lint fixes. -…
- Reads credentials
In this repository3 other files it gives its agents.
- .github/CLAUDE.mdCLAUDE.md
- .github/ISSUE_TEMPLATE/CLAUDE.mdCLAUDE.md
- .github/workflows/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Every API operation must be accounted for (tests/unit/coverage.test.ts): a dedicated tool, the opt-in api_get for reads, or a reason in …
- Very specific: line 59
Write behaviour verified live (see tests/live/write.test.ts, run with LIVE_WRITE=1):
- Distinctive: line 82
Test fixtures must be anonymised.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Guidance for AI coding assistants working in this repository.
Project
An open-source MCP server for Intervals.icu, written in TypeScript on the official MCP SDK v2
(@modelcontextprotocol/server). It is published publicly, so code, docs and commit messages
are in English and should be ready for contributors.
Commands
npm run check: lint + typecheck + tests + build. Run it before every commit.npm test/npm run test:watch: Vitest.npm run lint:fix: apply Biome formatting and safe lint fixes.npm run inspect: build and open the MCP Inspector (loads.env).npm run test:live: read-only smoke tests against the real API (needs.env). SetLIVE_OUTPUT=/tmp/out.txtto capture the raw tool outputs.npm run docs:generate: regeneratedocs/tools.mdanddocs/coverage.mdafter changing tools (CI checks this).npm run openapi:update/openapi:generate: refresh the spec snapshot / regeneratesrc/api/schema.d.ts. Never edit the generated file by hand.
Architecture rules
createServer()insrc/server.tsis transport-agnostic. It is used by stdio (src/index.ts), by the in-memory e2e tests, and later by HTTP. Do not put transport or process concerns in it.- Never write to stdout (
console.log,process.stdout). stdout carries the MCP protocol over stdio. Useconsole.error. Biome enforces this. - Every API operation must be accounted for (
tests/unit/coverage.test.ts): a dedicated tool, the opt-inapi_getfor reads, or a reason insrc/tools/coverage.ts. The weeklyspec-driftworkflow opens a PR when the upstream spec changes. - Tools are hand-designed, not generated 1:1 from OpenAPI. Each tool declares:
- its toolset,
- its access level (
read/write/destructive), - the
operations(OpenAPI operationIds) it covers, which feed the coverage report.
- Tools outside the configured write mode are not registered at all.
- Return errors from tools as
isError: truewith an actionable message. Never include the API key in any log or error text. - Tool output should be compact and LLM-friendly: human-readable units (pace in min/km, durations in h:mm:ss), limits, and explicit truncation notes.
- Domain gotchas:
- Speeds from the API are in m/s.
- Pace units are set per sport (
pace_units). - Running cadence is stored per leg, so double it to get spm.
- Pace zones are % of threshold speed, so higher % means a faster pace.
- Form-% zones are meaningless at very low CTL.
athlete-summaryalso returns followed athletes.
The spec is not always accurate. Verify shapes against the live API (
npm run test:live) before trusting them. Known gaps so far:- Histogram buckets are
{min, max, secs}. - Stream
datais an array. getActivityonly documents adefaultresponse.- Curve params
f1–f3are marked as required but are optional.
Patches to the spec itself belong in
scripts/update-openapi.ts; other mismatches are typed locally with a comment.- Histogram buckets are
- Write behaviour verified live (see
tests/live/write.test.ts, run withLIVE_WRITE=1):PUTmerges the given fields.nullis ignored, so fields cannot be cleared with it. Wellness ratings clear with 0 and comments with""; measurements cannot be cleared.- Client-provided event
uids are ignored, soupsertOnUidcannot deduplicate.create_eventschecks for duplicates itself. - Manual activities and
mark-donefail with 422 for future dates. replacefor gear only works for components;component: trueon create is ignored.- Event/workout
apply-planputs plan workouts on start date +day.duplicate-workoutsadds copies 7 days later per week. - Workout text is parsed server-side into
workout_doc. Unparseable text is still accepted, with 0 steps. 400mmeans minutes (meters are400mtr), bpm ranges are not parsed, and inline3x5mrepeats are not supported.
- Live write tests only create objects named
[mcp-test] …on far-future dates, or on 2020-01-01 for activities, and sweep them afterwards. Never write to real dates of the user's account in tests.
Conventions
- ESM + TypeScript strict (
exactOptionalPropertyTypes,noUncheckedIndexedAccess). - Relative imports use the
.jsextension. - Conventional Commits (
feat(scope): …,fix: …,chore(deps): …). release-please generates versions and the changelog from them. - Test fixtures must be anonymised. No real API keys or personal data in the repo.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

