This guide is for contributors and anyone running Motion MCP locally from source.
- Node.js 18 or newer (Node 20 recommended)
- npm (comes with Node)
- A Motion API key: https://app.usemotion.com/settings/api
# clone or open your local copy
# (replace the URL with your fork if contributing)
git clone https://github.com/devondragon/MotionMCP.git
cd MotionMCP
# install dependencies
npm install
# copy environment template and edit values
cp .env.example .env
# open .env and set MOTION_API_KEYImportant environment variables:
- MOTION_API_KEY: required for all requests
- MOTION_MCP_TOOLS: optional; controls which tool set is exposed (see below)
You can run in TypeScript dev mode (fast iteration) or build and run the compiled JS.
- Dev mode (ts-node):
npm run mcp:dev- Build, then run compiled:
npm run build
npm run mcpBoth commands start the MCP server on stdio (no HTTP port). Clients like Claude Desktop will launch it and communicate over stdio.
Set MOTION_MCP_TOOLS in your environment (for example in .env) to control the exposed tools:
- minimal — core consolidated tools only: motion_tasks, motion_projects, motion_workspaces
- essential (default) — consolidated tools plus commonly-used endpoints and helpers
- complete — all consolidated tools
- custom:tool1,tool2 — specify exactly which tools to enable
Examples:
# Only core consolidated tools
MOTION_MCP_TOOLS=minimal npm run mcp:dev
# Default set (explicit)
MOTION_MCP_TOOLS=essential npm run mcp
# Custom selection
MOTION_MCP_TOOLS=custom:motion_tasks,motion_projects,motion_search npm run mcp:devTo use your local build with Claude Desktop, add an entry to your Claude Desktop config. Recommended approach is direct node execution for maximum reliability.
- macOS config file path: ~/Library/Application Support/Claude/claude_desktop_config.json
Recommended (direct node execution):
{
"mcpServers": {
"motion": {
"command": "node",
"args": ["/absolute/path/to/your/MotionMCP/dist/mcp-server.js"],
"env": {
"MOTION_API_KEY": "your_api_key",
"MOTION_MCP_TOOLS": "essential"
}
}
}
}Alternative (npm - may have working directory issues):
{
"mcpServers": {
"motion": {
"command": "npm",
"args": ["run", "mcp"],
"cwd": "/absolute/path/to/your/MotionMCP",
"env": {
"MOTION_API_KEY": "your_api_key",
"MOTION_MCP_TOOLS": "essential"
}
}
}
}Setup steps:
- Build the project:
npm run build - Make the server executable:
chmod +x dist/mcp-server.js - Use absolute paths in your Claude Desktop config
- Restart Claude Desktop after config changes
Notes:
- The server communicates over stdio. There is no HTTP port to configure.
- Direct node execution is more reliable than npm in Claude Desktop's environment.
- Remember to rebuild (
npm run build) after making code changes.
The project also includes a Cloudflare Worker entry point (src/worker.ts) that exposes the same MCP tools over HTTP. This enables access from Claude mobile/web and ChatGPT — any client that supports remote MCP servers via Streamable HTTP or SSE.
- Cloudflare account (free tier works)
- Wrangler CLI (included as a dev dependency)
npm run worker:dev
# Starts at http://localhost:8787
# Uses MOTION_API_KEY from your .env file
# Test: curl http://localhost:8787/healthThe local dev server reads MOTION_MCP_SECRET from .env (or skips validation if not set). Set it to a test value like test-secret for local testing.
# Set secrets (prompted for values)
npx wrangler secret put MOTION_API_KEY
npx wrangler secret put MOTION_MCP_SECRET # generate with: openssl rand -hex 16
# Deploy
npm run worker:deployYour MCP URL will be: https://motion-mcp-server.YOUR_SUBDOMAIN.workers.dev/mcp/YOUR_SECRET
- Claude (web/mobile): Add the URL in claude.ai > Settings > Connectors. Syncs to mobile automatically.
- ChatGPT (web/mobile): Add the URL in Settings > Connectors.
The Worker uses a separate TypeScript config (tsconfig.worker.json) with ES modules and Workers types:
npm run worker:type-checkThis is separate from the main npm run type-check / npm run build which compiles the stdio server.
- The Worker reuses all existing handlers, services, tools, and utilities — it only differs in transport
McpAgentfrom the Cloudflare Agents SDK handles Streamable HTTP and SSE via Durable ObjectsMotionApiServicereceives the API key from Worker env bindings instead ofprocess.env- Tool JSON Schemas are converted to Zod schemas at init time (via
src/utils/jsonSchemaToZod.ts) becauseMcpServer.tool()requires Zod - Access is controlled by a secret token in the URL path — treat the full URL like a password
- Missing or invalid API key: verify MOTION_API_KEY is set (in your shell or .env).
- Typescript errors: run
npm run type-checkand fix issues before building. For Worker issues, also runnpm run worker:type-check. - No tools listed in client: check MOTION_MCP_TOOLS and that the client launched the expected script (mcp vs mcp:dev).
- Worker 404 on all requests: verify
MOTION_MCP_SECRETis set and matches the secret in your URL path. - Worker local dev issues: make sure
MOTION_API_KEYis in your.envfile.
Happy hacking! If you run into issues, open an issue or PR on GitHub.