dsh-deepseek-mcp
Enables Google Antigravity to delegate tasks to a persistent DeepSeek worker pool through the MCP server, including parallel fan-out, warm session reuse, and token/cost accounting.
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-deepseek-mcp Use DeepSeek to write a Python function that parses a CSV file."
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.
dsh-deepseek-mcp (v2.5.0)
Brain (Antigravity / Frontier LLM) × Hands (Persistent DeepSeek Worker Pool)
A production-grade Stdio MCP Server that turns DeepSeek Harness (dsh --profile sdk) into a warm, stateful, parallelizable worker pool for Google Antigravity, Claude Code, Cursor, and any MCP-compatible host.
✨ Why dsh-deepseek-mcp?
Frontier orchestrator models (like Gemini / Claude inside Google Antigravity) excel at system architecture, cross-module reasoning, and final integration—but burning their context window and quota on leaf tasks, boilerplate generation, or 40-step tool loops is slow and expensive.
dsh-deepseek-mcp implements the Brain × Worker Shunt Architecture without any reverse-proxying or ToS hacks:
🔥 Persistent Warm Session Pool (
sessionKey+ 98%+ KV Cache Hit)
Backed by DSH's officialdsh --profile sdkJSON-RPC runtime. Subtasks sharing the samesessionKeyreuse the exact same warm DeepSeek agent process and memory—achieving >98% KV Cache hit rates (¥0.02 / 1M tokens off-peak!). Unrelated tasks use a new key (or omit it) for zero context contamination.⚡ True Server-Side Parallel Fan-Out (
delegate_parallel)
Dispatch up to 16 independent leaf tasks in a single MCP tool call. DistinctsessionKeys execute concurrently across multipledsh --profile sdkworkers; identicalsessionKeys automatically serialize through aninitPromise+ turn mutex lock to share memory safely.⏱️ Three-Tier Wall-Clock Anti-Runaway Timer (
15m / 25m / 30m)
Tames runaway agent loops with a three-stage ladder:Warn (
warnMs, default 15 min): Injects a live steering nudge via JSON-RPC to start converging.Force Wrap-Up (
forceMs, default 25 min): Commands the worker to stop all new tool calls immediately and output its final summary.Hard Timeout (
timeoutMs, default 30 min): Terminates the worker and its entire Windows/POSIX subprocess tree (taskkill /T /F), returningtimedOut: true.
🚀
pureTextFast Generation Mode & ConfigurablereasoningEffort
SetpureText: truefor pure code/SVG/text generation tasks to forbid the worker from running unnecessary local shell/browser self-verification loops—cutting latency from 10+ minutes to ~30 seconds. Supports per-callreasoningEffort(low|high|max).💰 Real-Time Token & Cost Accounting (
usage/batchUsage)
Intercepts liveassistant/messagetoken meter events from the DSH SDK stream and returns exactuncachedInputTokens,cacheReadTokens,outputTokens, automatic Beijing Peak/Off-Peak detection (isOffPeak), and real-time RMB cost (estimatedCostCNY).
Related MCP server: Multi-Model Broker
🏗️ Architecture
User Request
│
▼
Google Antigravity / Orchestrator LLM ("The Brain")
├─ Global Rule (`delegate-to-dsh.md`): Triage complexity
│ ├─ Simple / Leaf Task ──────► `delegate_task(tier: "flash")`
│ └─ Complex Architecture ────► Brain designs contract & decomposes
│ ├─► `delegate_parallel(tasks: [...], maxConcurrency: 4)`
│ └─► Brain integrates, verifies & delivers
▼
MCP Server: `dsh-deepseek-mcp` (Stdio JSON-RPC)
├─ Race-free LRU Session Pool (`POOL_MAX=4`, `POOL_TTL=30m`, `MAX_TURNS=40`)
├─ Windows Path Normalization (`D:\agy` === `d:/agy`)
├─ 3-Tier Timer Ladder (`warnMs` -> `forceMs` -> `timeoutMs` + Process Tree Kill)
└─ Real-Time Stream Token & RMB Cost Meter
▼
Persistent `dsh --profile sdk` Worker Processes
├─ `flash` tier: `auto/deepseek-v4.1-flash`
└─ `max` tier: `trae-cn/deepseek-v4.1-flash-max` (1M Context)🛠️ Exposed MCP Tools
Tool Name | Description |
| Delegate a single task to a DeepSeek worker. Supports |
| Fan out an array of |
| Inspect active warm sessions in the pool ( |
| Inspect server version ( |
| Evict and kill the process tree for a specific |
| Quick connectivity health check. |
🚀 Quick Start
1. Prerequisites
Node.js
>= 18DeepSeek Harness (
@deepseek-ai/dsh) installed with ansdkprofile configured (~/.dsh/profiles/sdk).
2. Install Dependencies
git clone https://github.com/773Archer/dsh-deepseek-mcp.git
cd dsh-deepseek-mcp
npm install3. Register in Google Antigravity (mcp_config.json)
Add dsh-deepseek to ~/.gemini/config/mcp_config.json (or ~/.gemini/antigravity/mcp_config.json):
{
"mcpServers": {
"dsh-deepseek": {
"command": "node",
"args": ["D:/path/to/dsh-deepseek-mcp/server.mjs"],
"env": {
"POOL_MAX": "4",
"PARALLEL_MAX": "4",
"DEFAULT_WORKSPACE_CWD": "d:/agy"
}
}
}
}4. (Recommended) Add the Global Orchestrator Rule
Copy delegate-to-dsh.md to ~/.gemini/config/rules/delegate-to-dsh.md so Antigravity automatically triages tasks, reuses sessionKeys within the same workflow, and fans out leaf tasks via delegate_parallel.
🧪 Real-World Benchmark: 245 KB Single-File SVG Animation
In a live benchmark orchestrating a 245 KB multi-country picture-in-picture SVG animation ("Pelican cycling around the world inside hanging Polaroid photos with dynamic camera tracking"):
4 specialized DeepSeek workers ran in parallel (
svg-pelican-hero,svg-photo-1-2,svg-photo-3-4,svg-frames-studio).Total Token Throughput: 6,413,000 Tokens (
100,537uncached input +5,869,824KV cache read +442,639output & reasoning tokens).KV Cache Hit Rate:
98.32%Total Official API Cost (Off-Peak): ¥1.99 CNY (~$0.27 USD)!
✅ Built-In Verification Suite
Run the included self-tests and E2E suites to verify your local DSH SDK runtime:
# 1. Warm session memory reuse & token meter self-test
npm run selftest
# 2. Hard wall-clock timeout self-test (scaled to 1.2s)
npm run test:timeout
# 3. 3-tier timer ladder self-test (3s warn -> 6s force -> 25s cap)
npm run test:ladder
# 4. Full MCP stdio E2E suites
npm run test:e2e
npm run test:reuse
npm run test:parallel⚙️ Environment Variables
Variable | Default | Description |
|
| Path to Node.js binary used to spawn |
|
| Path to |
|
| DSH profile name |
|
| Safe fallback workspace when |
|
| Default concurrency for |
|
| Maximum warm sessions retained in the LRU pool |
|
| Idle session TTL before automatic eviction |
|
| Maximum turns per session before automatic recycle |
|
| Tier-1 gentle convergence reminder threshold |
|
| Tier-2 forced wrap-up threshold |
|
| Tier-3 hard kill timeout threshold |
📄 License
MIT
Available Tools
6 toolsdelegate_parallelA
一次把"一个任务拆出的多条子任务"并发外包给 DeepSeek worker(服务端并发 + 并发上限,统一返回全文及汇总 Token 账单)。每条可单独配 sessionKey/tier/cwd/pureText/reasoningEffort/超时;共享同一 sessionKey 的条目会自动排队串行并共享上下文,不同 key 才是真并行。
Inputs: tasks (required), maxConcurrency.
delegate_taskA
把可独立完成的子任务交给 DeepSeek worker(同步返回,附带实时 Token 消耗与人民币费用估算)。同轮任务/同批子任务传相同 sessionKey 复用会话;无关新任务换新 key 或省略(每次全新、不污染)。纯文本/代码生成任务可传 pureText:true 禁用工具调用以大幅提速省 Token。
Inputs: task (required), cwd, tier, fresh, +7 more.
echoA
连通性自检:回显输入文本。
Inputs: text (required).
pool_statusA
查看会话池(哪些 key 常驻、多少轮、空闲多久、累计消耗多少 Token 与费用)。
Inputs: no named parameters.
reset_sessionA
丢弃会话池会话并清理进程树。传 sessionKey 只清该 key;不传清全部。
Inputs: sessionKey.
worker_infoA
返回 worker 配置、难度档、三级计时与会话池状态(排障用)。
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
delegate_task vs delegate_parallel, reset_session, and echo are clearly distinct, but worker_info and pool_status overlap since worker_info also claims to return 会话池状态. The descriptions hint at a troubleshooting vs detailed-view split, yet an agent could easily pick the wrong one when it just wants pool state.
Names mix three styles: verb_noun (reset_session, delegate_task, delegate_parallel), noun_status/info (worker_info, pool_status), and a bare verb (echo). All are readable and snake_case, but there is no single predictable pattern for an agent to extrapolate from.
Six tools is well-scoped for a delegation server: two task-execution tools, two status/introspection tools, a reset, and a health check. Each tool has a distinct role and none feels padded or missing.
The delegation lifecycle (single task, parallel batch, session reuse, pool inspection, reset, connectivity check) is covered, with cost/token reporting folded into returns. The main gap is no explicit cancel/abort for an in-flight delegation, forcing reliance on timeouts.
Maintenance
Related MCP Connectors
Hosted MCP server for task-first delegation to remote workstations and workers.
Scoped agent execution. Server-side credentials, policy, budgets and verifiable receipts.
Discover and execute versioned AI capabilities with worker leases and trial-credit settlement.
A paid remote MCP for AI agent browser MCP session, built to return verdicts, receipts, usage logs,
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceLets any MCP-capable coding harness (Cursor, Claude Code, Codex, Gemini CLI, VS Code/Copilot, opencode, and others) hand a self-contained task to a real, isolated DeepSeek Harness process that works in a chosen workspace with its own context window, model, and toolchain, then returns the final answer. Exposes task submission with time estimates and acceptance criteria, status polling with live progress and process-tree telemetry, graceful cancel and forced kill of whole process trees, and a health probe reporting concurrency, deadlines, and recent jobs.2MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to delegate tasks to multiple local and cloud AI workers (Codex, Claude Code, DeepSeek, GLM, Gemini) with deterministic routing, concurrent batch execution, idempotent retries, and auditable traces.MIT
- AlicenseNot gradedqualityBmaintenanceEnables Codex to hand off coding tasks to a locally running DeepSeek Harness Desktop Host over MCP, reusing the Host's configured model and runtime and returning a session ID for status checks, incremental event streaming, waiting, and cancellation.MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to hand tasks to DeepSeek Harness as an execution subagent, creating sessions, submitting work, waiting for results, and retrieving outputs.7MIT