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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.