Skip to main content
Glama

DSH MCP for Codex

Let Codex hand tasks to the DeepSeek Harness (DSH) agent already installed on your machine, and read the answer back.

  • Zero dependencies — the MCP server uses only Node built-ins

  • No install assumptions — discovers DSH Desktop (including custom install dirs, via the Windows uninstall registry) or a dsh CLI on PATH

  • No re-implementation — DSH keeps its own model route, tools, skills, and sandbox; Codex keeps its own conversation

  • Continuable — replay the returned session through dsh_continue

Codex ──(MCP)── dsh-mcp ──(stdio)── dsh --profile headless ── DSH agent

中文说明

Install

# A. Codex plugin marketplace
codex plugin marketplace add lcs331/dsh-codex-bridge
codex plugin add dsh@dsh-codex-bridge

# B. from source
git clone https://github.com/lcs331/dsh-codex-bridge.git
codex mcp add dsh -- node /abs/path/dsh-codex-bridge/bin/dsh-mcp.mjs

The npm package is not published yet. After it is published, a one-line npx installation can be added here.

Related MCP server: DSH Subagent MCP

Credentials (the usual snag)

The headless profile disables DSH's credential store, so a headless run never reads the keys saved by the Desktop UI. It looks them up in this order:

  1. the launch environment

  2. <task cwd>/.env

  3. $DSH_HOME/.env

Recommended: pass the key through the environment that launches Codex. For example, set it in PowerShell and start Codex from that same shell:

$env:DEEPSEEK_API_KEY = "sk-..."
codex

Setting the variable in another shell after Codex is already running will not update its environment. Do not copy secrets out of DSH Desktop credential files. The MCP server passes only runtime essentials, DSH_HOME, and the configured model credential variables to the DSH child process; it does not pass the full Codex environment.

No key yet? Create one at https://platform.deepseek.com (API Keys) and provide it through the launch environment, or point OPENCODE_GO_API_KEY at a third-party route and set DSH_MCP_PATCH to the overlay that registers that provider. The same overlay is applied to headless tasks and ACP session continuations.

DSH also reads <task cwd>/.env and $DSH_HOME/.env; those files store keys in plain text. Prefer the launch environment to avoid creating another plaintext copy.

One-off, nothing on disk: $env:DEEPSEEK_API_KEY = "sk-..." before launching Codex.

Run dsh_doctor first on a new machine; it reports the discovered installation and whether a credential is reachable.

Tools

Tool

Purpose

dsh_list_workspaces

List project folders registered in DSH and their workspace ids

dsh_list_sessions

List session ids and saved titles in one selected DSH workspace

dsh_task

One self-contained task, fresh DSH session, returns the final answer

dsh_continue

Continue a DSH session; for an open Desktop session it waits for the completion report

dsh_get_result

Read a pending or completed report from an open DSH Desktop session

dsh_doctor

Report the discovered installation and credential status

Call dsh_list_workspaces to select a DSH project folder. Pass its workspace_id to dsh_task; the registered folder becomes the working directory. To continue, call dsh_list_sessions with that workspace_id, then pass both the same workspace_id and a listed session_id to dsh_continue. New tasks use DSH's headless profile. For an open Desktop conversation, the optional DSH-side companion in desktop-host/ routes the message through the live Agent as a user message, so it appears in the existing DSH UI without competing for ACP's session write lock. Install it from DSH Desktop → Settings → Plugins by adding the local bundle directory <path-to-this-repo>/desktop-host, then restart DSH to load it. The Electron app exclusively manages the desktop profile, so the dsh plugin --profile desktop add ... CLI command is rejected. The bridge binds only to loopback and uses a random local bearer token stored under $DSH_HOME/plugins/dsh-codex-bridge/; the token is never returned by an MCP tool. In auto mode, dsh_continue uses only the Desktop companion and never falls back to ACP. If the companion or target session is unavailable, it stops without competing for a possible UI write lock. Set transport: "acp" explicitly only after closing the session in DSH Desktop, or use transport: "desktop" to require visible delivery. ACP keeps the saved permission and directory settings; permission requests are rejected because MCP has no interactive approval UI. Session listings include ids, saved titles, and archive state; they read only the title projection and do not return conversation contents. Existing direct cwd calls remain supported.

For an open Desktop session, dsh_continue waits for the matching DSH completion event and returns the assistant report in Codex. If the wait limit expires, use dsh_get_result with the returned request_id. Reports stay in the local DSH companion process for up to 30 minutes and are capped at 64 KiB. The bridge associates a report after it sees the exact submitted user message ID and content; when DSH omits the ID, it accepts an exact-content echo. Duplicate echoes of the same message are ignored. A distinct user message before completion still marks the result ambiguous instead of guessing.

