MCP server (flightdeck-mcp.mjs) runs as a subprocess spawned by each agent.
It creates its own new Flightdeck() instance, directly accessing SQLite.
This causes:
- Two processes read/write the same DB with independent in-memory state
- DAG effectHandler (spawn_reviewer, etc.) only exists in gateway process
- Side effects from MCP calls (task_submit → spawn_reviewer) never fire
- Required orchestrator tick polling as a hack workaround
MCP server should be a thin HTTP client to the gateway:
Agent → MCP server (stdio) → HTTP → Gateway (single source of truth) → SQLite
Benefits:
- Single data path, no state divergence
- All side effects fire correctly (effectHandler in gateway)
- No need for polling hacks in orchestrator
- Gateway auth already exists (token-based)
- MCP server reads
FLIGHTDECK_URLenv (default: http://localhost:18800) - Each MCP tool maps to a gateway HTTP endpoint
- Agent identity passed via
FLIGHTDECK_AGENT_IDheader - Remove
new Flightdeck()from MCP server entirely
- POST /api/projects/:name/tasks/:id/claim → task_claim
- POST /api/projects/:name/tasks/:id/submit → task_submit
- POST /api/projects/:name/tasks/:id/complete → task_complete
- POST /api/projects/:name/tasks/:id/review → review_submit
- POST /api/projects/:name/tasks/:id/comment → task_comment
- GET /api/projects/:name/tasks → task_list
- POST /api/projects/:name/escalate → escalate
- POST /api/projects/:name/messages → msg_send
- GET /api/projects/:name/messages → msg_read