Skip to main content
Glama
README.md
# VIBE ENGINEERING MCP

> **An Agentic Software-Engineering Operating System & Control Plane** that manages requirements, architecture, tasks, workspaces, execution, verification, integration, and checkpoints for autonomous software development.

[![CI](https://github.com/prabhurajvardhan/Dev-MCP/actions/workflows/ci.yml/badge.svg)](https://github.com/prabhurajvardhan/Dev-MCP/actions/workflows/ci.yml)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![TypeScript](https://img.shields.io/badge/TypeScript-Strict_NodeNext-blue)](tsconfig.json)
[![MCP SDK](https://img.shields.io/badge/MCP_SDK-V2_(@modelcontextprotocol/server)-green)](https://ts.sdk.modelcontextprotocol.io/v2/)

---

## πŸ’‘ Core Philosophy

```
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚                 WORKER INTELLIGENCE (LLM)                    β”‚
  β”‚        (Claude Code, Cursor, Gemini, GPT, Custom Agent)      β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚ JSON-RPC / MCP Protocol
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚              ENGINEERING CONTROL PLANE (MCP)                 β”‚
  β”‚                     Vibe Engineering MCP                     β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚                           β”‚                           β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Task DAG Scheduler   β”‚   β”‚  Completion Gate     β”‚   β”‚ Checkpoint & Resumptionβ”‚
β”‚ Cycle Detection      β”‚   β”‚  Observable Harness  β”‚   β”‚ Git Commit Snapshots   β”‚
β”‚ Topological Ordering β”‚   β”‚  Contract Verifier   β”‚   β”‚ Worker Continuation    β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚                           β”‚                           β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚              ISOLATION & EXECUTION POLICIES                  β”‚
  β”‚   Git Worktrees  Β·  Command Policy  Β·  Path Policy  Β· Observer β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚                   DUAL-LAYER STATE STORAGE                   β”‚
  β”‚       SQLite (ACID Operational DB)  Β·  .vibe/ (YAML Specs)   β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

* **The LLM is NOT the source of truth for project state.**
* **The MCP server is the engineering operating system.**
* A task cannot become `VERIFIED` merely because an LLM claims it is finished.
* A capability is complete only when:
  $$\text{Implementation} + \text{Runnable Harness} + \text{Observable Output} + \text{Contract Verification} + \text{Integration Compatibility} + \text{Checkpoint}$$
  have all passed with reproducible evidence.

---

## πŸ”„ Task State Machine & Completion Gate

Tasks progress through strict state machine transitions:

$$\text{BLOCKED} \longrightarrow \text{READY} \longrightarrow \text{CLAIMED} \longrightarrow \text{BUILDING} \longrightarrow \text{VERIFYING} \longrightarrow \text{VERIFIED} \longrightarrow \text{INTEGRATING} \longrightarrow \text{VERIFIED}$$

### The Completion Gate (`task_complete`)
When `task_complete` is invoked by a worker:
1. Inspects the task and active workspace.
2. Inspects Git working tree and modified files.
3. Inspects Git diff.
4. Executes unit and component tests.
5. Runs the module's registered **Observable Harness** (CLI, HTTP, DB, AI, UI).
6. Captures standard output, standard error, exit code, and execution time.
7. Evaluates contract rules (exit codes, regex patterns, JSON schema verification, artifact existence).
8. Checks cross-module integration requirements.
9. **On Pass**: Transitions task to `VERIFIED`, updates DAG readiness for dependent tasks, and records state.
10. **On Fail**: Rejects completion, transitions task to `FAILED`, and automatically schedules an **Automated Repair Task** in state `READY` populated with:
    * Original task ID
    * Failure reason
    * Failing command
    * Relevant stdout/stderr
    * Affected files
    * Suggested remediation action

---

## πŸ›‘οΈ Git Worktree Workspace Isolation

Unlike naive implementations that share or pollute the project root directory, Vibe Engineering MCP provisions dedicated **Git worktrees** for each worker/task:
* Worktrees are created under `.worktrees/ws-<workerId>-<taskId>` on isolated Git branches (`worker/<workerId>/task-<taskId>`).
* The system never silently falls back to the project root. If worktree provisioning fails, it throws an explicit diagnostic error.
* Worktree metadata is fully tracked (`workspaceId`, `taskId`, `branch`, `worktreePath`, `repositoryPath`, `status`, `createdAt`).
* Worktrees can be safely cleaned up with `cleanupWorkspace` (`git worktree remove --force`).

---

## πŸ”’ Security Model

### Command Policy (`src/security/command-policy.ts`)
* Scopes terminal command execution to the project or designated worktree.
* Blocks destructive commands (`rm -rf /`, formatting disks via `mkfs`, overwrite via `dd`, fork bombs `:(){ :|:& };:`, unauthorized `sudo`).
* Requires execution inside valid workspace boundaries.
* Every command execution records: execution ID, command, cwd, timestamp, exit code, stdout, stderr, and duration to SQLite.

### Path Policy (`src/security/path-policy.ts`)
* Enforces strict containment within project/worktree root.
* Resolves symlinks and prevents directory traversal attacks (e.g. `../../etc/passwd`).

---

## πŸ› οΈ Registered MCP Tools (28 Tools)

Migrated to the current **MCP TypeScript SDK V2** (`@modelcontextprotocol/server`):

| Category | Tool | Description |
|---|---|---|
| **PROJECT** | `project_initialize` | Initializes or connects to a project with SQLite state & `.vibe/` directory |
| | `project_inspect` | Full operational snapshot (DAG counts, git status, active workers) |
| | `project_resume` | High-density context briefing for cold model resumption |
| **REQUIREMENTS** | `requirements_compile` | Compiles human specifications into structured capabilities & criteria |
| **ARCHITECTURE** | `architecture_generate` | Records modular boundaries, entrypoints, and contracts |
| | `architecture_validate` | Validates DAG acyclicity and interface consistency |
| **TASKS** | `task_create` | Creates a new task with dependencies and observable contract specification |
| | `task_next` | Returns next highest priority `READY` task (prioritizes repair tasks) |
| | `task_claim` | Assigns a `READY` task to a worker model |
| | `task_complete` | Evaluates task through Completion Gate with auto-repair synthesis |
| | `task_fail` | Explicitly marks a task as `FAILED` with diagnostic reason |
| **WORKSPACE** | `workspace_create` | Creates isolated Git worktree and branch for a worker |
| | `workspace_status` | Inspects all active worker workspaces |
| **REPOSITORY** | `repo_read_file` | Safe file read bounded by workspace containment |
| | `repo_write_file` | Safe atomic file write bounded by workspace root |
| | `repo_delete_file` | Safe workspace file deletion |
| **TERMINAL** | `terminal_exec` | Policy-checked scoped terminal command execution |
| **GIT** | `git_status` | Returns working tree status, staged, modified, and untracked files |
| | `git_diff` | Returns working tree or cached diff |
| | `git_commit` | Stages changes and creates git commit |
| | `git_branch` | Creates and checks out branch |
| | `git_merge` | Merges branch with `--no-ff` |
| **MODULES** | `module_run` | Executes module runnable harness and captures metrics |
| | `module_observe` | Records reproducible observable evidence |
| **VERIFICATION** | `contract_verify` | Evaluates evidence against contract rules |
| | `integration_verify` | Executes cross-module integration test harness |
| **CHECKPOINTS** | `checkpoint_create` | Records comprehensive snapshot (SHA, capabilities, DAG, decisions) |
| | `checkpoint_load` | Loads historic milestone checkpoint |

---

## πŸš€ Getting Started

### Prerequisites
* **Node.js**: `v20.0.0` or higher (Tested on Node 22 with built-in `node:sqlite`)
* **Git**: `2.30+` with worktree support

### Installation
```bash
git clone https://github.com/prabhurajvardhan/Dev-MCP.git
cd Dev-MCP
npm ci
```

### Typecheck & Test Suite
```bash
npm run typecheck
npm test
```
The test suite includes:
* 4 Unit test suites: Task DAG scheduler, SQLite state store, command security policy, contract engine.
* 4 Integration test suites: Real MCP client protocol over stdio (`@modelcontextprotocol/client`), 19-step autonomous engineering loop, task completion gate & repair generation, MCP server tools interface.

### Build Project
```bash
npm run build
```
Compiles TypeScript into `./dist`.

---

## πŸ”Œ Running the MCP Server (Stdio)

The MCP server uses pure stdio JSON-RPC transport (`serveStdio`).
* Standard output (`stdout`) is strictly reserved for JSON-RPC messages.
* All logging and diagnostic outputs are routed to `stderr`.

```bash
npm run mcp
# or
npx tsx src/server/index.ts
```

### Configuration in Claude Code / Claude Desktop
Add to your `claude_desktop_config.json`:
```json
{
  "mcpServers": {
    "vibe-engineering": {
      "command": "npx",
      "args": ["-y", "tsx", "/path/to/Dev-MCP/src/server/index.ts"]
    }
  }
}
```

### Configuration in Cursor
In **Cursor Settings** $\to$ **Features** $\to$ **MCP Servers**:
* **Name**: `vibe-engineering`
* **Type**: `command`
* **Command**: `npx -y tsx /path/to/Dev-MCP/src/server/index.ts`

---

## πŸ“‚ `.vibe/` Inspectable Project State

In addition to SQLite operational ACID storage, human-readable YAML state is maintained under `.vibe/`:
```
.vibe/
β”œβ”€β”€ architecture.yaml       # System design, modular boundaries, contracts
β”œβ”€β”€ requirements.yaml       # Product goals & acceptance criteria
β”œβ”€β”€ modules.yaml            # Registered modules & runnable harnesses
β”œβ”€β”€ tasks.yaml              # Task DAG and execution status
β”œβ”€β”€ checkpoints/            # Frozen capability snapshots (latest.yaml + chk-*.yaml)
β”œβ”€β”€ contracts/              # Interface contracts
β”œβ”€β”€ observations/           # Reproducible evidence logs (evd-*.yaml)
└── decisions/              # Architectural decision records
```

---

## ⚠️ Current Scope & Limitations (V0)

* **Local Focus**: V0 is optimized for single-machine local development using Git worktrees and SQLite.
* **No Remote Workers**: Distributed worker pools or cloud message brokers are deferred to V1.
* **Synchronous Worktree Operations**: Worktree allocation is local to the filesystem where the MCP server runs.

---

## πŸ“„ License

Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.

TDQS

B3.2/5.0

Scored across 28 tools

Disambiguation4/5

Most tools have clearly distinct resource-action purposes, with prefixes and descriptions that separate tasks, git, repo, workspace, architecture, and verification concerns. Some overlap exists among status/context tools such as project_inspect, project_resume, workspace_status, and checkpoint_load, but their descriptions make the intended use reasonably clear.

Naming Consistency5/5

All tool names use consistent snake_case with predictable domain prefixes such as task_, git_, repo_, workspace_, architecture_, and checkpoint_. The verb/noun ordering is not perfectly uniform, but the convention is highly readable and consistent across the set.

Tool Count3/5

28 tools is heavy and exceeds the ideal 3-15 range for a single MCP server. The complex engineering lifecycle justifies many of them, but there is likely room to consolidate status/context tools, making the surface borderline rather than well-scoped.

Completeness4/5

The set covers the major lifecycle stages: project setup, requirements, architecture, task DAGs, workspaces, file operations, terminal execution, git, modules, contracts, integration verification, and checkpoints. Minor gaps include no explicit task_update/task_list, checkpoint_list, or workspace_cleanup, but agents can work around these through project_inspect and terminal_exec.

Maintenance

ActivityMaintained
ResponsivenessNo issues