dsh_task arguments: task (required), workspace_id, cwd, permission_mode (read-only | workspace-write | danger-full-access | auto | plan), add_dirs, timeout_sec, session_id.

DSH cannot see the Codex conversation, so every task must restate its goal, constraints, target directory, and the evidence you want back.

Safety

  • permission_mode defaults to workspace-write: edits stay inside cwd

  • new headless tasks use approval policy never (headless has no approval UI; ask would block forever). ACP continuations preserve the saved DSH session permissions, but permission requests are rejected because MCP has no interactive approval UI.

  • the Desktop companion can only route to a live DSH agent; the MCP result confirms acceptance, while DSH's generated reply appears in the DSH UI

  • a timed-out run is killed and already-written files are not rolled back

  • raw DSH stderr is omitted from tool results by default; set DSH_MCP_DEBUG to include truncated diagnostics on failure

Compatibility

  • Node ≥ 20 (tested on 24)

  • Verified on Windows 11 + DSH Desktop 2.0.24-next (@deepseek-ai/dsh 0.2.2-rc.5) + Codex CLI 0.172.0

  • macOS/Linux discovery is implemented but untested

Development

node --test                      # run the test suite
node scripts/build-plugin.mjs    # regenerate both vendored plugin bundles before publishing

License

MIT

Available Tools

6 tools
dsh_continueA

Continue an existing DSH session with another instruction. The session keeps its conversation, working directory, and file changes from earlier calls. Default transport "auto" sends only through the DSH Desktop companion, so the message appears in the UI. If the companion or target session is unavailable, it stops without trying ACP. Set transport to "acp" only when you know the session is closed in DSH Desktop; set "desktop" to require visible delivery. Desktop reports can be read with dsh_get_result if the wait limit expires. Resume requires the same working directory the session recorded. Select a project session with dsh_list_sessions and pass the matching workspace_id and session_id. ACP permission requests are rejected because this tool has no interactive approval UI; saved permissions remain in effect.

Inputs: task (required), session_id (required), cwd, add_dirs, +4 more.

dsh_doctorA

Diagnose the local DeepSeek Harness installation used by this MCP server: which dsh entry was found, the DSH home, and whether a model credential is reachable. Call it when a delegation fails or before the first delegation on a new machine.

Inputs: no named parameters.

dsh_get_resultA

Read the latest status and completion report for a request sent to an open DSH Desktop session. Use the request_id returned by dsh_continue when its polling period expires. Results are stored locally and expire after 30 minutes.

Inputs: request_id (required).

dsh_list_sessionsA

List session ids and saved titles registered under one DSH workspace. This returns title metadata only, never conversation contents. Use the selected session_id together with the same workspace_id in dsh_continue.

Inputs: workspace_id (required).

dsh_list_workspacesA

List the project workspaces registered by DSH, including each workspace id, folder path, and session count. Use a returned workspace_id with dsh_task to start work in that folder or with dsh_list_sessions to choose a session.

Inputs: no named parameters.

dsh_taskA

Delegate one task to the DeepSeek Harness (DSH) agent installed on this machine and return its final answer. DSH runs as a separate coding agent with its own tools, model route, workspace, and sandbox; this call blocks until it finishes. Use it to offload research, a scoped implementation, a test run, or a second opinion, and to reach tools or skills that exist only in DSH. Each call opens a fresh DSH session unless session_id is supplied; call dsh_continue to keep working in the same session. Call dsh_list_workspaces first to choose a registered project folder.

Inputs: task (required), cwd, add_dirs, session_id, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 6 tools

    Disambiguation4/5

    Most tools have clearly distinct roles: listing workspaces, listing sessions, delegating, continuing, reading results, and diagnosing. The main overlap is dsh_task versus dsh_continue, since dsh_task can accept a session_id while dsh_continue is the dedicated continuation tool; descriptions clarify the intended split, but the boundary is not perfectly sharp.

    Naming Consistency3/5

    All names share the dsh_ prefix and snake_case, which aids recognition. However, the set is not consistently verb_noun: dsh_task and dsh_doctor are noun-like, while dsh_continue is verb-only, so the pattern is mixed but still readable.

    Tool Count5/5

    Six tools is well-scoped for a DSH integration. Each tool covers a distinct lifecycle step: workspace discovery, session discovery, delegation, continuation, result retrieval, and diagnostics.

    Completeness4/5

    Core delegation lifecycle is covered: discovering workspaces and sessions, submitting tasks, continuing sessions, retrieving results, and diagnosing the installation. Minor gaps exist around cancellation, session cleanup, or explicit task-status listing, but agents can work around them.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Codex Desktop or CLI to delegate tasks to an already running DeepSeek Harness Desktop over an authenticated local socket, reusing that Desktop's model configuration, Skills and allowed tools without a separate API key or runtime. Each delegated session runs in its own isolated directory or Git worktree so Codex can review results before integration.
      2
      MIT