MCP server: connect, authenticate and read the Project #188

Closed
opened 2026-10-11 06:52:14 +00:00 by crowmaki · 0 comments
Owner

Parent

#157

What to build

The first slice of the MCP server. A harness can connect to the running app, authenticate and read the open Project. Everything later slices need is in place.

  • The server runs in the Tauri adapter layer on the app's existing Tokio runtime and holds a clone of the same ApiImpl the windows use, so it shares the session, the Render worker, the undo log and the change hooks (ADR-0003). rmcp is pinned to an exact version.
  • Streamable HTTP on 127.0.0.1 only. Requests without the bearer token are refused, and so are requests whose Origin is not a loopback origin.
  • App-wide MCP settings (on/off, default off; port; token) are kept with the other App settings, outside any Project's undo log. An ApiImpl command reads and changes them, and a change restarts the listener. The UI comes in a later ticket.
  • On initialize, the server sends instructions: the pipeline order, the key glossary terms, and the rule that only Lock snapshots feed production.
  • A CommandError becomes a tool error (isError) with the app's message and kind, never a protocol error. Invalid enum inputs list the valid values.
  • Tools: get_project (title, path, aspect ratio, spoken language, image model, Generation profile), undo, redo and undo_state. With no Project open, each Project tool fails with a clear "no Project open" error.
  • A test harness that starts the server in-process on an ephemeral loopback port over an ApiImpl with a temp config dir and fake-comfy, and connects a real rmcp client. Later slices reuse it.

Acceptance criteria

  • A missing or wrong token is refused, and so is a non-loopback Origin
  • The server instructions are present on initialize
  • get_project fails with "no Project open" when none is open, and returns the Project when one is
  • An edit made through ApiImpl, then undone through MCP, reverts and emits a ChangedDto event; undo_state reports it
  • Excluded commands (Purge, Compact, emptying _Removed/, deleting Source sheets, window commands, Board editing) are absent from tools/list
  • The server is off by default, and turning it on or changing the port through the settings command restarts the listener

Blocked by

  • None (can start immediately)
## Parent #157 ## What to build The first slice of the MCP server. A harness can connect to the running app, authenticate and read the open Project. Everything later slices need is in place. - The server runs in the Tauri adapter layer on the app's existing Tokio runtime and holds a clone of the same `ApiImpl` the windows use, so it shares the session, the Render worker, the undo log and the change hooks (ADR-0003). `rmcp` is pinned to an exact version. - Streamable HTTP on `127.0.0.1` only. Requests without the bearer token are refused, and so are requests whose `Origin` is not a loopback origin. - App-wide MCP settings (on/off, default off; port; token) are kept with the other App settings, outside any Project's undo log. An `ApiImpl` command reads and changes them, and a change restarts the listener. The UI comes in a later ticket. - On initialize, the server sends instructions: the pipeline order, the key glossary terms, and the rule that only Lock snapshots feed production. - A `CommandError` becomes a tool error (`isError`) with the app's message and kind, never a protocol error. Invalid enum inputs list the valid values. - Tools: `get_project` (title, path, aspect ratio, spoken language, image model, Generation profile), `undo`, `redo` and `undo_state`. With no Project open, each Project tool fails with a clear "no Project open" error. - A test harness that starts the server in-process on an ephemeral loopback port over an `ApiImpl` with a temp config dir and `fake-comfy`, and connects a real `rmcp` client. Later slices reuse it. ## Acceptance criteria - [ ] A missing or wrong token is refused, and so is a non-loopback `Origin` - [ ] The server instructions are present on initialize - [ ] `get_project` fails with "no Project open" when none is open, and returns the Project when one is - [ ] An edit made through `ApiImpl`, then undone through MCP, reverts and emits a `ChangedDto` event; `undo_state` reports it - [ ] Excluded commands (Purge, Compact, emptying `_Removed/`, deleting Source sheets, window commands, Board editing) are absent from `tools/list` - [ ] The server is off by default, and turning it on or changing the port through the settings command restarts the listener ## Blocked by - None (can start immediately)
crowmaki referenced this issue from a commit 2026-10-11 07:12:27 +00:00
Sign in to join this conversation.
No description provided.