Skip to main content
Glama

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.

License: MIT Python 3.10+ MCP

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

Eight 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. When the agent requests permission, it answers via an MCP sampling callback (see below) so the turn keeps running.

dsh_wait_turn

Wait for the in-flight turn to finish without sending a new prompt. Use it after answering a pending approval.

dsh_list_pending_approvals

List still-pending approval requests (approvalId, toolName, callId?, reason?, rpcId), optionally filtered by session_id.

dsh_respond_approval

Answer one pending approval (allowed-once / rejected); returns the DSH receipt (accepted: true = the answer was consumed).

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.

Related MCP server: workiq-mcp-bridge

Approval callback (ๆƒ้™ๅฎกๆ‰นๅ›ž่ฐƒ)

DSH agents ask for permission before sensitive tool calls (e.g. a sandbox escalation to danger-full-access). The request surfaces in the session log as approval/asked and โ€” on the DSH web event stream โ€” as an answerable approval/requested frame. This bridge turns that into a two-track callback:

  1. Sampling callback (default, works with Hermes CN Desktop โ‰ฅ 0.18): while dsh_send_message / dsh_wait_turn are waiting for the turn, the server sends the client a sampling/createMessage request describing the tool and the DSH-provided reason; the client's answer (allowed-once / rejected) is posted back to DSH via POST /api/respond and the turn continues. Hermes supports this out of the box (sampling enabled by default; see its Native MCP docs). Sampling needs to run inside an MCP request, so it is only active on the real MCP transport.

  2. Tool fallback (works with any MCP client): set auto_respond_approvals=false on dsh_send_message (or sampling fails / is unavailable), and the call returns immediately with awaitingApproval: true + pendingApprovals instead of waiting. The caller (or a human) then decides:

    dsh_send_message(...)                    -> {"awaitingApproval": true, "pendingApprovals": [...]}
    dsh_respond_approval(session_id, <approvalId>, "allowed-once")   -> {"accepted": true}
    dsh_wait_turn(session_id, ...)           -> normal turn result

    dsh_list_pending_approvals lists whatever is still pending at any moment (the DSH event stream replays every unanswered approval on connect).

Wire facts (verified against DSH source and a live probe): the answer must echo the rpcId of the approval/requested frame โ€” a fresh UUID minted by the host's pending table, not the audit approvalId โ€” and the payload must carry the matching approvalId. The event stream is a WebSocket (GET /api/events.mux; plain HTTP gets 426), which is why the websockets package is a hard dependency.

Requirements

  • Python 3.10+

  • A running dsh web instance on http://127.0.0.1:3080 (override with DSH_BASE_URL)

  • uv (recommended) or pip

  • websockets (installed by uv sync; needed for the approval event stream)

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 to dsh-web-mcp's argparse and fails with unrecognized arguments. Set DSH_BASE_URL as a user/system environment variable instead.

  • A new session is required after registering (config loads at session start).

  • If prompted Enable all 8 tools? [Y/n/select], answer Y.

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 eight dsh_* tools appear alongside the built-in tools.

Probe

probe.py is a developer-side smoke test that exercises all tools end-to-end against the running DSH web UI โ€” including the approval chain (trigger a real approval, answer it with accepted: true, and wait for the turn to finish):

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
}

The approval steps report send_message_awaiting_approval, respond_approval (accepted: true), and wait_turn_after_approval (reply_contains: "APPROVAL_OK").

Failure modes

  • DSH web not reachable โ€” the server starts but every tool returns {"ok": false, "error": "DSH web not reachable at ..."}. Make sure dsh web is 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 in models.py is intentionally extra="allow" so additional fields pass through; reported mis-parses should be filed against models.py.

  • Prompt timeout โ€” dsh_send_message times out after timeout_s (default 120s); rerun with a larger value if your prompt is long. An approval that nobody answers also holds the turn: use dsh_list_pending_approvals / dsh_respond_approval (or wait for the human in the DSH web UI) and then dsh_wait_turn.

  • Sampling unavailable โ€” outside an MCP request (e.g. probe.py) or with a client that does not implement sampling/createMessage, dsh_send_message falls back to returning awaitingApproval: true with pendingApprovals; use the tool fallback above.

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

MIT

Available Tools

5 tools
dsh_create_sessionA

Create a new DSH session bound to a directory; auto-creates the workspace if missing. Returns the sessionId for follow-up tool calls.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNoModel id (defaults to deepseek-v4-flash).deepseek-v4-flash
providerNoProvider id (defaults to the bundled deepseek-official).deepseek-official
workspace_pathNoAbsolute directory path the session should be rooted at (e.g. C:\\Users\\chenty\\code).
reasoning_effortNoOptional reasoning effort id (off/high/max).

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden of behavioral disclosure. It does reveal a key side effect ('auto-creates the workspace if missing') and the return value (sessionId), but omits potential error conditions, permission requirements, or whether the operation is safe/idempotent beyond auto-creation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core action, and every word adds valueโ€”no filler or redundant phrasing.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 0 required parameters and full schema coverage, the description explains the core behavior (auto-create workspace) and output (sessionId), linking it to follow-up calls. It lacks error-handling or prerequisite details, but the essentials for correct invocation are present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers 100% of parameters with meaningful descriptions (model, provider, workspace_path, reasoning_effort). The description reinforces workspace_path's role with 'bound to a directory' but adds minimal new meaning beyond the schema, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Create' and the resource 'a new DSH session' bound to a directory, with the additional behavior 'auto-creates the workspace if missing' and the return value 'sessionId'. This distinguishes it from siblings like dsh_resume_session (resume) and dsh_list_workspaces (list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description positions the tool as the entry point for starting a new session, noting it 'Returns the sessionId for follow-up tool calls', implying use before dsh_send_message or dsh_get_session_stats. It does not explicitly name alternatives or exclusions, but the word 'new' and the sibling names make when-to-use clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

dsh_get_session_statsB

Fetch cached projections (tokenUsage, sessionStats, contextPressure) for a DSH session.

ParametersJSON Schema
NameRequiredDescriptionDefault
session_idNo

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds useful detail by calling the projections 'cached', implying the data may not be real-time, and lists the fields returned. However, it does not disclose error behavior, session existence requirements, or explicitly confirm read-only semantics (though 'Fetch' implies it). With no annotations, the description partially but inadequately carries the transparency burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that immediately states the action and key specifics. No filler or redundancy, every word contributes to understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple getter, the description covers the basic purpose and lists fields, but given there is no output schema, it does not explain what the projections mean or how they behave (e.g., staleness, availability). Usage context vs. alternatives is also missing, leaving the tool functional but not fully self-contained.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides only a type for session_id with 0% description coverage. The description mentions 'for a DSH session', which clarifies the parameter's reference, but does not explain the expected format, source, or how to obtain a valid session_id. It fails to compensate for the lack of schema-level description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Fetch') and the target ('cached projections for a DSH session'), naming specific fields (tokenUsage, sessionStats, contextPressure). This distinguishes it from sibling tools like dsh_create_session and dsh_send_message, which are write/action operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives, such as when a session is active vs. cached, or when to call it in a workflow. The description lacks any context about prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

dsh_list_workspacesA

List every DSH workspace known to the local dsh web UI.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description conveys a read-only listing behavior and adds context about the data source ('local dsh web UI'), but it does not disclose return format, sorting, pagination, or potential errors. For a simple list tool this is adequate, though not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no filler words. Every word contributes to the meaning and the tool's scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, no-output-schema list tool, the description fully covers what the tool does and where the data comes from. It is complete for an agent to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and the schema is empty (100% coverage), so the description does not need to add parameter details. The 0-param baseline of 4 applies here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('List') and resource ('every DSH workspace') and clearly scopes to 'the local dsh web UI,' distinguishing it from session-focused sibling tools. It is immediately obvious what this tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (when you need all workspaces known to the local UI) and implies no exclusions, though it does not explicitly name alternatives. The sibling names are all session-related, so the use case is evident.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

dsh_resume_sessionA

Re-load an existing DSH session and verify its cached state. Subsequent dsh_send_message calls reuse the prompt prefix.

ParametersJSON Schema
NameRequiredDescriptionDefault
session_idNo

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses that it verifies cached state and affects subsequent send_message calls, which is useful. However, it does not disclose error behavior (e.g., what happens if the session_id is invalid), authentication requirements, or whether any state is mutated. This is adequate for a simple re-load tool but leaves gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core purpose and immediately followed by a key behavioral note. Every word earns its place; there is no fluff or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with one optional parameter and no output schema, the description is fairly complete: it covers the primary action and a key side effect. However, it omits what happens if the session is missing or invalid, and does not mention any prerequisites. Given the low complexity, this is a reasonable but not exhaustive description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has a single string parameter 'session_id' with no description. The tool description does not explicitly explain the format or required context of session_id, relying on the phrase 'existing DSH session' to imply its purpose. This adds little meaning beyond the schema, especially since the schema coverage is 0%.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool re-loads an existing DSH session and verifies cached state, using a specific verb ('re-load') and resource ('DSH session'). It distinguishes from siblings by emphasizing 'existing' sessions, which contrasts with dsh_create_session, and notes its role relative to dsh_send_message.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context: it is for resuming an existing session, and it explicitly mentions that subsequent dsh_send_message calls reuse the prompt prefix, implying it should be called before send. It does not explicitly state when not to use it (e.g., for new sessions), but the contrast with dsh_create_session is implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

dsh_send_messageB

Send a prompt to a DSH session and block until the assistant turn completes. Result includes assistant text and token usage (cacheReadTokens / cacheWriteTokens).

ParametersJSON Schema
NameRequiredDescriptionDefault
promptNo
timeout_sNo
session_idNo
poll_interval_sNo

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full responsibility. It discloses blocking behavior and result content (assistant text, token usage), which is helpful. However, it omits the polling and timeout behavior hinted at by the parameters, and gives no error semantics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence, front-loaded with the action, then adding key result details. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no annotations or output schema, and the description leaves out parameter explanations and operational details like timeout behavior or session_id requirements. This is insufficient for a 4-parameter blocking tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% parameter coverage and the description does not explain any parameter. Only 'prompt' is contextually implied; session_id, timeout_s, and poll_interval_s are never described, leaving the agent to guess their meaning and roles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Send' with a clear resource 'prompt to a DSH session' and adds important behavioral detail about blocking until completion. This distinguishes it from sibling tools focused on session creation, stats, or resumption.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied: sending a prompt requires an existing session, so the user must know to create/resume one first. However, the description does not explicitly state prerequisites, alternatives, or when not to use this tool, leaving the agent without clear guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.8/5.0
Disambiguation4/5

Tool purposes are mostly distinct, but create_session and resume_session both establish a session for sending messages, and the difference (new vs existing) could confuse an agent without careful reading. Descriptions resolve the ambiguity, so only minor overlap remains.

Naming Consistency5/5

All tools share the dsh_ prefix and follow a clean verb_noun pattern: create_session, send_message, get_session_stats, resume_session, list_workspaces. The naming is perfectly consistent and predictable.

Tool Count5/5

With 5 tools, the server is well-scoped for session and workspace management. Each tool has a clear role, and the count is within the ideal range for a purpose-built MCP.

Completeness3/5

Core workflow is covered (create/resume, send, stats, list workspaces), but the surface lacks session deletion or a way to list existing sessions directly. These are notable lifecycle gaps that agents may hit when trying to manage or clean up sessions.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cv588888888888888888888ju/dsh-web-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server