dsh-peer: An MCP Bridge Enabling Two DeepSeek Harness Instances to Collaborate

Introduction

The plugin-based architecture of DeepSeek Harness (DSH) allows local agents to invoke a wide range of tools. However, when deploying across multiple machines, a common challenge arises: how do two agents on a local network call each other? Traditional approaches often rely on cloud relays or shared session files, introducing extra network and permission overhead. dsh-peer provides a lightweight, peer-to-peer, MCP/HTTP-based bridging solution that enables two DSH instances on the same network to act as peers and drive each other’s agents.

What It Is

dsh-peer is a zero-dependency MCP server that exposes the local agent of the current DSH instance as 12 MCP tools. Paired with the official @deepseek-ai/dsh-mcp-client, it establishes a peer relationship between two machines: one acts as the server (running dsh-peer), and the other acts as the client (running dsh-mcp-client), exchanging messages over HTTP. Three or more agents collaborate through a hub + rooms model, providing message delivery confirmation, retries, and explicit task ownership.

Core Capabilities

1. 12 MCP Tools

Through dsh-mcp-client, these tools are namespaced as mcp__<serverName>__<tool>, for example calling mcp__phone__peer_ask on the PC and mcp__pc__peer_ask on the phone.

  • peer_ask: Sends a prompt to the peer’s agent. Supports specifying session, timeout, mode (sync/async/poll), task ID, idempotency key, require, and artifacts parameters.
  • peer_task: Waits for or reads an async task result. Accepts a maximum wait time.
  • peer_sessions: Lists session slots on the peer and their turn counts.
  • peer_history: Reads recent messages from a session slot. Can limit the number of entries.
  • peer_status: Returns host info, platform, model, identity, sandbox mode, capabilities, task counts, and more.
  • room_say: Publishes a message in a group room. Can specify recipients or reply targets.
  • room_sync: Reads events in a room after a given seq, or uses long-polling with waitMs. Can mark messages as read (ack).
  • room_pending: Lists messages that the current member has not yet acknowledged (retry view).
  • room_ack: Marks events up to a specified seq as read.
  • room_claim: Claims a message to prevent multiple members from processing the same task simultaneously.
  • room_accept: Records a decision (accepted/rejected) on a message with optional notes.
  • room_list: Lists all rooms with their members, latest seq, and last message.

2. CHATv1 Chat Protocol

To avoid confusion when both agents start with “helpful assistant,” an identity must be set on both sides. Each message is identified by a single-line envelope indicating its origin:

[[CHATv1 from=phone msg=phone-20261119T152819Z-tkwgad ts=2026-11-19T15:28:19Z chain=- reply=-]]
收到

Key fields:
- from: The sender’s identity (pc, phone, etc.). No envelope indicates a message from a human.
- msg: <from>-<UTC timestamp>-<base36 suffix>. Resending the same msg returns the cached result without executing a new turn.
- ts: UTC timestamp, suffixed with Z.
- chain: Message forwarding chain (e.g., pc>phone). Direct conversation is -.
- reply: The msg being replied to. A new thread is -.

Replies automatically include from and reply headers. Responses exceeding maxChunkChars are split into multiple chunks. If envelope parsing fails, the text is still treated as a human line, and the failed parsing fields are returned.

3. Capability Checks, Pre-flight, and Artifacts

Capability Query

peer_status returns a capabilities object. Use it preferentially to understand what the other side can do, rather than guessing from the platform string alone. For example:

{
  "protocol": "chatv1.1",
  "identity": "phone",
  "platform": "linux/arm64",
  "cwd": "/root/workspace",
  "shell": "bash",
  "sandbox": "danger-full-access",
  "tools": ["bash", "read", "write", "edit"],
  "writableRoots": ["/root/workspace"],
  "async": true,
  "artifacts": { "fetch": true, "hosts": [], "maxBytes": 67108864, "strict": false },
  "limits": { "maxChunkChars": 60000, "taskTimeoutMs": 1800000, "askTimeoutMs": 240000, "maxSlots": 8 }
}

Note: tools: null means the deployment did not declare a tool list; it does not imply “no tools available.”

Pre-flight

Using the require parameter, you can query the peer for required conditions before execution:

{
  "prompt": "build and install the APK",
  "require": { "tools": ["bash"], "sandbox": "danger-full-access" }
}

If the conditions cannot be met, the call immediately returns a failure and lists the missing items. unverified indicates the peer did not declare the capability—it may or may not satisfy it. This is reported only and does not trigger a direct rejection.

artifacts[] Validation

Artifacts declared in the prompt must be provided in artifacts[] to avoid the situation of “describing a file but not providing verifiable information.” Each entry is verified via a HEAD check for existence and length; if sha256 is present, a streaming checksum is performed (capped by artifactMaxBytes). On success:
- The information is prepended to the agent’s prompt for trust;
- Written to <data dir>/transfers/<port>/<ts>-<rand>.json (up to 200 entries retained);
- Attached to the task record, visible long-term via peer_task.

Setting strictArtifacts: true (or require.artifacts: true) will reject the call if a URL referenced in the body is not declared in artifacts[].

4. Group Rooms (Hub Mode)

Three or more agents need a hub for coordination. Rooms are configured on the hub via YAML:

rooms:
  lobby:
    members: [pc, phone, laptop]
  build:
    members: [pc, phone]
roomMaxEvents: 2000

Each room is an append-only log where every message has a unique seq. Members only need to establish one client connection to the hub and can then use tools like room_say, room_sync, and room_list for collaboration.

Typical Usage

1. Establishing a Peer Relationship

Start dsh-peer on one machine and configure serverName; on the other machine, connect to that address using dsh-mcp-client. At this point, both sides can invoke the other’s MCP tools, e.g., mcp__phone__peer_ask or mcp__pc__peer_ask.

2. Simple Q&A

Call the phone’s agent from the PC:

{
  "prompt": "今天天气怎么样?",
  "session": "peer:default"
}

Call the PC’s agent from the phone:

{
  "prompt": "把上面的回复翻译成英文",
  "session": "peer:default"
}

3. Async Tasks and Status Queries

Initiate an async task and poll for results:

{
  "prompt": "运行 ls -la 并返回结果",
  "mode": "async",
  "taskId": "my-task-001"
}

Then query from the other side via peer_task:

{
  "taskId": "my-task-001",
  "waitMs": 10000
}

4. Capabilities and Pre-flight

Before initiating work, ask the peer whether it has the required capabilities:

{
  "prompt": "帮我备份 /data 目录",
  "require": { "tools": ["bash"], "sandbox": "danger-full-access" }
}

If the peer returns a failure, you can adjust your strategy based on output.missing.

5. Group Room Collaboration

After configuring rooms on the hub, other members only need to point to the hub’s address to use the room tools. For example, member A sends a message:

{
  "room": "lobby",
  "text": "大家好,开始讨论架构方案",
  "to": "pc"
}

Member B listens for new events via room_sync:

{
  "room": "lobby",
  "since": 5,
  "waitMs": 5000
}

Use Cases and Considerations

  • Ideal for developers needing cross-device collaboration: run DSH on desktop and mobile separately, use dsh-peer to make them tools for each other, with no cloud relay required.
  • Suited for multi-device coordination: through hub + rooms, multiple devices can share context and message history.
  • Suited for scenarios requiring precise control over permissions and delivery: capabilities, require, and artifacts validation ensure work actually gets done.
  • Note: The plugin runs with the permissions of the current DSH process. Review the source code and license before use (this project uses the MIT license).
  • Version requirement: DSH version must satisfy >=0.2.1-rc.2 <0.3.0-0.

Conclusion

With zero dependencies, dsh-peer connects two DSH instances over MCP/HTTP, providing capabilities such as peer Q&A, async tasks, session management, capability pre-flight, and artifacts validation. It also supports scaling to multi-device collaboration through the hub model. For developers looking to build multi-agent workflows within a local network, this is a ready-to-use tool.

References

  • Plugin catalog page: https://www.skillhub.cn/plugins/CC2027MK2/dsh-peer
  • GitHub repository: https://github.com/CC2027MK2/dsh-peer
羽毛球分组比赛记分
小程序二维码

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

Xiaoye