dsh-as-mcp: Expose DeepSeek Harness as an MCP Service

Preface

DeepSeek Harness (DSH) already manages workspaces, runs agent sessions, reads and writes files, and executes commands on its own. If you are simultaneously using Claude Code, Codex, another DSH instance, or want to drive the same harness with scripts in CI, the common approach is to write another layer of glue code: either wrapping the API separately, or reimplementing the sandbox and permission logic locally.

dsh-as-mcp takes a different path: it mounts an MCP endpoint inside the DSH host process, exposing capabilities consistent with the harness externally. Sessions created through MCP are the same real sessions visible in the DSH interface, running under the same sandbox and the same permission policy, with no need for the agent side to “reimplement DSH.”

Below we introduce the plugin’s positioning, tool capabilities, installation and connection methods, and the security boundaries you need to understand before distributing tokens.

What Is This

  • Name: dsh-as-mcp (the npm package name is the same as the plugin id)
  • Maintainer: xiseliuli
  • Category: Workflow (community directory SkillHub)
  • Source code: github.com/xiseliuli/dsh-as-mcp (MIT license; current version in package.json is 0.1.5)
  • In one sentence: Exposes a running DSH instance as an MCP server, letting any MCP client create workspaces, open sessions, dispatch coding tasks, read and write files, and execute shell commands.

The endpoint runs inside the host process and, via the MCP tools registered by the plugin, calls the harness’s built-in workspace, session, fs, shell, and other services, rather than building a parallel agent runtime.

Core Functions

Transport and Authentication

  • Clients connect via Streamable HTTP or stdio (via the dsh-as-mcp bridge provided in the package).
  • Each request requires a Bearer token, resolved in this order: plugin config auth.token → $DSH_HOME/dsh-as-mcp/token → auto-generated on first run and written (with permissions 0600).
  • Default HTTP endpoint: http://127.0.0.1:8790/mcp; when headers cannot be set, ?token= can be used, but the documentation recommends using headers to avoid credentials ending up in shell history or proxy logs.

MCP Tools Overview

Tool Purpose
dsh_info Endpoint, token source, enabled tool groups, harness services available to the current profile
workspace_create / workspace_list Register or list workspaces
session_create / session_list / session_messages / session_cancel Create, list, read records of, or cancel DSH agent sessions
session_prompt Dispatch tasks to a session; by default waits for the turn to finish and returns the reply and the tools the agent called
file_read / file_write / file_list Read, write, and list directories via the DSH filesystem service
shell_run Execute commands via the DSH shell service
dsh_tool_list / dsh_tool_call List or call tools from the DSH agent tool whitelist under a specified sessionId

After connecting, you should first call dsh_info to distinguish cases such as “a service is not mounted for the profile” from “command execution failed.”

Typical Coding Workflow

The order given in the README is: create a workspace → create a session → drive the agent with a natural language task:

workspace_create { path: "/Users/me/project" }
  -> session_create { workspaceId: "..." }
  -> session_prompt { sessionId: "...", prompt: "Add a --verbose switch to the CLI and add a test." }
  • session_prompt: lets the DSH agent plan, modify files, and call built-in tools (including sub-agents) on its own.
  • file_* / shell_run: the caller operates directly, without going through agent reasoning.
  • dsh_tool_call: runs agent tools from the harness whitelist directly on an existing session; you must call dsh_tool_list first, and sessionId must be provided.

The tools configuration can disable exposure of a tool group, but the documentation emphasizes: this narrows down “what clients can discover,” and is not operating system-level isolation (see “Use Cases and Notes” below).

Installation and Enabling

DSH loads plugins via the profile’s bundle mechanism; dsh plugin add writes to dsh.profile.bundles, and the package’s cordis.patch.yml provides the default plugin line. DSH must be restarted after installation—the bundle patch is read at startup and hot-reloading is not supported.

dsh plugin --profile <name> add dsh-as-mcp

Inside a DSH source checkout, the equivalent is:

pnpm dsh plugin --profile <name> add dsh-as-mcp

From GitHub

