Preface¶
DeepSeek Harness (DSH) defaults to targeting local browsers: sessions rely on Cookies, and core capabilities utilize /api/* RPC. If you want to connect Agent scheduling to MaiBot, Feishu, WeChat bots, or CI/CD, the common approach is to write an additional proxy layer or run scripts only on 127.0.0.1—public domain names, intra-container calls, and cross-origin Bearer authentication often require separate setups.
Below is an introduction to the community plugin dsh-postapi-bridge (Maintainer: ptrel1, Category: Networking Tools). It adds a login page, multi-account management, and a machine-side REST gateway to the DSH web profile, allowing external systems to schedule tasks and invoke MCP tools via Token-based POST requests without modifying the DSH core source code. (In DSH 0.1.5+ scenarios, the official connection layer already provides a /api login gate; this plugin handles the human channel and the machine channel itself).
What is this¶
dsh-postapi-bridge is a dual-sided extension plugin for DSH: one side handles human Web login and user management; the other side provides a lightweight HTTP POST / RESTful task scheduling and session-related gateway for external systems (including a direct invocation entry for MCP tools).
- Repository: https://github.com/ptrel1/dsh-postapi-bridge
- Community Directory Page: https://www.skillhub.cn/plugins/ptrel1/dsh-postapi-bridge
- Current Repository Version (package.json): 0.6.7
- License: MIT; Runtime Environment: Node.js >= 20
The package with the same name on npm is still stuck at 0.1.0. Documentation explicitly states it lacks subsequent security hardening and wiring. You should rely on the GitHub repository and avoid installing from the registry using dsh plugin add dsh-postapi-bridge.
Core Features¶
Human Web Channel¶
- Provides
/loginand/logoutfor login and session management (with an adaptive theme login page). - Supports independent permissions for multi-accounts and a Web account management panel.
- Local loopback (e.g.,
127.0.0.1) can allow direct passwordless access according to DSH and plugin semantics; public unauthenticated access is constrained by both official and plugin rules (DSH 0.1.5+ returning 401 for unauthenticated/api/*is expected behavior, not a fault).
Machine POST API Channel¶
Aimed at MaiBot, WeChat bots, Feishu, CI/CD, etc., providing an HTTP API that does not rely on Cookies:
- Authentication:
Authorization: Bearer <Token>orX-Gateway-Token. - Non-local requests to
/api/dsh/v1/*adopt a fail-closed policy: all requests without a valid Token are rejected;/api/dsh/v1/healthhealth checks are exempt from Token requirements. - Strict loopback determination does not rely solely on forgeable
X-Forwarded-Forheaders for authentication exemption (see documentation v0.6.4 security hardening notes).
Main HTTP Interfaces¶
| Path | Method | Auth | Description |
|---|---|---|---|
/login |
GET / POST | Form Username/Password | Web login and session |
/logout |
GET / POST | Cookie | Logout |
/api/dsh/v1/health |
GET | Passwordless or Token | Health and status; when audit is enabled, response includes "audited": true |
/api/dsh/v1/task |
POST | Bearer / X-Gateway-Token | Schedule DSH engine to dispatch Agent tasks |
/api/dsh/v1/mcp/tool |
POST | Bearer / X-Gateway-Token | Directly invoke DSH tools (e.g., bash, read) |
Provenance Auditing (Since v0.3.0)¶
Auditing can be logged for /api/dsh/v1/* requests: process log prefix [postapi-audit], and data/access-log.jsonl in the plugin data directory (default rotation retains 3 files when exceeding 5MB). Call sources can be distinguished via config.channels or the environment variable DSH_GATEWAY_CHANNELS (JSON, mapping token to channel name); config.accessLogDir allows customizing the audit directory. DSH web service must be restarted after modifying configuration.
Relationship with DSH Long Tasks (Background)¶
When external systems drive long tasks via the gateway, DSH compaction first performs syntax-level pruning on oversized tool results (dsh-compaction-tool-result-pruner), and if the budget is still exceeded, it proceeds to LLM summarization (dsh-compaction-basic). This helps control context size for gateway long-flows spanning multiple POSTs; details can be found in the explanation table in the repository README.
Installation and Activation¶
Installation from GitHub source to the web profile is recommended:
dsh plugin --profile web add git+https://github.com/ptrel1/dsh-postapi-bridge.git
Restart the DSH web service after installation to activate the plugin:
supervisorctl restart dsh-web
For local development or customization, you can mount a local directory using the link method (adjust paths for your machine), which also requires restarting dsh-web. Example from documentation:
cd ~/.dsh/profiles/web
dsh plugin --profile web add link:/main/app/github/dsh-postapi-bridge
supervisorctl restart dsh-web
Configuration items such as machine channel Tokens and channel mappings should follow the repository README and plugin settings; restart as described above after changing configuration.
Typical Usage Approach¶
The documentation does not provide complete curl request body examples, but the interface semantics are clear. You can test following these steps:
- Complete installation and restart
dsh-web, configure the gateway Token (and optionalconfig.channels). - Call the health check to confirm service and audit status:
curl -sS "https://your-domain/api/dsh/v1/health"
- Schedule tasks or invoke tools directly with a Token (replace
YOUR_TOKENand JSON body with actual values; body fields follow repository documentation):
curl -sS -X POST "https://your-domain/api/dsh/v1/task" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
curl -sS -X POST "https://your-domain/api/dsh/v1/mcp/tool" \
-H "X-Gateway-Token: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
- On the human side, access
/loginin a browser to complete Web login; for public deployments, ensure you understand both the official DSH gate for/api/*and the plugin’s Token requirements for the machine channel.
For client-side integration with MaiBot, the documentation mentions compatibility with maibot_dsh_bridge; specific wiring should follow the respective repository documentation.
Use Cases and Notes¶
Who is it for
- Those who need to expose DSH Agent tasks to bots, IM, or pipelines, and prefer standard HTTP + Token rather than just local Cookies.
- Those who need to provide Web multi-account login and management behind a public network or reverse proxy, coexisting with the machine API.
- Those already using or planning to use the DSH web profile (plugin
dsh.client.platformisweb).
Please be aware before use
- The plugin runs with the same permissions as the DSH process; please read the source code and MIT license at https://github.com/ptrel1/dsh-postapi-bridge before installation, and assess public exposure and Token custody yourself.
- Do not use the lagging npm package; the installation command should follow
git+https://github.com/ptrel1/dsh-postapi-bridge.gitin the README. - Before DSH 0.1.5, the README described needing to modify source code to add
requireSession; 0.1.5+ officially has a built-in browserAuth gate, so patching is generally no longer needed. For complete decisions on public network security and topology, seeskill/public-network-auth-guide.mdin the repository (if it exists). - Community directories like SkillHub are independent of DeepSeek / High-Flyer and are used for plugin discovery; they are not equivalent to official app stores.
Conclusion¶
dsh-postapi-bridge consolidates “Web multi-account login” and “Machine-side POST / REST gateway” into a single DSH plugin: humans use /login, while automation uses /api/dsh/v1/task and /api/dsh/v1/mcp/tool, supplemented by auditing and machine channel fail-closed policies.
- Directory Page: https://www.skillhub.cn/plugins/ptrel1/dsh-postapi-bridge
- Source Code and Complete API/Configuration Docs: https://github.com/ptrel1/dsh-postapi-bridge