dev-loop-mcp

dev-loop-mcp

An MCP server that automates the full software development lifecycle through an AI-driven TDD state machine. It handles everything from task decomposition and test-driven development to integration testing and automated pull request creation.

Category
访问服务器

README

dev-loop-mcp

An MCP (Model Context Protocol) server that runs an AI-driven TDD development loop. It generalizes the dev-loop state machine to work with any project via a simple config file.

What it does

Two loop types are available — both share the same TDD pipeline; they differ only in how tasks are produced:

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

Full state machine

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

Per-task TDD cycle

Each task in TDD_LOOP runs this inner cycle (up to 5 coding iterations):

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

Phase reference:

  • INIT: Creates the git branch
  • DECOMPOSE: AI converts a description into a Task[]
  • DIAGNOSE: (debug loop only) AI reads symptom + context files and produces ranked root-cause hypotheses as a Task[]
  • TDD_LOOP: Per-task: scenarios → failing tests → implementation (up to 5 coding iterations per task)
  • BUILD: Runs buildCommand
  • DEPLOY: Runs deployCommand — skipped if not configured
  • INTEG_TEST: Runs integTestCommand — skipped if not configured
  • INTEG_FIX: AI diagnoses and fixes integration test failures (up to 5 attempts)
  • QUALITY_REVIEW: AI reviews the full branch diff and applies quality fixes
  • CLEAN_TREE_CHECK: Auto-commits any uncommitted files
  • PUSH_AND_PR: Pushes the branch and opens a GitHub PR

Installation

npm install -g dev-loop-mcp

Or use via npx:

npx dev-loop-mcp

Configuration

Create dev-loop.config.json in your project root:

{
  "buildCommand": "npm run build",
  "testCommand": "npm test",
  "deployCommand": "npm run deploy",
  "integTestCommand": "npm run test:integ",
  "branchPrefix": "claude/",
  "model": "claude-sonnet-4-6"
}

All fields are optional. Defaults:

  • buildCommand: "npm run build"
  • testCommand: "npm test"
  • deployCommand: absent (DEPLOY phase skipped)
  • integTestCommand: absent (INTEG_TEST phase skipped)
  • branchPrefix: "claude/"
  • model: "claude-sonnet-4-6"

Environment variables

Variable Required Description
ANTHROPIC_API_KEY Yes Your Anthropic API key
DEV_LOOP_ROOT No Project root directory (defaults to cwd)

MCP setup

Add to your MCP client configuration (e.g., 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"
      }
    }
  }
}

Available tools

start_debug_loop

Start a debug loop from a symptom description. The AI diagnoses root causes as ranked TDD tasks, then runs the standard TDD pipeline per hypothesis, and opens a PR with a full diagnosis writeup.

{
  "symptom": "read_website returns failure on most real URLs",
  "context_files": ["src/tools/read-website.ts", "src/http/client.ts"]
}

Parameters:

  • symptom (required) — natural-language description of the observed bug or failure
  • context_files (optional) — relative paths to source files the AI should read while diagnosing

The DIAGNOSE step runs before the standard TDD pipeline (see state machine above). The PR body includes the symptom, root causes identified, and what was fixed.

The branch is named <branchPrefix>debug/<symptom-slug>.

start_loop

Start a new development loop.

{
  "description": "Add email validation to the user registration flow",
  "branch": "claude/email-validation"
}

Or with pre-decomposed tasks:

{
  "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

Resume an interrupted loop:

{}

loop_status

Check the current loop status:

{}

Using as a library

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,
});

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选