dsh-web-mcp
An MCP bridge that exposes DeepSeek Harness (DSH) web UI's cordis RPC API as stdio tools, enabling any MCP client to manage workspaces, create/resume sessions, send messages, and fetch session stats.
README
dsh-web-mcp
🤖 AI-assisted project · A college student's learning project, with significant code generated by an LLM agent under human direction and review.
MCP bridge for DeepSeek Harness (DSH) web UI — exposes the cordis RPC API over HTTP /api/<endpoint> as stdio MCP tools. Any MCP client (Codex CLI, Claude Desktop, etc.) can drive DSH sessions and benefit from prompt-prefix cache reuse.
🌐 中文文档:README.zh.md
What is in the box
Five tools, all backed by DSH web's cordis RPC over HTTP /api/<endpoint>:
| Tool | Purpose |
|---|---|
dsh_list_workspaces |
Enumerate every workspace known to the running DSH web UI. |
dsh_create_session |
Adopt a directory (creating the workspace if missing), then create a session bound to it. Selects the model in one shot. Returns sessionId. |
dsh_send_message |
Send a prompt and block until the assistant turn completes. Returns the assistant text plus per-turn token usage including cacheReadTokens / cacheWriteTokens. |
dsh_get_session_stats |
Fetch cached projections: tokenUsage, sessionStats, contextPressure. |
dsh_resume_session |
Verify a session is still alive and surface its current model. Subsequent dsh_send_message calls reuse the prompt prefix. |
Requirements
- Python 3.10+
- A running
dsh webinstance onhttp://127.0.0.1:3080(override withDSH_BASE_URL) uv(recommended) orpip
Install
git clone https://github.com/cv588888888888888888888ju/dsh-web-mcp.git
cd dsh-web-mcp
uv sync
Then run as a stdio MCP server:
uv run dsh-web-mcp
Wire up Hermes Agent
Register with hermes mcp add:
hermes mcp add dsh --command uv --args --directory C:\Users\chenty\Documents\feishu-bot\dsh-mcp run dsh-web-mcp
⚠️ Known pitfall (tested):
- Do not pass
--env DSH_BASE_URL=...— it gets forwarded todsh-web-mcp's argparse and fails withunrecognized arguments. SetDSH_BASE_URLas a user/system environment variable instead.- A new session is required after registering (config loads at session start).
- If prompted
Enable all 5 tools? [Y/n/select], answerY.
Wire up Codex CLI
Edit %USERPROFILE%\.codex\config.toml (or ~/.codex/config.toml on other OS):
[mcp_servers.dsh]
command = "uv"
args = ["--directory", "C:\\path\\to\\dsh-web-mcp", "run", "dsh-web-mcp"]
# Optional, defaults to http://127.0.0.1:3080 if omitted
[mcp_servers.dsh.env]
DSH_BASE_URL = "http://127.0.0.1:3080"
Restart Codex CLI. The five dsh_* tools appear alongside the built-in tools.
Probe
probe.py is a developer-side smoke test that exercises all five tools end-to-end against the running DSH web UI:
uv run python probe.py
It prints a JSON blob per step; expected outcome is
{
"ok": true,
"step": "send_message",
"reply_contains": "TASK_OK",
"cacheReadTokens": 8192
}
Failure modes
- DSH web not reachable — the server starts but every tool returns
{"ok": false, "error": "DSH web not reachable at ..."}. Make suredsh webis running (dsh web --port 3080). - DSH schema drift (rc.X → rc.Y) — unknown field errors come back as
{ok: false, error: "dsh returned <code>: <msg>"}. The model schema inmodels.pyis intentionallyextra="allow"so additional fields pass through; reported mis-parses should be filed againstmodels.py. - Prompt timeout —
dsh_send_messagetimes out aftertimeout_s(default 120s); rerun with a larger value if your prompt is long.
Configuration
Environment variables read by dsh-web-mcp:
| Var | Default | Description |
|---|---|---|
DSH_BASE_URL |
http://127.0.0.1:3080 |
DSH web base URL. |
DSH_TIMEOUT_S |
60 |
Per-request timeout in seconds (generous; a single LLM turn may take ~30s). |
DSH_MCP_LOG |
INFO |
Python logging level (use DEBUG to see wire-level traffic). |
CLI flags mirror the env vars: --base-url, --timeout, --check.
Why this exists
By default Codex CLI talks to the OpenAI / Azure providers directly. When MCP routing through DSH, the deepseek-v4-flash preset in DSH keeps system + tools + conversation prefix cached, so every subsequent turn in the same session reads 8K+ cached tokens and only pays uncached input for the new prompt + uncached output for the new reply — measured per tokenUsage.cacheReadTokens in dsh_send_message results.
Background
This project was built as a learning exercise by an undergraduate student exploring agent tooling. The bulk of the code was generated by an LLM coding agent (Codex CLI + DeepSeek) under human direction; every line was reviewed and the behavior verified end-to-end before publication. Bugs are likely given the author's experience level — please open issues.
Status
Pre-release. API surface follows DSH 0.1.0-rc.6 schema (rpc-map.d.ts); regenerate from source if you bump DSH.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。