DeepSeek Harness MCP Server
README.md
# DeepSeek Harness MCP Server & Orchestrator Skill
> Let **frontier models** (Gemini Neon / Claude / GPT / Codex) act as the **Commander** while delegating concrete coding, testing, refactoring, and parallel batch work to **DeepSeek Harness (`dsh`)** workers — with **async job queues, Git worktree isolation, deterministic verification loops, and context isolation**.
[中文简介](#中文简介) | [Architecture](#architecture) | [Quick Start](#quick-start) | [MCP Tools](#mcp-tools) | [Agent Skill](#agent-skill)
---
## Why This Exists
Running an entire agentic coding loop (grepping files, editing boilerplate, running tests, fixing lint errors) on a frontier model is slow and expensive. On the other hand, calling a raw DeepSeek chat API via a naive MCP tool gives DeepSeek no hands (no file editing, no shell, no self-healing loop).
**`deepseek-harness-mcp`** wraps DeepSeek's official open-source agent runtime (**[`@deepseek-ai/dsh`](https://github.com/deepseek-ai/deepseek-harness)** in `--profile headless` mode) behind a production-ready **MCP Server** + **Agent Skill**:
- **Zero MCP Timeouts**: Asynchronous job submission (`submit_dsh_task` / `submit_dsh_batch`) + chunked waiting (`wait_for_tasks`).
- **True Parallelism with Git Worktrees**: Fan out multiple DeepSeek workers onto the same repository safely (`use_worktree=true`).
- **Zero-Token Self-Healing Verification**: Pass a deterministic `verify_cmd` (e.g. `pytest -q`, `npm test`, `tsc --noEmit`). If verification fails, DeepSeek automatically retries with the error output — only escalating to the Commander if retries are exhausted.
- **Strict Context Isolation**: Full worker logs stay on disk (`/tmp/dsh-mcp-logs/`); the Commander only receives concise summaries, `verify_output`, and `git diff --stat`.
---
## Architecture
```text
┌────────────────────────────────────────────────────────────────┐
│ Commander (Frontier Model: Antigravity / Codex / Claude) │
│ Planning · Architecture · Task Specs · Final Diff Review │
└───────────────────────────────┬────────────────────────────────┘
│ MCP (stdio JSON-RPC)
▼
┌────────────────────────────────────────────────────────────────┐
│ deepseek-harness-mcp (server.py) │
│ · Async Queue & Concurrency Control (default: 4 workers) │
│ · Git Worktree Isolation (dsh-task/<id>) │
│ · Deterministic Verifier Loop (verify_cmd + auto-retry) │
│ · Context Protection (log spill + concise structured reports) │
└───────────────────────────────┬────────────────────────────────┘
│ subprocess (stdin/stdout)
▼
┌────────────────────────────────────────────────────────────────┐
│ DeepSeek Harness (`dsh --profile headless`) │
│ Autonomous file edit · grep · bash · local sandbox · R1/V4 │
└────────────────────────────────────────────────────────────────┘
```
---
## Quick Start
### Prerequisites
- Linux, macOS, or Windows **WSL2** (recommended for Windows users)
- `DEEPSEEK_API_KEY` from [DeepSeek Platform](https://platform.deepseek.com/)
- `uv` & Node.js `>=24.9.0` (auto-installed by `install.sh` if missing)
### 1. Clone & Install
```bash
git clone https://github.com/liangliang205/deepseek-harness-mcp.git
cd deepseek-harness-mcp
chmod +x install.sh
./install.sh
```
### 2. Set Your DeepSeek API Key
```bash
echo 'export DEEPSEEK_API_KEY="sk-your-deepseek-key"' >> ~/.bashrc
source ~/.bashrc
```
### 3. Connect Your MCP Client
> VS Code uses a top-level `servers` object. Antigravity and Claude Desktop use
> `mcpServers`.
#### GitHub Copilot in VS Code (`.vscode/mcp.json`)
For VS Code running on Windows with the server installed in WSL2:
```json
{
"servers": {
"deepseek-harness": {
"type": "stdio",
"command": "wsl.exe",
"args": [
"-d",
"Ubuntu-22.04",
"--",
"/home/<user>/deepseek-harness-mcp/run_mcp.sh"
]
}
}
}
```
When VS Code and the server run in the same Linux, macOS, or WSL2 environment,
set `command` directly to the absolute path of `run_mcp.sh` and keep `args` empty.
#### Antigravity / Claude Desktop (Linux / macOS / WSL2)
```json
{
"mcpServers": {
"deepseek-harness": {
"command": "/absolute/path/to/deepseek-harness-mcp/run_mcp.sh",
"args": []
}
}
}
```
#### Antigravity / Claude Desktop on Windows, Bridging into WSL2
```json
{
"mcpServers": {
"deepseek-harness": {
"command": "wsl.exe",
"args": [
"-d",
"Ubuntu-22.04",
"--",
"/home/<user>/deepseek-harness-mcp/run_mcp.sh"
]
}
}
}
```
#### OpenAI Codex CLI (`~/.codex/config.toml`)
```toml
[mcp_servers.deepseek-harness]
command = "/absolute/path/to/deepseek-harness-mcp/run_mcp.sh"
args = []
```
---
## MCP Tools
| Tool | Description |
| :--- | :--- |
| `submit_dsh_task` | Submit one async task (`task`, `workdir`, optional `verify_cmd`, `use_worktree`, `permission_mode`, `session_id`, `timeout_sec`). |
| `submit_dsh_batch` | Fan out multiple tasks concurrently (set `use_worktree: true` when sharing a git repo). |
| `wait_for_tasks` | Wait up to `timeout_sec` (default 90s) and return concise summaries + `git_summary`. |
| `get_task_status` | Inspect live status, elapsed time, diff summary, and recent log tail. |
| `cancel_task` | Kill a queued or running worker subprocess group immediately. |
| `list_tasks` | List recent tasks with status and elapsed time. |
### Environment Variables (Optional)
- `DSH_MCP_MAX_CONCURRENCY`: Max parallel `dsh` workers (default: `4`)
- `DSH_MCP_LOG_DIR`: Directory for worker logs (default: `/tmp/dsh-mcp-logs`)
- `DSH_MCP_WORKTREE_DIR`: Directory for isolated git worktrees (default: `/tmp/dsh-mcp-worktrees`)
---
## Agent Skill
This repo ships with a ready-to-use Agent Skill at:
```text
skills/deepseek-harness-orchestrator/SKILL.md
```
Copy `skills/deepseek-harness-orchestrator/` into your agent's skills directory (e.g. `~/.agents/skills/` — done automatically by `install.sh`), and your Commander agent will automatically follow the 4-phase **Plan → Dispatch → Collect → Review/Escalate** workflow.
---
## 中文简介
本项目将 DeepSeek 官方开源的 **DeepSeek Harness (`@deepseek-ai/dsh`)** 封装为标准的 **MCP Server + Agent Skill**,让旗舰模型(Antigravity / Codex / Claude 等)只负责顶层规划、任务拆解与最终 Review,把具体编码、单测、重构、并发批量任务交由低成本的 DeepSeek Harness 执行:
* **异步队列不超时**:提交秒返 `task_id`,分批等待回收结果;
* **Git Worktree 并发隔离**:同时派发多个 DeepSeek 改同一个仓库也互不冲突;
* **确定性验收自愈闭环**:传入 `verify_cmd`(如 `pytest`、`npm test`),不通过自动打回 DeepSeek 自修,不浪费大脑 Token;
* **上下文隔离**:完整日志落盘,只向大脑返回精简交付报告与 `git diff --stat`。
---
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues