dsh-agent-mcp
This server exposes tools to run and manage autonomous coding tasks through DeepSeek Harness (DSH) at zero front-end token cost.
Dispatch coding tasks (
dsh_run_task): Send a task brief and working directory to DSH, which autonomously reasons, edits files, runs bash commands, and tracks git diffs, returning structured results (with optional verbose output and configurable timeout).Health-check the setup (
dsh_doctor): Verify DSH binary installation,~/.dsh/settings.yamlconfig, model endpoint connectivity, and Web UI status.Manage the DSH Web UI: Start (
dsh_web_start), stop (dsh_web_stop), and check status (dsh_web_status) of the companion dashboard on port 3080, including active session counts.List sessions (
dsh_list_sessions): Discover existing DSH sessions in~/.dsh/sessions/, sorted by recency, with optional workspace filtering.
Allows using Ollama-hosted local models (e.g., qwen2.5-coder) as the backend for autonomous coding tasks and dual-agent verification.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dsh-agent-mcp Migrate the login form from MUI to shadcn and verify with tests"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
⚡ Pi-Agent-MCP: Zero-Cost Autonomous Dual-Agent Coding Engine
Model Context Protocol (MCP) server connecting Google Antigravity, Claude Code, and Cursor to the Pi Coding Agent (
pi) and DeepSeek Harness (dsh) for $0-cost autonomous coding, live terminal streaming, and dual-agent verification.
📖 Looking for internal design, sequence diagrams, and folder breakdown? Read the Architecture & System Flow Guide.
🎯 The Problem & The Solution
Frontier harnesses plans (claude, antigravity) are phenomenal system architects, but using them to generate hundreds of lines of repetitive boilerplate, mechanical refactors, and test iteration code is:
Expensive: Burns significant paid API tokens.
Prone to Hallucinated Regressions: Without an independent verification loop, self-auditing often misses edge cases.
The Solution: Dual-Agent Architecture
Pi-Agent-MCP turns your primary AI into a Lead Architect and delegates mechanical implementation to the Pi Coding Agent (or DeepSeek Harness) running on your local or free model cluster (FreeToken Qwen 35B, NVIDIA NIM Nemotron, Ollama, OpenRouter), followed by an independent Reviewer Agent before any task is marked complete.
sequenceDiagram
autonumber
actor User
participant Architect as Primary AI (Antigravity / Claude / Cursor)
participant Worker as Agent 1: Task Completion Worker (Pi / DSH)
participant Cluster as Local / Free LLM (FreeToken / NIM / Ollama)
participant Reviewer as Agent 2: Reviewer & QA Verifier
User->>Architect: "Migrate Form.tsx from MUI to shadcn"
Note over Architect: Formulates concise intent brief.<br/>DOES NOT write replacement code.
Architect->>Worker: invoke_subagent / pi_run_task(brief)
Worker->>Cluster: Autonomous AST analysis, edits & build verification
Cluster-->>Worker: Modified files + git diff + build status
Worker-->>Architect: Completion report & git diff
Architect->>Reviewer: invoke_subagent(diff, brief, test_cmd)
Note over Reviewer: Independently inspects diff,<br/>checks regressions & re-runs test suite.
Reviewer-->>Architect: [CONFIRMED / APPROVED]
Architect-->>User: Delivers completed, verified taskRelated MCP server: DSH Crew
⚡ 60-Second Quickstart
Prerequisites
Node.js ≥ 20.0.0
Pi CLI (
pi) installed or configured viaPI_BIN(or DeepSeek Harness viadsh/DSH_BIN)A supported model backend: FreeToken (self-hosted Qwen 35B at $0 cost), NVIDIA NIM, Ollama, or OpenRouter.
Step 1: Clone and Run the 1-Command Setup
git clone https://github.com/Eklavya-San/dsh-agent-mcp.git
cd dsh-agent-mcp
./scripts/setup.shThe installer will:
Install dependencies and compile TypeScript to
build/mcp.jsandbuild/web.js.Configure CLI binaries (
pi-live,dsh-live) with executable permissions.If Google Antigravity is detected, automatically install subagents (
pi-worker.md,reviewer-worker.md), dual-agent rules (AGENTS.md), and skills (pi-orchestration) into~/.gemini/config/.Register the MCP server in
~/.gemini/config/mcp_config.json.Announce the real-time Web UI Dashboard available at
http://127.0.0.1:7081.
Step 2: Configure Your AI Client
1. Google Antigravity
The installer ./scripts/setup.sh automatically installs the worker subagents and MCP registration. Simply confirm ~/.gemini/config/mcp_config.json:
{
"mcpServers": {
"pi-agent": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/dsh-agent-mcp/build/mcp.js"],
"env": {
"FREETOKEN_BASE_URL": "http://machinewiseapp.in:10346/v1",
"PI_DEFAULT_PROVIDER": "freetoken"
}
}
}
}(Replace /ABSOLUTE/PATH/TO/dsh-agent-mcp with your actual cloned path. The dsh server alias is also registered for backward compatibility).
2. Claude Desktop / Claude Code
Claude Desktop: Add to
claude_desktop_config.json:{ "mcpServers": { "pi-agent": { "command": "node", "args": ["/ABSOLUTE/PATH/TO/dsh-agent-mcp/build/mcp.js"], "env": { "FREETOKEN_BASE_URL": "http://machinewiseapp.in:10346/v1", "PI_DEFAULT_PROVIDER": "freetoken" } } } }Claude Code: Copy
integrations/claude/CLAUDE.mdto your user directory (~/.claude/CLAUDE.md) or into your project root.
3. Cursor
Add to .cursor/mcp.json in your workspace or global Cursor settings:
{
"mcpServers": {
"pi-agent": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/dsh-agent-mcp/build/mcp.js"],
"env": {
"FREETOKEN_BASE_URL": "http://machinewiseapp.in:10346/v1",
"PI_DEFAULT_PROVIDER": "freetoken"
}
}
}
}4. Cline (VS Code Extension)
Add to cline_mcp_settings.json:
{
"mcpServers": {
"pi-agent": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/dsh-agent-mcp/build/mcp.js"],
"env": {
"FREETOKEN_BASE_URL": "http://machinewiseapp.in:10346/v1",
"PI_DEFAULT_PROVIDER": "freetoken"
}
}
}
}🌐 Pi Agent MCP Web Dashboard (Port 7081)
Pi-Agent-MCP includes a high-performance, dark-mode visual web dashboard running at http://127.0.0.1:7081. It provides complete real-time observability into active Pi worker processes, execution history, provider diagnostics, and configuration without leaving your browser or IDE.
🌟 Key Features
Real-Time Active Worker Monitoring: Inspect running coding workers with live elapsed timers, target workspace paths, and active task briefs.
Live Terminal Streaming (SSE): Watch Pi agent execution in real-time via Server-Sent Events (
/api/events) with terminal ANSI color rendering, streaming tool calls, code modifications, and subagent output.Instant 1-Click Task Cancellation ("Abort Worker"): Instantly abort runaway or stalled worker processes via the interactive UI or
POST /api/cancel.Dynamic Provider & Model Discovery: Inspect and discover all configured models and providers dynamically loaded from
~/.pi/agent/models.jsonand~/.pi/agent/settings.json(FreeToken Qwen 35B, NVIDIA NIM Nemotron, Ollama, OpenRouter).Interactive Provider Diagnostics: Benchmark latency and validate endpoint reachability directly from the UI (
POST /api/test-provider).
🚀 Starting the Web Dashboard
You can launch the Web Dashboard in multiple ways:
# Start directly from CLI:
npm run web
# Or with a custom port:
node build/web.js --port 7081Alternatively, manage the dashboard programmatically via MCP tools:
pi_web_start(ordsh_web_start) — Spawns the Web Dashboard as a background daemon process.pi_web_status(ordsh_web_status) — Checks whether the dashboard is running, port, PID, and active task count.pi_web_stop(ordsh_web_stop) — Safely shuts down the dashboard daemon process.
🔌 REST & Event API Endpoints
The companion server exposes a native, lightweight HTTP REST and Server-Sent Events API on port 7081:
Method | Endpoint | Description |
|
| Obsidian dark-mode SPA dashboard (HTML/CSS/JS). |
|
| Current server status, port, uptime, and active task count. |
|
| Discovered providers and models from |
|
| Comprehensive system health check, binary info, and provider latency benchmarks. |
|
| Real-time Server-Sent Events (SSE) stream ( |
|
| Terminates an active worker process by |
|
| Tests and benchmarks reachability for a specific provider ( |
⚙️ Model Backend Configuration
Pi Coding Agent and DSH read model provider configurations dynamically from ~/.pi/agent/models.json and ~/.dsh/settings.yaml. You can configure any OpenAI-compatible provider:
Option A: FreeToken Cluster (Recommended $0-Cost Default)
Set the environment variables in your MCP configuration:
"env": {
"FREETOKEN_BASE_URL": "http://machinewiseapp.in:10346/v1",
"PI_DEFAULT_PROVIDER": "freetoken"
}Option B: Local / Remote Ollama
"env": {
"OLLAMA_BASE_URL": "http://localhost:11434/v1",
"PI_DEFAULT_PROVIDER": "ollama"
}Or in ~/.pi/agent/models.json:
{
"providers": [
{
"id": "ollama",
"baseUrl": "http://localhost:11434/v1",
"model": "qwen2.5-coder:32b"
}
]
}Option C: NVIDIA NIM
Set NVIDIA_API_KEY in your environment or MCP config. Pi Agent connects to https://integrate.api.nvidia.com/v1 targeting nvidia/nemotron-3.5-lightning-30b-a3b.
Option D: OpenRouter
Set OPENROUTER_API_KEY in your environment. Pi Agent connects to https://openrouter.ai/api/v1 targeting qwen/qwen3-coder.
🔧 Binary Resolution
pi-agent-mcp resolves the agent executable in the following priority order:
Explicit
PI_BINenvironment variable: If you have a custom Pi binary or wrapper, setPI_BIN="/path/to/pi".System
PATH: Resolveswhich piautomatically.DeepSeek Harness Fallback: If Pi CLI is absent and DSH is installed, falls back seamlessly to
dsh(orDSH_BIN/npx -y @deepseek-ai/dsh).
To verify your environment anytime:
npm run doctor🛠️ MCP Tools Exposed
Tool | Alias | Description |
|
| Dispatches an autonomous coding task to the Pi Coding Agent in headless mode with multi-repo git diff calculation and $0 front-end token burn. |
|
| Comprehensive health check inspecting Pi binary installation and testing endpoint latency across all configured providers. |
| — | Lists configured inference providers (FreeToken, NVIDIA NIM, Ollama, OpenRouter) with default models and base URLs. |
|
| Instantly aborts an active coding worker process by |
|
| Lists currently active coding tasks with elapsed execution time and target workspace. |
|
| Independent QA verification tool that audits git diffs, executes test suites, and evaluates architectural intent compliance. |
|
| Starts the Pi Agent Web UI companion dashboard as a detached background daemon ( |
|
| Checks if the Web UI companion dashboard is running, port number, PID, and active task count. |
|
| Safely terminates the running Web UI companion dashboard daemon process. |
💻 CLI Companions: pi-live & dsh-live
For interactive or visible streaming directly in your integrated terminal:
# Stream live thinking tokens, tool calls, and syntax-highlighted markdown with Pi:
./bin/pi-live --cwd "/path/to/project" "Refactor auth middleware to use JWT and verify with npm test"
# Or with DeepSeek Harness:
./bin/dsh-live --cwd "/path/to/project" "Refactor auth middleware to use JWT and verify with npm test"📋 The Architect Prompting Doctrine
To maximize autonomous reasoning and eliminate token waste, follow this simple protocol:
❌ BANNED (Micromanaging / Burning Paid Tokens)
Replace lines 135-255 of Form.tsx with:
<Dialog open={open}>
... 150 lines of frontier LLM pre-written code ...
</Dialog>✅ REQUIRED (High-Level Intent Brief)
Task for src/components/Form.tsx:
1. Migrate the component modal and selects from MUI to shadcn/ui.
2. Maintain existing form state, submit handlers, and validation logic.
3. Replace MUI sx styling with Tailwind CSS utility classes.
4. Verify by running 'npm test'.📦 Ready-to-Use Integrations
This repository includes copy-paste templates in the integrations/ folder:
integrations/antigravity/: Subagent definitions (dsh-worker.md,reviewer-worker.md), dual-agent rules, and setup guide.integrations/claude/:CLAUDE.mdand desktop config.integrations/cursor/:.cursorrulesandmcp.json.integrations/cline/:cline_mcp_settings.json.
📄 License
MIT © 2026 Eklavya
Available Tools
6 toolsdsh_doctorA
Health-check the DeepSeek Harness setup. Checks DSH binary installation, ~/.dsh/settings.yaml configuration, model endpoint connectivity, and Web UI status.
Inputs: no named parameters.
dsh_list_sessionsA
Discover and list existing DeepSeek Harness sessions stored in ~/.dsh/sessions/, sorted by most recent.
Inputs: workspace.
dsh_run_taskA
Dispatch an autonomous coding task to DeepSeek Harness in headless mode using the configured local/free model. The worker operates directly on the specified repository, reasons autonomously, creates/edits files, executes bash commands, tracks git diffs, and returns structured execution results with zero front-end token burn.
Inputs: cwd (required), task (required), verbose, timeoutMs.
dsh_web_startA
Start the DeepSeek Harness Web UI companion in background daemon mode on port 3080 (http://127.0.0.1:3080).
Inputs: port.
dsh_web_statusB
Check if the DeepSeek Harness Web UI is currently running on port 3080, and list active sessions count.
Inputs: port.
dsh_web_stopA
Stop the running DeepSeek Harness Web UI companion process on port 3080.
Inputs: port.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct concern: running tasks, checking setup health, checking/starting/stopping the web UI, and listing sessions. There is no meaningful overlap, and descriptions make the boundaries clear.
All tools share the 'dsh_' prefix and mostly follow verb_noun (run_task, list_sessions) or web_verb patterns (web_start, web_stop, web_status). 'dsh_doctor' is the only outlier, being a noun rather than a verb phrase, but it is still readable and intuitive.
Six tools is well-scoped for an agent-management server: one primary action, three for web UI lifecycle, one health check, and one session discovery. No tool feels redundant or missing as a lightweight utility.
The core workflows are covered: run a task, check health, manage the web UI, and list sessions. Minor gaps exist (e.g., no session termination or task cancellation), but these are not obvious dead ends for the server's stated purpose.
Maintenance
Related MCP Connectors
Build, deploy, and sell AI agents for local-service businesses - from your IDE.
Autonomous AI developers on your own infrastructure: assign a task, get a pull request.
Zero-Ops deploy of a private AI workspace to your own VPS — from your AI chat. Free and open-source.
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables IDE integration with a multi-agent AI pipeline for solving, reviewing, and optimizing code through adversarial peer review and security filtering.-
- AlicenseNot gradedqualityAmaintenanceEnables dispatching tasks from coding hosts such as Claude Code, Codex, Antigravity and Grok to DeepSeek Harness agents that appear as native subagents with live progress, tier/effort policy, escalation, and workspace guardrails. Also lends text-only harnesses vision and image generation through DeepSeek VL models or existing CLIs.354 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables coding hosts like Claude Code, Codex, Antigravity and Grok to dispatch work to DeepSeek Harness agents that appear as native subagents with live progress, tier/effort policy, escalation on failure, workspace guardrails and a jobs board. Also lends text-only harnesses vision and image generation via DeepSeek's VL model, the host's existing CLIs, or custom OpenAI-compatible endpoints.354 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables coding hosts like Claude Code, Codex, Antigravity and Grok to dispatch tasks to full DeepSeek Harness agent sessions that appear as native subagents with live progress, tier and effort presets, escalation on failure, workspace locking and a jobs board. It also bridges text-only harness models to vision and image generation through DeepSeek's VL model, existing CLI tools, or any OpenAI-compatible endpoint.354 npmMIT