dev-loop-mcp
dev-loop-mcp
一个运行 AI 驱动的 TDD 开发循环的 MCP (Model Context Protocol) 服务器。它将开发循环状态机通用化,通过简单的配置文件即可适用于任何项目。
功能概述
提供两种循环类型——两者共享相同的 TDD 流水线;区别仅在于任务的生成方式:
flowchart LR
subgraph start_loop["start_loop (feature)"]
direction LR
A("description<br/>or tasks") --> B["DECOMPOSE<br/>AI breaks into tasks"]
B --> C[/"tasks"/]
end
subgraph start_debug_loop["start_debug_loop (bug)"]
direction LR
D("symptom<br/>+ context files") --> E["DIAGNOSE<br/>AI ranks hypotheses"]
E --> F[/"tasks"/]
end
C --> Pipeline["TDD pipeline"]
F --> Pipeline
subgraph Pipeline["Shared TDD pipeline"]
direction LR
I[INIT] --> T[TDD_LOOP<br/>per task]
T --> Bu[BUILD]
Bu --> De[DEPLOY<br/>optional]
De --> It[INTEG_TEST<br/>optional]
It -->|pass| Qr[QUALITY_REVIEW]
It -->|fail| If[INTEG_FIX<br/>up to 5×]
If --> Qr
Qr --> Ct[CLEAN_TREE<br/>CHECK]
Ct --> Pr[PUSH_AND_PR]
Pr --> Done(["✓ DONE<br/>PR opened"])
end完整状态机
flowchart TD
start_loop --> INIT
start_debug_loop -->|"DIAGNOSE:<br/>ranked hypotheses → tasks"| INIT
INIT -->|"pre-loaded tasks"| TDD_LOOP
INIT -->|"description only"| DECOMPOSE
DECOMPOSE -->|"AI → Task[]"| TDD_LOOP
TDD_LOOP -->|"task done, more remain"| TDD_LOOP
TDD_LOOP -->|"all tasks done"| BUILD
TDD_LOOP -->|"task failed"| FAILED
BUILD -->|pass| DEPLOY
BUILD -->|fail| FAILED
DEPLOY -->|"pass / skipped"| INTEG_TEST
DEPLOY -->|fail| FAILED
INTEG_TEST -->|"pass / skipped"| QUALITY_REVIEW
INTEG_TEST -->|fail| INTEG_FIX
INTEG_FIX -->|fixed| QUALITY_REVIEW
INTEG_FIX -->|"still failing<br/>(retry, max 5)"| INTEG_FIX
INTEG_FIX -->|"5 attempts exhausted"| FAILED
QUALITY_REVIEW --> CLEAN_TREE_CHECK
CLEAN_TREE_CHECK --> PUSH_AND_PR
PUSH_AND_PR --> DONE
DONE(["✓ DONE"])
FAILED(["✗ FAILED"])
style DONE fill:#22c55e,color:#fff
style FAILED fill:#ef4444,color:#fff
style start_loop fill:#6366f1,color:#fff
style start_debug_loop fill:#f59e0b,color:#fff任务级 TDD 循环
TDD_LOOP 中的每个任务都会运行此内部循环(最多 5 次编码迭代):
flowchart LR
A["Write scenarios<br/>scenarios/scenarios-*.md"] --> B["Write failing tests<br/>*.test.ts"]
B --> C{"Tests<br/>fail?"}
C -->|"no — tester error"| Z["✗ task failed"]
C -->|yes| D["Implement"]
D --> E{"Tests<br/>pass?"}
E -->|yes| F["✓ commit & next task"]
E -->|"no (retry)"| D阶段参考:
INIT: 创建 git 分支
DECOMPOSE: AI 将描述转换为
Task[]DIAGNOSE: (仅限调试循环) AI 读取症状和上下文文件,并生成按优先级排序的根本原因假设作为
Task[]TDD_LOOP: 针对每个任务:场景 → 失败测试 → 实现(每个任务最多 5 次编码迭代)
BUILD: 运行
buildCommandDEPLOY: 运行
deployCommand— 若未配置则跳过INTEG_TEST: 运行
integTestCommand— 若未配置则跳过INTEG_FIX: AI 诊断并修复集成测试失败(最多 5 次尝试)
QUALITY_REVIEW: AI 审查完整的分支差异并应用质量修复
CLEAN_TREE_CHECK: 自动提交所有未提交的文件
PUSH_AND_PR: 推送分支并打开 GitHub PR
Related MCP server: Maestro
安装
npm install -g dev-loop-mcp或者通过 npx 使用:
npx dev-loop-mcp配置
在项目根目录下创建 dev-loop.config.json:
{
"buildCommand": "npm run build",
"testCommand": "npm test",
"deployCommand": "npm run deploy",
"integTestCommand": "npm run test:integ",
"branchPrefix": "claude/",
"model": "claude-sonnet-4-6"
}所有字段均为可选。默认值:
buildCommand:"npm run build"testCommand:"npm test"deployCommand: 不存在(跳过 DEPLOY 阶段)integTestCommand: 不存在(跳过 INTEG_TEST 阶段)branchPrefix:"claude/"model:"claude-sonnet-4-6"
环境变量
变量 | 必需 | 描述 |
| 是 | 您的 Anthropic API 密钥 |
| 否 | 项目根目录(默认为 |
MCP 设置
添加到您的 MCP 客户端配置中(例如 Claude Desktop 的 claude_desktop_config.json):
{
"mcpServers": {
"dev-loop": {
"command": "dev-loop-mcp",
"env": {
"ANTHROPIC_API_KEY": "sk-ant-...",
"DEV_LOOP_ROOT": "/path/to/your/project"
}
}
}
}可用工具
start_debug_loop
根据症状描述启动调试循环。AI 将根本原因诊断为按优先级排序的 TDD 任务,然后针对每个假设运行标准 TDD 流水线,并打开一个包含完整诊断报告的 PR。
{
"symptom": "read_website returns failure on most real URLs",
"context_files": ["src/tools/read-website.ts", "src/http/client.ts"]
}参数:
symptom(必需) — 对观察到的错误或故障的自然语言描述context_files(可选) — AI 在诊断时应读取的源文件相对路径
DIAGNOSE 步骤在标准 TDD 流水线之前运行(参见上述状态机)。PR 正文包含症状、识别出的根本原因以及修复内容。
分支命名为 <branchPrefix>debug/<symptom-slug>。
start_loop
启动一个新的开发循环。
{
"description": "Add email validation to the user registration flow",
"branch": "claude/email-validation"
}或者使用预先分解的任务:
{
"tasks": [
{
"id": 1,
"title": "Add email validator function",
"scope": "src/utils/email.ts",
"acceptance": "validateEmail returns true for valid emails and false for invalid ones"
}
],
"branch": "claude/email-validation"
}resume_loop
恢复中断的循环:
{}loop_status
检查当前循环状态:
{}作为库使用
import { runLoop, loadConfig, RealShellAdapter, AnthropicDevWorker } from "dev-loop-mcp";
import Anthropic from "@anthropic-ai/sdk";
const config = await loadConfig("/path/to/project");
const client = new Anthropic();
const shell = new RealShellAdapter();
const aiWorker = new AnthropicDevWorker(client, config.model, shell);
const finalState = await runLoop(initialState, {
shell,
aiWorker,
stateFilePath: "/path/to/project/.loop-state.json",
repoRoot: "/path/to/project",
config,
});Available Tools
4 toolsadvance_loopA
Report the outcome of the last instruction and get the next one. Call this after completing each phase step. The loop persists state between calls.
| Name | Required | Description | Default |
|---|---|---|---|
| event | Yes | The outcome event. One of: BranchCreated, TasksDecomposed, TaskDone, TaskFailed, BuildPassed, BuildFailed, DeployPassed, DeployFailed, IntegPassed, IntegFailed, IntegFixPassed, IntegFixFailed, QualityDone, TreeClean, PrCreated. | |
| tasks | No | For TasksDecomposed: the decomposed or diagnosed task list. | |
| failureReason | No | For TaskFailed: why the task could not be completed. | |
| stderr | No | For BuildFailed or DeployFailed: the error output. | |
| failures | No | For IntegFailed: array of {testFile, testName, description}. | |
| prUrl | No | For PrCreated: the URL of the opened pull request. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the loop persists state between calls, which is useful context. However, it doesn't describe error handling, rate limits, authentication needs, or what happens if called out of sequence. For a stateful tool with no annotations, more behavioral details would be helpful.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise (two sentences) and front-loaded with the core purpose. Every word earns its place, with no redundant information. The structure moves from primary function to usage guidance efficiently.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (stateful loop advancement with multiple event types) and 100% schema coverage but no output schema or annotations, the description is mostly complete. It explains the core workflow and when to use it, though it could benefit from mentioning what the tool returns (the 'next instruction') more explicitly since there's no output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly with their purposes and event-specific usage. The description doesn't add any parameter-specific information beyond what's in the schema, making the baseline score of 3 appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs ('Report the outcome', 'get the next one') and distinguishes it from siblings by specifying it's for after completing each phase step in a loop. It explicitly mentions the loop persists state, which differentiates it from start_loop or loop_status.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit usage guidance: 'Call this after completing each phase step.' This tells the agent precisely when to use this tool versus alternatives like start_loop (for initiation) or loop_status (for checking status without advancing).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
loop_statusB
Get the current status of the loop: phase, branch, task list, failure reason, or PR URL.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates this is a read operation ('Get'), but doesn't specify whether it requires authentication, has rate limits, returns real-time or cached data, or handles errors. The description adds minimal behavioral context beyond the basic action, missing key details for safe and effective use.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core action ('Get the current status of the loop') and lists the retrieved data points without unnecessary words. Every element serves a purpose, making it highly concise and well-structured for quick understanding.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has gaps. It covers what data is retrieved, but without annotations or an output schema, it doesn't explain the return format (e.g., structure of the status object) or behavioral aspects like error handling. For a status-checking tool, this leaves some contextual needs unmet.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately adds no parameter information, focusing instead on the tool's purpose and output semantics. This aligns with the baseline expectation for tools without parameters, as the schema fully covers the input structure.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with the verb 'Get' and specifies the resource 'current status of the loop', including what information is retrieved (phase, branch, task list, failure reason, PR URL). It distinguishes itself from sibling tools like 'advance_loop', 'start_debug_loop', and 'start_loop' by focusing on status retrieval rather than initiation or progression, though it doesn't explicitly name these alternatives.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by listing the specific data points retrieved (e.g., phase, failure reason), suggesting it's for monitoring or checking loop progress. However, it lacks explicit guidance on when to use this tool versus alternatives (e.g., when to check status vs. start or advance a loop) or any prerequisites, leaving usage context inferred rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
start_debug_loopC
Start a debug loop from a symptom description. Returns an instruction telling you to diagnose root causes as ranked TDD tasks, then proceeds through the standard TDD pipeline. The PR body will include a diagnosis writeup.
| Name | Required | Description | Default |
|---|---|---|---|
| symptom | Yes | Natural-language description of the observed bug or failure. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden for behavioral disclosure. It mentions the tool returns an instruction for TDD tasks and that the PR body includes a diagnosis writeup, giving some insight into outputs and workflow. However, it lacks critical details like whether this is a read-only or mutating operation, error handling, or any side effects, which are essential for a tool that starts processes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately concise with two sentences that front-load the core action and follow with output details. Each sentence adds value: the first defines the tool's purpose, and the second explains the return behavior and PR inclusion. There's no wasted text, though it could be slightly more structured for clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (starting a debug process with no annotations or output schema), the description is incomplete. It covers the basic action and some output hints but misses key behavioral aspects like mutation status, error cases, or interaction with sibling tools. Without annotations or an output schema, more detail is needed to fully inform the agent about this process-initiating tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the 'symptom' parameter fully documented as a natural-language bug description. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. This meets the baseline score of 3, as the schema does the heavy lifting without extra value from the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Start a debug loop from a symptom description.' It specifies the verb ('Start'), resource ('debug loop'), and input trigger ('symptom description'). However, it doesn't explicitly differentiate from sibling tools like 'start_loop' or 'advance_loop', which reduces clarity about when to choose this specific debug variant.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides minimal guidance on when to use this tool. It mentions the tool initiates a debug loop from a symptom, but offers no explicit when/when-not criteria or alternatives. While it implies usage for bug diagnosis, it doesn't compare to sibling tools like 'start_loop' or specify prerequisites, leaving the agent with little contextual direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
start_loopA
Start a new TDD development loop. Returns an instruction telling you what to do first. Keep calling advance_loop after each step until the loop reaches DONE or FAILED. Phases: INIT → DECOMPOSE → TDD_LOOP → BUILD → DEPLOY → INTEG_TEST → INTEG_FIX → QUALITY_REVIEW → CLEAN_TREE_CHECK → PUSH_AND_PR.
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Natural language description of the work to be done. | |
| tasks | No | Pre-decomposed task list. If provided, skips DECOMPOSE. | |
| branch | No | Git branch name. Generated from description if omitted. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses the tool's purpose and procedural flow (phases, interaction with advance_loop), but lacks details about potential side effects, error conditions, authentication needs, or what 'DONE or FAILED' states entail. It provides basic behavioral context but misses important operational details.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is efficiently structured in two sentences: the first states the purpose and return value, the second provides crucial procedural guidance and lists all phases. Every element serves a clear purpose with zero wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (managing a multi-phase development loop) and the absence of both annotations and output schema, the description provides adequate procedural context but lacks details about return values, error handling, and operational constraints. It's complete enough to understand the basic workflow but leaves important implementation questions unanswered.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Start a new TDD development loop') and the resource (the loop itself), with a specific verb. However, it doesn't explicitly distinguish this from its sibling 'start_debug_loop' beyond the name difference, leaving some ambiguity about when to choose one over the other.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit usage guidance: it tells the agent to 'Keep calling advance_loop after each step until the loop reaches DONE or FAILED' and lists all the phases of the loop. This gives clear procedural context for when and how to use this tool in relation to its sibling 'advance_loop'.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
advance_loop - First observed
loop_status - First observed
start_debug_loop - First observed
start_loop
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose with no overlap: advance_loop progresses the loop, loop_status checks current state, start_debug_loop initiates debugging, and start_loop initiates standard development. The descriptions make it impossible to confuse their functions.
All tools follow a consistent verb_noun pattern with snake_case throughout: advance_loop, loop_status, start_debug_loop, and start_loop. The naming is predictable and readable across the set.
Four tools is well-scoped for a development loop server, covering initiation (start_loop, start_debug_loop), progression (advance_loop), and status checking (loop_status). Each tool earns its place without bloat or gaps.
The tool set provides complete lifecycle coverage for TDD development loops: starting loops (standard and debug), advancing through phases, and checking status. No obvious gaps exist for the stated purpose, enabling agents to manage loops end-to-end.
Maintenance
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Devopness MCP server for DevOps happiness! Empower AI Agents to deploy apps and infra, to any cloud.
- JamOAuthdev.jam.mcp
The Jam MCP server provides AI tools with instant bug context without manual prompting, enabling a streamlined workflow from bug identification to ticket creation and pull request generation without switching between tools.
Related MCP Servers
- AlicenseBqualityBmaintenanceMCP server that integrates DevFlow with AI code assistants to enforce structured development workflows including planning, task tracking, and code review gates.6566 npm1MIT
- FlicenseNot gradedqualityDmaintenanceAn autonomous MCP server for AI-assisted development with zero-API approach, auto-correction, inverted TDD, and native pipelines.-
- AlicenseAqualityAmaintenanceAn MCP server that brings senior-QA discipline to AI coding assistants, enabling test planning, TDD, mutation testing, and code review.486Apache 2.0
- AlicenseNot gradedqualityCmaintenanceAn MCP server that adds engineering discipline to AI-assisted development, enforcing evidence-gated TDD, security review, backup strategy, and deployment generation to turn AI-generated code into production-ready software.8 npm12MIT