MCPOrchestrator

MCPOrchestrator is a local-first AI orchestration bridge that connects:
- ChatGPT, Claude, or Gemini Web (for planning and independent verification) via a Manifest V3 browser extension,
- Any MCP-compatible AI coding agent (Antigravity, Cursor, Claude Code, etc.) via a standard stdio FastMCP server, and
- A FastAPI + SQLite orchestrator that manages tasks, leases, retries, and event history on
127.0.0.1:18421.
Quick Start (pip install mcporch)
# 1. Install the package
pip install mcporch
# 2. Extract Chromium & Firefox extensions + print MCP config
mcporchestrator setup
# 3. Start the local server (or run: mcporchestrator install-service)
mcporchestrator start
Architecture
+-------------------+ HTTP (127.0.0.1:18421) +------------------------+
| FastAPI Backend | <-------------------------------> | Browser Extension |
| + SQLite Queue | GET /bridge/next | (Chromium / |
| (backend/app.py) | POST /bridge/response | Firefox/Safari) |
+-------------------+ POST /bridge/release +-----------+------------+
^ |
| HTTP (httpx) | DOM Automation
v v
+-------------------+ stdio (MCP) +------------------------+
| FastMCP Server | <-------------------------------> | https://chatgpt.com/ |
| (mcp-server/ | mcporch_get_task | (Logged-in Session) |
| server.py) | mcporch_heartbeat +------------------------+
+-------------------+ mcporch_submit_result
^
|
v
+-------------------+
| MCP AI Client |
| (Any MCP-Enabled |
| Coding Agent) |
+-------------------+
Task Lifecycle
- Create task (
POST /tasks): Stores the task in SQLite (status = planning) and queues a plan prompt in bridge_queue.
- ChatGPT planning: The browser extension polls
GET /bridge/next, injects the prompt into an open, empty chatgpt.com composer, submits it, waits for streaming completion, and posts the plan to POST /bridge/response (status = agent_pending).
- Agent execution: Your MCP-enabled AI tool calls
mcporch_get_task (GET /agent/next), receives the plan and a 15-minute lease_token, implements and tests the work locally, optionally extends the lease via mcporch_heartbeat, and submits evidence via mcporch_submit_result (POST /agent/report, status = verifying).
- Independent verification: MCPOrchestrator queues a
verify prompt for ChatGPT containing the acceptance criteria and execution report. ChatGPT returns a structured JSON verdict:
PASS (all criteria explicitly PASS) → complete
NEEDS_REWORK → increments retry_count (up to MAX_RETRIES, default 3) and returns to agent_pending with corrective instructions; exceeds max retries → failed
FAIL / unparseable verdict → manual_review
Important Boundary
- The browser extension automates the
https://chatgpt.com/ web UI; it is not an official ChatGPT API and relies on page DOM selectors.
- Keep one
chatgpt.com tab open, logged in, visible, and with an empty composer when running tasks.
- Do not use this tool to bypass authentication, CAPTCHAs, rate limits, or security prompts.
Project Structure
MCPOrchestrator/
├── mcp-server/
│ ├── requirements.txt # MCP server Python dependencies (mcp, httpx)
│ └── server.py # Stdio FastMCP server exposing MCPOrchestrator tools
├── backend/
│ ├── __init__.py
│ └── app.py # FastAPI orchestrator, SQLite schema, lease & retry logic
├── chromium-extension/ # Manifest V3 extension for Chromium browsers (v1.0.0)
│ ├── background.js # Service worker: localhost API proxy & tab lock cleanup
│ ├── bridge_utils.js # ProseMirror extraction, prompt verification, state machine
│ ├── content.js # ChatGPT DOM lifecycle, insertion, submission, capture
│ ├── coordinator.js # Serialized cross-tab lock & bounded retry/backoff tracker
│ └── manifest.json
├── firefox-extension/ # Manifest V3 extension for Firefox 109+ (v1.0.0)
│ ├── background.js
│ ├── bridge_utils.js
│ ├── content.js
│ ├── coordinator.js
│ └── manifest.json
├── tests/
│ ├── bridge.test.js # Extension unit tests (Node.js built-in node:test)
│ └── test_backend.py # Backend API & lease tests (Python unittest)
├── CONTRIBUTING.md
├── LICENSE # MIT License
├── README.md
└── requirements.txt # Backend Python dependencies
Prerequisites
- OS: Linux, macOS, or Windows
- Python: 3.11 or newer (
python3 --version / python --version)
- Node.js: 20 or newer (
node --version) — only needed to run extension unit tests and syntax checks
- Browser:
- Chromium-based: any Chromium-based browser
- Firefox 109+
- Safari (macOS, via Apple's web extension converter)
- AI Client: Any tool supporting MCP over stdio (any MCP-compatible AI coding client, etc.)
Step 1 — Backend Setup
1.1 Clone the repository
git clone https://github.com/engineertechlabs/MCPOrchestrator.git
cd MCPOrchestrator
1.2 Create a Python virtual environment and install dependencies
Linux / macOS:
# Create an isolated virtual environment inside .venv/
python3 -m venv .venv
# Activate the virtual environment in your current shell
source .venv/bin/activate
# Install FastAPI, Uvicorn, Pydantic, and HTTPX
pip install -r requirements.txt
Windows (PowerShell):
# Create an isolated virtual environment inside .venv\
python -m venv .venv
# Activate the virtual environment in PowerShell
.\.venv\Scripts\Activate.ps1
# Install FastAPI, Uvicorn, Pydantic, and HTTPX
pip install -r requirements.txt
1.3 Start the FastAPI backend (CLI or OS background service)
You can run the generalized CLI directly via python -m backend.cli (or install mcporchestrator into your venv with pip install -e .):
# Start in the foreground (Linux, macOS, Windows)
python -m backend.cli start
Or install it as a native user-level background service (no sudo or Administrator rights required):
- Linux:
~/.config/systemd/user/mcporchestrator.service (systemd --user)
- macOS:
~/Library/LaunchAgents/com.mcporchestrator.server.plist (launchd)
- Windows:
MCPOrchestratorServer in Task Scheduler (ONLOGON via pythonw.exe)
# Install and start the background service
python -m backend.cli install-service
# Check server health
python -m backend.cli status
# Stop and remove the background service
python -m backend.cli uninstall-service
(You can also pass --port, --host, --reload, or --dry-run on install-service / uninstall-service.)
Optional environment variables:
| Variable |
Default |
Purpose |
MCPORCH_DB |
backend/mcporchestrator.sqlite3 |
Custom path for the SQLite database file |
MCPORCH_PORT |
18421 |
Local HTTP port for the backend |
MCPORCH_API_TOKEN |
(empty) |
Optional shared secret token (X-MCPOrchestrator-Token / Bearer) |
MCPORCH_MAX_RETRIES |
3 |
Maximum automatic NEEDS_REWORK retries per task |
1.4 Verify the backend is running
curl -s http://127.0.0.1:18421/health
Expected output:
{"ok":true,"service":"mcporchestrator","version":"1.0.0"}
Interactive Swagger API docs are also available at http://127.0.0.1:18421/docs.
Step 2 — Browser Extension Setup
Option A: Chromium-based browsers (any Chromium-based browser)
- Open your browser's extension page:
- Chromium:
chrome://extensions (or brave://extensions / edge://extensions)
- Brave:
brave://extensions
- Edge:
edge://extensions
- Enable Developer mode (top-right toggle).
- Click Load unpacked and select the
chromium-extension/ folder inside MCPOrchestrator.
- Open
https://chatgpt.com/, log in, and open a conversation with an empty composer.
Option B: Firefox (109+)
- Open
about:debugging#/runtime/this-firefox.
- Click Load Temporary Add-on....
- Select
firefox-extension/manifest.json inside MCPOrchestrator.
- Open
https://chatgpt.com/, log in, and keep that tab visible with an empty composer.
Option C: Safari (macOS)
Convert the Chromium extension into a Safari Web Extension Xcode project:
xcrun safari-web-extension-converter chromium-extension/
Build and enable the resulting extension in Safari Settings → Extensions, granting access to chatgpt.com and 127.0.0.1.
Multi-Tab & Draft Safety Behavior
- Only one
chatgpt.com tab can acquire the processing lock (chrome.storage.session, 60s TTL, 20s heartbeat) at a time.
- Hidden/background tabs and tabs with an existing user draft or attachment are skipped automatically and never overwritten.
- Closing, reloading, or navigating away from the active tab releases the lock immediately.
Step 3 — MCP Server Setup (Any MCP-Compatible AI Tool)
3.1 Install MCP server dependencies
With your .venv activated:
pip install -r mcp-server/requirements.txt
3.2 Add MCPOrchestrator to your AI tool's MCP configuration
Replace /ABSOLUTE/PATH/TO/MCPOrchestrator with the full path to your cloned folder.
Linux / macOS:
{
"mcpServers": {
"mcporchestrator": {
"command": "/ABSOLUTE/PATH/TO/MCPOrchestrator/.venv/bin/python",
"args": ["/ABSOLUTE/PATH/TO/MCPOrchestrator/mcp-server/server.py"],
"env": {
"MCPORCH_URL": "http://127.0.0.1:18421"
}
}
}
}
Windows (use double backslashes \\ in JSON):
{
"mcpServers": {
"mcporchestrator": {
"command": "C:\\ABSOLUTE\\PATH\\TO\\MCPOrchestrator\\.venv\\Scripts\\python.exe",
"args": ["C:\\ABSOLUTE\\PATH\\TO\\MCPOrchestrator\\mcp-server\\server.py"],
"env": {
"MCPORCH_URL": "http://127.0.0.1:18421"
}
}
}
}
Where to place this config:
- Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
- Cursor / Windsurf / Cline / Claude Code: Add the
mcporchestrator block to your tool's mcpServers JSON configuration.
Restart or reload your AI tool's MCP servers and confirm these 8 tools appear:
mcporch_create_task — Create a new task and queue its planning prompt
mcporch_wait_for_task — Wait until a task reaches agent_pending or a terminal status
mcporch_task_status — Check task status, plan, report, and verification verdict
mcporch_list_tasks — List recent tasks
mcporch_cancel_task — Cancel an active task (manual_review)
mcporch_get_task — Lease the next agent_pending task (optionally filtered by project_path)
mcporch_heartbeat — Extend the active execution lease
mcporch_submit_result — Submit execution summary and test evidence for verification
Step 4 — End-to-End Usage Walkthrough
4.1 Create a task
Linux / macOS:
curl -X POST http://127.0.0.1:18421/tasks \
-H 'Content-Type: application/json' \
-d '{
"title": "Add authentication",
"project_path": "/home/USER/projects/example",
"objective": "Implement registration, login, logout and password reset.",
"acceptance_criteria": [
"Registration validates email and password",
"Login creates a secure session",
"Logout invalidates the session",
"Automated tests cover success and failure cases"
]
}'
Windows (PowerShell):
$body = @{
title = "Add authentication"
project_path = "C:\Users\USER\projects\example"
objective = "Implement registration, login, logout and password reset."
acceptance_criteria = @(
"Registration validates email and password",
"Login creates a secure session",
"Logout invalidates the session",
"Automated tests cover success and failure cases"
)
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:18421/tasks" -ContentType "application/json" -Body $body
4.2 Let ChatGPT plan
Keep your chatgpt.com tab visible with an empty composer. Within ~3 seconds, the extension injects the planning prompt, submits it, waits for ChatGPT to finish generating, and posts the plan back to MCPOrchestrator (status becomes agent_pending).
4.3 Execute with your MCP AI agent
Prompt your MCP-connected AI agent:
Check the MCPOrchestrator MCP tools. Call mcporch_get_task and follow the returned task, plan, and acceptance criteria. Inspect the project before editing, create a Git checkpoint before changes, implement the task, run real tests, and call mcporch_submit_result with the summary, test evidence, unresolved issues, and changed files. Use mcporch_heartbeat if execution takes longer than 10 minutes.
4.4 Inspect task state and event history
# List recent tasks
curl -s http://127.0.0.1:18421/tasks | python3 -m json.tool
# Inspect a specific task (including plan, execution_report, and verification verdict)
curl -s http://127.0.0.1:18421/tasks/<TASK_ID> | python3 -m json.tool
# Inspect the full event audit trail
curl -s http://127.0.0.1:18421/tasks/<TASK_ID>/events | python3 -m json.tool
API Reference