Orchestrator Python MCP Server
Enables AI coding assistants to run a machine-verified DESIGN→PLAN→EXECUTE→VERIFY→COMPLETE workflow with human approval gates, state integrity checks, and DAG task scheduling.
README
Orchestrate Python MCP Server
Machine-verified 4-phase workflow MCP server for AI coding assistants. Enforces DESIGN → PLAN → EXECUTE → VERIFY → COMPLETE with human approval gates, state integrity checks, and DAG task scheduling.
Quickstart
Installation & Run
# Sync environment
uv sync
# Run tests (Unit + 26 BDD Scenarios)
uv run pytest
# Start MCP server (stdio transport)
uv run python -m orchestrate_mcp.server
MCP Client Configuration
Example OpenCode config (opencode.json):
{
"mcp": {
"orchestrate": {
"type": "local",
"command": ["uv", "run", "--project", "/path/to/orchestrate", "python", "-m", "orchestrate_mcp.server"]
}
}
}
The server runs in stdio mode; cwd resolves to the session directory where the client launched the server. See the distribution guide for other clients (Claude Desktop, Cursor, Windsurf).
Table of Contents
- Workflow Lifecycle
- MCP Tools Reference
- Deliverable Requirements per Phase
- Example Deliverables
- Quickstart
Workflow Lifecycle
[Start] ──> orchestrate_init(task="...")
│
▼ (DESIGN Phase)
Write `.orchestrator/design.md`
│
▼
orchestrate_approve() ──> orchestrate_verify()
│
┌───────────────────────┘
▼ (PLAN Phase)
Write `.orchestrator/plan.md`
│
▼
orchestrate_approve() ──> orchestrate_verify()
│
┌───────────────────────┘
▼ (EXECUTE Phase)
orchestrate_get_dag_batches()
Subagents implement tasks & mark [x]
│
▼
orchestrate_verify()
│
▼ (VERIFY Phase)
orchestrate_verify() (runs automated test command)
│
▼ (COMPLETE Phase)
orchestrate_archive() ──> [Done]
MCP Tools Reference
| Tool Name | Parameters | Description |
|---|---|---|
orchestrate_init |
task_description: str |
Initializes new session in DESIGN phase, acquires atomic lock, returns initial SOP prompt. |
orchestrate_status |
(none) | Returns { active_session: bool, phase: str, message: str }. |
orchestrate_approve |
(none) | Human gate approval. Unlocks verification for DESIGN and PLAN phases. |
orchestrate_verify |
(none) | Validates phase deliverables. Advances to next phase on pass, returns next SOP prompt. |
orchestrate_get_dag_batches |
(none) | Parses plan.md tasks and returns ordered parallel batches with file collision guard. |
orchestrate_archive |
force: bool = True |
Releases lock and moves session files into .orchestrator/archive/<session_id>/. |
Deliverable Requirements per Phase
-
DESIGN Phase:
- Deliverable:
.orchestrator/design.md - Required Headings:
## Requirements,## Architecture,## Self-Confidence Audit. - Gate: Requires
orchestrate_approvebefore verification.
- Deliverable:
-
PLAN Phase:
- Deliverable:
.orchestrator/plan.md - Tasks Schema:
- [ ] **<id>**: <desc> (Agent: <role>, Target: <file>, blocked_by: [<deps>]) - Detailed Specs:
### <id>section for every task. - Final Barrier: Final task MUST be assigned to
Agent: implementation-reviewerblocked by all prior tasks. - Test Command: Valid executable
Test command: <cmd>under## Verification. - Gate: Requires
orchestrate_approvebefore verification.
- Deliverable:
-
EXECUTE Phase:
- Rule: All tasks in
.orchestrator/plan.mdmarked checked- [x]. - Rule: Target files must exist on disk and have size > 0 bytes.
- Rule: All tasks in
-
VERIFY Phase:
- Rule: Runs plan's test command via shell subprocess (120s timeout). Passes if exit code is 0.
Example Deliverables
Below are minimal, realistic examples demonstrating valid syntax and required structure for phase deliverables.
Example .orchestrator/design.md
# Design — Collinear-feature handling in corrected CFI estimators
## Goal
Fix `run_cfi_corrected` crash when input feature matrix contains near-collinear or duplicate pairs (`DatasetException: |rho|=1 is effectively 1`).
## Requirements
### Functional
| # | Requirement |
|---|---|
| F1 | `corrected_mutual_information(a, b)` returns `1.0` when pair is collinear (`rho**2 >= 1 - 1e-12`). |
| F2 | `corrected_variation_of_information(a, b)` returns `0.0` when pair is collinear. |
| F3 | `BaseCorrectedCfiConfig` gains opt-in `drop_collinear_features: bool = False`. |
### Non-Functional
- **No silent fallbacks**: Constant/NaN inputs still raise `DatasetException`.
- **Zero regression**: Unaffected estimator paths remain byte-identical.
## Architecture
```python
_EFFECTIVELY_COLLINEAR_RHO2 = 1 - 1e-12
def _is_effectively_collinear(rho: float) -> bool:
return rho**2 >= _EFFECTIVELY_COLLINEAR_RHO2
```
In `corrected_mutual_information`, short-circuit before histogram binning:
- If `np.isfinite(rho)` and `_is_effectively_collinear(rho)`: return `1.0`.
## Self-Confidence Audit
- Guessed paths: 0% (inspected `dependence.py`, `config.py`, `impl.py`)
- Unresolved assumptions: 0% (analytic limits Cover & Thomas Thm 2.4.1)
- Missed edge cases: 0% (constant inputs delegate to existing validation)
- Unchecked config: 0% (pydantic & numpy dependencies verified)
**Score: 97%** (>= 95% gate pass)
Example .orchestrator/plan.md
# Implementation Plan — Collinear-feature handling in corrected CFI estimators
## Overview
Implement 2-layer collinear handling: (1) estimator analytic limit guard in `dependence.py`, (2) opt-in feature dedup in `config.py` / `impl.py`.
## Tasks
- [ ] **T1**: Estimator guard in dependence.py (Agent: coder, Target: src/research/cfi/dependence.py, blocked_by: [])
- [ ] **T2**: Add drop_collinear_features config field (Agent: coder, Target: src/research/cfi/config.py, blocked_by: [])
- [ ] **T3**: Unit tests for collinear limits & config (Agent: tester, Target: tests/test_cfi.py, blocked_by: [T1, T2])
- [ ] **T4**: Final Implementation Verification Audit (Agent: implementation-reviewer, Target: .orchestrator/plan.md, blocked_by: [T1, T2, T3])
## Detailed Task Specifications
### T1: Estimator guard in dependence.py
- **Target**: `src/research/cfi/dependence.py`
- **Signatures & Contracts**:
- Add `_EFFECTIVELY_COLLINEAR_RHO2: float = 1 - 1e-12`
- Add `_is_effectively_collinear(rho: float) -> bool`
- Update `corrected_mutual_information(a: ArrayLike, b: ArrayLike, n_bins: int | None = None) -> float`
- **Old → New Implementation**:
```python
# Before
x, y = _as_paired_arrays(a, b)
hx, hy, hxy = _binning_and_entropies(x, y, n_bins)
# After
x, y = _as_paired_arrays(a, b)
if n_bins is None:
rho = float(np.corrcoef(x, y)[0, 1])
if np.isfinite(rho) and _is_effectively_collinear(rho):
return 1.0
hx, hy, hxy = _binning_and_entropies(x, y, n_bins)
```
- **Acceptance Criteria**:
- `corrected_mutual_information(2*a+1, a) == 1.0` without raising `DatasetException`.
### T2: Add drop_collinear_features config field
- **Target**: `src/research/cfi/config.py`
- **Signatures & Contracts**:
- Extend `BaseCorrectedCfiConfig(BaseModel)` with new schema fields.
- **Old → New Implementation**:
```python
# Before
class BaseCorrectedCfiConfig(BaseModel):
scoring: Any = log_loss
seed: int = 42
# After
class BaseCorrectedCfiConfig(BaseModel):
scoring: Any = log_loss
seed: int = 42
drop_collinear_features: bool = False
collinear_threshold: float = Field(default=0.999, ge=0.0, lt=1.0)
```
### T3: Unit tests for collinear limits & config
- **Target Test File**: `tests/test_cfi.py`
- **Test Scenarios**: MI limit = 1.0, VI limit = 0.0, validation constraint `lt=1.0`.
- **Copy-Paste Implementation**:
```python
def test_mi_collinear_returns_one():
a = np.arange(100.0)
b = 2.0 * a + 1.0
assert corrected_mutual_information(b, a) == pytest.approx(1.0)
def test_vi_collinear_returns_zero():
a = np.arange(100.0)
b = 2.0 * a + 1.0
assert corrected_variation_of_information(b, a, normalize=True) == 0.0
def test_collinear_threshold_validation():
with pytest.raises(ValidationError):
cfi_config("onc_vi", collinear_threshold=1.5)
```
### T4: Final Implementation Verification Audit
- **Target**: `.orchestrator/plan.md`
- **Verification Specialist Duties**:
- Inspect `git diff` against specifications in T1–T3.
- Verify all unit tests pass with zero regressions.
## File Inventory
| File | Status | Purpose |
|---|---|---|
| `src/research/cfi/dependence.py` | Modified | Add collinear short-circuit |
| `src/research/cfi/config.py` | Modified | Add `drop_collinear_features` schema field |
| `tests/test_cfi.py` | Modified | Collinear regression test suite |
## Verification
Test command: uv run pytest tests/test_cfi.py -v
## Confidence Self-Audit
- Guessed paths: 0%
- Unresolved assumptions: 0%
- Missed edge cases: 0%
- Unchecked config: 0%
**Score: 98%** (>= 95% gate pass)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。