src/— TypeScript sourcehandlers/resource handlers (tasks, projects, users, etc.) implementinghandle()tools/tool registry, configurator, and definitionsservices/Motion API client (motionApi.ts)utils/logging, validation, workspace resolution, caching, constantsschemas/request/response schemastypes/shared TypeScript types
dist/— compiled JS output.env.example— copy to.env; never commit secrets- Entry point:
src/mcp-server.ts(stdio MCP server)
npm run mcp:dev— run server via ts-node (fast dev)npm run build— compile TypeScript todist/npm run mcp— run compiled server (dist/mcp-server.js)npm run watch— incremental TypeScript compilationnpm run type-check— strict type/unused checks (no emit)- Optional (Cloudflare worker):
npm run worker:dev,npm run worker:deploy
- Language: TypeScript,
strictenabled (seetsconfig.json) - Indentation: 2 spaces; max 120 cols recommended
- Quotes: prefer single quotes; match surrounding file if inconsistent
- Naming:
PascalCaseclasses/types;camelCasevars/functions;UPPER_SNAKE_CASEconstants - Imports: absolute packages first, then relative modules; group by domain
- Error handling: return MCP-friendly errors via
formatMcpError; log withmcpLog
- Current: no test suite. At minimum run
npm run type-checkbefore PRs. - Suggested (future):
vitestwith files insrc/**/__tests__and coverage >80% for changed lines.
- Commits: Conventional Commits (e.g.,
feat(tools): add consolidated tasks,fix(handlers): null-safe workspace) - PRs must include:
- Clear description and rationale; reference issues (e.g.,
Closes #123) - Before/after behavior or example tool calls/args
- Checklist:
type-checkpasses, builds locally, no secrets committed
- Clear description and rationale; reference issues (e.g.,
- Keep changes focused; update docs if behavior or env changes (
README.md,DEVELOPER.md).
- Provide
MOTION_API_KEYvia env or.env; never log secrets - Choose tools via
MOTION_MCP_TOOLS(minimal,essential[default],complete, orcustom:...) - Server communicates over stdio; clients (e.g., Claude Desktop) launch it and pass env