dsh plugin --profile <name> add github:xiseliuli/dsh-as-mcp

Git dependencies pull the source code, and the package’s prepare script must be executed (tsdown && node scripts/build-client.mjs). pnpm ≥10 may report ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED because build scripts are not allowed; following the exact git spec in the error, add it to allowBuilds in ~/.dsh/profiles/<name>/pnpm-workspace.yaml, then retry add. Pinning to a specific commit is also recommended. For details, see the “Installation” section of the repository README.

From a Local Tarball

pnpm pack
dsh plugin --profile <name> add /absolute/path/dsh-as-mcp-<version>.tgz

Verify It Is Loaded

dsh --profile <name> --dump-config | grep -A 30 '# == dsh-as-mcp'

Environment requirements (package.json): Node ^22.19.0 || >=24.0.0; Harness peer dependency @deepseek-ai/dsh ≥ 0.1.5-rc.1.

The desktop profile of DSH Desktop cannot directly use the CLI dsh plugin add. You need to follow the README’s “Install into DSH Desktop” section to manually pnpm add the tarball and edit cordis.patch.yml, and avoid inserting duplicate plugin lines with the same id in both dsh.profile.bundles and the patch.

Typical Usage: Connecting an MCP Client

HTTP Client

In the MCP configuration, point to the local endpoint and include the token (the “Copy” button in the settings panel generates a fragment with the token already filled in):

{
  "mcpServers": {
    "dsh": {
      "type": "http",
      "url": "http://127.0.0.1:8790/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

Clients That Only Support stdio

{
  "mcpServers": {
    "dsh": {
      "command": "npx",
      "args": ["-y", "dsh-as-mcp"],
      "env": { "DSH_AS_MCP_TOKEN": "<token>" }
    }
  }
}

You can run dsh-as-mcp --help locally to check the endpoint and token status the bridge will use.

Smoke Verification

scripts/smoke.mjs is provided in the installation directory: it performs a handshake, tools/list, dsh_info, and workspace_list; on success it outputs OK. Adding --prompt "..." runs the full workflow (temporary workspace → session → agent task).

Use Cases and Notes

Who Is This For

  • Users who already run DSH on a local machine or intranet and want Claude Code, Codex, another agent, or CI scripts to drive the same harness via the MCP standard.
  • Users who need to remotely orchestrate “real DSH sessions” (visible in the UI, with auditing and permissions consistent with manual operations), rather than simulating a coding agent in an external process.

Installation and Trust

  • The plugin runs with the permissions of the current DSH process user; actions on the MCP side ultimately go through the harness’s fs, shell, and session services.
  • The documentation compares the bearer token to an SSH private key: the token is the security boundary, and by default it listens on 127.0.0.1. A caller holding the token can access any path the DSH process can reach via file_* and shell_run; the workspace mainly constrains the agent’s starting point and does not enclose these direct tools.
  • The bridge is instance-level: session_list / session_messages can see other sessions within this instance (including conversations you opened manually in the UI). Before distributing the token, you need to assess the privacy and trust scope.
  • Switches like tools.shell: false cannot replace a separate account or OS-level sandbox; if callers are untrusted, you should use a separate instance, a non-privileged user, and read the source code and MIT license before installation.

Approval Policy

  • approval.policy: inherit (default): when there is no browser connection, tools requiring human approval fail closed for the agent.
  • approval.policy: allow: automatically approves approval requests for sessions created by this plugin, facilitating unattended tasks, but expands the agent’s executable scope.

The community plugin directory SkillHub has no official affiliation with DeepSeek or Hunyuan; the DSH ecosystem emphasizes “everything is a plugin,” and this package is tagged with the dsh-plugin topic for easier discovery.

Conclusion

dsh-as-mcp extends DSH from “only usable in the local UI or CLI” to a standard MCP backend: external agents still operate the same workspace, session, and sandbox, without needing to reimplement the harness. After installing per profile, restarting, and configuring the token and client, use dsh_info to verify the services and tool groups, then follow workspace_create → session_create → session_prompt to reproduce the coding workflow in the README.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye