Skip to main content
Glama

motion-mcp

An MCP server that lets an AI assistant (ChatGPT, Claude, or any other MCP client) read and update tasks in Motion through the official Motion REST API. Retried requests never create duplicate tasks.

Status of this demo, stated up front. The recording below runs against the real Motion API (api.usemotion.com) in a Motion trial workspace created for this demo; every task it creates is prefixed DEMO. The MCP client is Claude Code, not ChatGPT: adding a custom MCP server with write access to ChatGPT needs a Business or Enterprise/Edu plan (quotes below). ChatGPT connects to the same /mcp URL. A mock of the Motion API (src/mock/motion-mock.ts) is used only by the tests.

Demo: Claude Code drives motion-mcp against the real Motion API

Full-quality video: demo/motion-mcp-demo.mp4 (80 s). Recorded on 5 December 2026. In the recording:

  1. The assistant lists open tasks, creates DEMO Review Motion MCP demo with client (LOW, due Dec 12), raises it to ASAP, moves the deadline to Dec 8 and completes it. The right-hand window is the server's live log: each Motion API call with its HTTP status.

  2. A new assistant session sends the same create request with the same idempotency key. The server returns the existing task (created: false), and Motion still has one such task.

  3. A scheduled run (cron, no chat open) calls the same MCP server and writes a report: demo/scheduled-report.sample.log.

  4. The server log shows one requestId per tool call, attached to every Motion HTTP call made for it: demo/server.sample.log. The whole run used 11 Motion API calls (10 x 200, 1 x 201), under the 12 requests per minute limit.

  5. The last ten seconds are Motion app screenshots before and after the run.

Tools

Tool

What it does

Motion API calls

list_tasks

Open tasks (or all with includeCompleted), optional name filter, limit

GET /v1/tasks (paginated by cursor)

create_task

Creates one task: name, required idempotencyKey, optional priority, dueDate, description

GET /v1/tasks?name=… (duplicate check), POST /v1/tasks

update_task

Changes priority, dueDate or name of one task, returns before and after

GET /v1/tasks/{id}, PATCH /v1/tasks/{id}

complete_task

Completes one task. Retrying is safe

GET /v1/tasks/{id}, GET /v1/statuses, PATCH /v1/tasks/{id}

There is no delete tool and no bulk tool, on purpose. An assistant can read, create one task, change one task or complete one task.

Priorities are Motion's: ASAP, HIGH, MEDIUM, LOW. dueDate accepts 2026-12-10 (read as 23:59 in DUE_DATE_TIMEZONE, default UTC) or a full ISO 8601 datetime.

Motion has no "complete" endpoint. A task is completed by moving it to a status with isResolvedStatus: true, which the server looks up through GET /v1/statuses?workspaceId=…. A task that is already completed is returned unchanged.

Related MCP server: usemotion-mcp-server

How duplicates are prevented

Motion's API has no idempotency header, so a timed-out and retried create would normally make a second task. create_task therefore requires an idempotencyKey chosen by the caller (for example dot-2026-12-05-weekly-report):

  1. The task carries its key. The key is written into the task description as a last line mcp-idempotency-key: <key>. Before creating, the server searches Motion for tasks with that name, completed ones included, and returns the one that carries the key. This check still works after a redeploy, with a lost local state, or with two server instances.

  2. A local journal (key -> task id, JSON file) answers repeats without a search. That matters under Motion's limit of 12 requests per minute on individual accounts.

  3. Two concurrent calls with the same key are serialized inside the process, so they cannot both create.

  4. Reusing a key for a different task (other name, priority, due date or description) is rejected instead of silently returning the wrong task.

  5. If the duplicate search cannot finish (more than 5 pages of tasks with that name), the server refuses to create rather than risk a duplicate.

Rate limits: 429 responses are retried with back-off and honour Retry-After. Motion documents "12 requests per minute" for individual accounts and "up to 120 requests per minute" for teams (rate limits).

Run it

Requires Node.js 20 or newer.

npm install
npm run build
npm test                       # 40 tests: idempotency, field mapping, MCP over HTTP

# Against real Motion ("Log into Motion and under the Settings tab, create an API key")
export MOTION_API_KEY=...      # never commit it; read from the environment only
export MOTION_WORKSPACE_ID=... # optional if the account has exactly one workspace
export MCP_AUTH_TOKEN=$(openssl rand -hex 32)   # optional, see "Authentication"
npm start                      # streamable HTTP on http://127.0.0.1:8787/mcp

# Or against the bundled mock (used by the tests), no Motion account needed
MOTION_API_KEY=mock-key npm run mock &          # mock API on :8790, board on http://127.0.0.1:8790/
MOTION_API_KEY=mock-key MOTION_BASE_URL=http://127.0.0.1:8790/v1 npm start

Variable

Default

Meaning

MOTION_API_KEY

(required)

Sent as the X-API-Key header

MOTION_BASE_URL

https://api.usemotion.com/v1

Point at the mock for testing

MOTION_WORKSPACE_ID

first workspace if there is exactly one

Workspace the tools work in

MCP_AUTH_TOKEN

unset (no auth)

When set, clients must send Authorization: Bearer <token>

ALLOWED_HOSTS

127.0.0.1:PORT,localhost:PORT,[::1]:PORT

Accepted Host values; set to your public host[:port] when deployed

ALLOWED_ORIGINS

unset (any browser Origin refused)

Browser origins allowed to call /mcp

DUE_DATE_TIMEZONE

UTC

IANA zone for bare dates: 2026-12-12 means 23:59 there

IDEMPOTENCY_JOURNAL

.journal/idempotency.json

Local journal file

PORT, HOST

8787, 127.0.0.1

HTTP listen address

Connect an assistant

Claude Code (what the recording uses):

claude mcp add --transport http motion https://your-host/mcp --header "Authorization: Bearer $MCP_AUTH_TOKEN"

Claude Desktop or any stdio client: run node dist/src/stdio.js with the same environment variables.

ChatGPT: add a custom MCP server with the public HTTPS URL ending in /mcp. OpenAI's docs: "Supported MCP protocols: SSE and streaming HTTP" (developer mode guide), and "For a public endpoint, enter the MCP server URL, including the /mcp path" (connect from ChatGPT). ChatGPT cannot reach localhost: "Can I connect to a local MCP server? Not directly." (help article 12584461). Deploy the server behind HTTPS, or use OpenAI's Secure MCP Tunnel.

Authentication

The built-in bearer token suits Claude Code, the cron job and server-to-server use. ChatGPT's documented options are different: "Authentication options include OAuth, No authentication, and OAuth or no authentication" (developer mode guide). A static bearer token is not in that list. For ChatGPT the choice is:

  • No authentication: acceptable only for a short test with a throwaway Motion workspace, because anyone who learns the URL can change tasks.

  • OAuth 2.1 in front of the server: the production setup, planned for Phase 2.

Independently of the token, /mcp refuses requests whose Host header is not in ALLOWED_HOSTS or that carry a browser Origin not in ALLOWED_ORIGINS. This blocks DNS-rebinding attacks, where a web page open in your browser tries to reach a server on localhost.

Scheduled run without a chat

src/scheduled-report.ts is a plain MCP client. It connects to the same /mcp endpoint the assistant uses, calls list_tasks, and appends a summary (open, overdue, ASAP/HIGH) to a log file. It exits non-zero on failure, so the scheduler can alert.

0 8 * * 1-5  cd /srv/motion-mcp && MCP_URL=https://your-host/mcp MCP_AUTH_TOKEN=... npm run -s report

Logs

JSON lines on stderr, one requestId per tool call, repeated on every Motion HTTP call made for it:

{"ts":"…","level":"info","event":"motion.http","requestId":"9227c875-…","tool":"complete_task","method":"PATCH","path":"/v1/tasks/tk_2bedca2f5411","status":200,"ms":3,"attempt":0}

The API key is never logged. The requestId is also returned to the assistant in every tool result, so a chat answer can be matched to the server log.

Dot and custom MCP: what OpenAI docs say today

Checked on 5 December 2026 against OpenAI's own pages.

  • Which plans can add a custom MCP server with write tools. "Custom MCP server connections and full MCP support are available for ChatGPT Business and Enterprise/Edu customers on ChatGPT web." And: "Pro users can connect custom MCP servers with read/fetch permissions." (help article 12584461, updated about 2 December 2026). The article does not mention Plus or Free. For a Business workspace: "Only admins and owners can create and publish plugins for custom MCP servers."

  • Write actions. "Any tools your app exposes (including write actions) are available, subject to confirmation settings." ChatGPT "may ask for confirmation" before write actions, and "Some especially risky actions may be blocked instead of being presented for approval."

  • Dots. OpenAI introduced dots on 29 September 2026 (introducing dots) and on 2 December 2026 said: "Dots are now available globally on Plus, Pro, Business Standard, and Business Premium plans and are enabled by default on ChatGPT Enterprise" (bringing dots to more people). These pages say dots work with apps the user allows: "You choose which apps dots can access". None of OpenAI's pages on dots that I read mention custom MCP servers.

  • Scheduled tasks. OpenAI documents scheduled and event-triggered tasks, the latter for "supported Gmail, Slack, or GitHub activity". I found no statement that a scheduled task or a dot can call tools on a custom MCP server.

What to check on your plan before relying on it: (1) on Business or Enterprise, add this server under Plugins → Add custom MCP server and confirm a dot can use it; (2) on Pro, expect only list_tasks to be usable, since write tools are read/fetch-restricted; (3) whether a scheduled dot run can call it without a chat open. If (3) does not work, the cron runner in this repo produces the scheduled report independently of ChatGPT.

Limits of this demo

  • Run against a real Motion trial workspace, not yours. These points were confirmed live on 5 December 2026 and the code follows them:

    • The resolved status is named Completed; the server still finds it by the isResolvedStatus flag, not by name.

    • GET /v1/statuses returns a plain array.

    • PATCH /v1/tasks/{id} rejects workspaceId with HTTP 400 property workspaceId should not exist, although the API reference marks it required. The server does not send it. The first live run caught this; the mock now behaves the same way.

    • Descriptions go in as Markdown and come back as HTML; the idempotency marker is still found.

  • A bare due date used to be sent as 23:59 UTC, which is already the next day in Europe (Motion showed 2026-12-12 as Dec 13). It is now 23:59 in DUE_DATE_TIMEZONE. The recording was made before this fix; its dates are shown in UTC.

  • Not tested in ChatGPT or in a dot (see the section above for why).

  • The duplicate check matches by task name plus key. If someone renames the task in Motion and then the original create is retried, the journal still catches it, but a fresh server with an empty journal would not.

  • The local journal is a file. Several instances behind a load balancer should share it (Redis or a database) or rely on the Motion-side marker alone.

Phase 2

  • Run the same demo against your real Motion workspace and your Dot / ChatGPT plan, with screenshots before and after each change.

  • OAuth 2.1 in front of the server for ChatGPT, plus deployment on your infrastructure (one small server or serverless function).

  • Failure alerts (scheduler exit code and Motion error rates), shared journal for multiple instances, key-rotation and troubleshooting docs.

  • More Motion fields if you need them: projects, labels, assignees, auto-scheduling.

Project layout

src/motion/client.ts     Motion REST client (X-API-Key, 429 back-off, no delete/bulk methods)
src/service.ts           Task logic: idempotent create, update, complete, list
src/idempotency.ts       Key marker, journal, per-key lock
src/mcp.ts               The four MCP tools, request ids, error mapping
src/http.ts              Streamable HTTP server on /mcp (stateless), /healthz
src/stdio.ts             stdio entry point
src/scheduled-report.ts  Cron runner: MCP client that writes a report
src/mock/motion-mock.ts  Mock of the Motion API for tests and demos
test/                    node:test suites
demo/                    Recording, sample logs, transcript renderer

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers