rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
xsnnnnnn/dsh-coros
DeepSeek Harness plugin: bridges the official COROS (高驰) MCP server with a self-contained stdio<->HTTP bridge and on-device OAuth login. 34 COROS tools for sleep/HRV/RHR/recovery/training-load, activities and FIT files, plus workout and training-plan APIs.
PROJECT TOPICS
PROJECT README
Bridges the official COROS (高驰) MCP server into DeepSeek Harness. One install exposes the full mcp__coros__* tool set: sleep, HRV, resting heart rate, recovery, training load, activities and FIT files, plus workout / training-plan CRUD and scheduling (34 tools on the current endpoint; may change with the server).
Self-contained: the stdio bridge, the OAuth login flow and token refresh all live in this package. No external CLI, no absolute paths in your profile, no local callback port.
fetch, crypto, fs, http); nothing to npm install.login-start / login-finish are separate processes and open no local port.engines.dsh is a bottomless minimum (>=0.2.1-rc.1), and if a future DSH changes the MCP-client JS API the plugin falls back to mounting the same row through the core Cordis Loader. It is not silently gated off by a version bump.~/.dsh/coros-mcp/<region>/token.json (0600), outside the profile config, never printed in logs, no telemetry, no third-party server in the data path.tools/list schemas with top-level $defs/$ref; the bridge inlines them so providers do not reject createScheduledWorkout with Pointer '/$defs/Section' does not exist.lib/proxy.mjs is a standard MCP stdio server usable from any MCP client.DeepSeek Harness
└─ dsh-coros-mcp (host plugin, this package)
└─ registers the DSH MCP client (serverName=coros)
│ JSON-RPC / stdio
▼
lib/proxy.mjs bridge: token cache, refresh with a file lock, tools/list $ref inlining
│ HTTPS POST + Authorization: Bearer <access_token>
▼
https://mcpcn.coros.com/mcp (official COROS MCP, CN region)
The bridge exists because DSH's MCP client speaks stdio / static headers while the COROS endpoint requires expiring OAuth 2.0 bearer tokens.
Login (lib/login.mjs) uses COROS' gateway CLI login session: dynamic client registration + PKCE(S256) + browser authorization + polling for the one-time loginTicket + server-side code exchange. No local listener is started, so login-start and login-finish are independent processes and Windows has no port conflicts.
No longer because of a version mismatch. How it works:
engines.dsh (app-boot → evaluatePluginCompatibility) with semver.satisfies(..., { includePrerelease: true }). Earlier builds declared a finite range (the 0.2.1 line plus a single 0.2.2 RC); when DSH auto-updated to a newer RC the range no longer matched, so the plugin was skipped silently — that is why the COROS tools disappeared after a DSH update.engines.dsh is a bottomless minimum: >=0.2.1-rc.1. With includePrerelease: true that covers 0.2.1, 0.2.2, future 0.2.x RCs, 0.3.x, 1.x — normal DSH upgrades will not gate it out again.@deepseek-ai/dsh-mcp-client JS exports, the plugin falls back to mounting the same MCP-client row through the core Cordis Loader (ctx.loader.create, the same path profile patches use). Only when both registration paths fail does it log an explicit [coros-mcp] could not attach the DSH MCP client warning.A GitHub/tarball install does not auto-upgrade the plugin itself; re-run
dsh plugin add <new tgz>when a new build is available.
Requires DeepSeek Harness ≥ 0.2.1-rc.1 (engines.dsh is a bottomless range, so future versions are not blocked) and Node.js ≥ 20 (the DSH runtime provides one).
# tarball (recommended for sharing)
& '<DSH>\resources\runtime\cli\bin\dsh.cmd' plugin --profile desktop add 'github:xsnnnnnn/dsh-coros'
# linked directory (development)
& '<DSH>\resources\runtime\cli\bin\dsh.cmd' plugin --profile desktop add 'D:\path\to\dsh-coros-mcp'
No local build needed: download
dsh-coros-mcp-<version>.tgzfrom GitHub Releases, or install straight from the repository:dsh plugin --profile desktop add 'github:xsnnnnnn/dsh-coros'.
Then enable dsh-coros-mcp in Settings → Plugins and restart DSH if needed.
Migrating from a hand-wired setup: back up the profile
cordis.patch.ymland delete the manualid: mcp-coros@deepseek-ai/dsh-mcp-clientrow. Keeping both registers the samemcp__coros__*tool names twice and the tool registration fails.
node '<package>\lib\login.mjs' login-start # prints/opens the authorization URL
node '<package>\lib\login.mjs' login-finish # completes the session, caches the token
node '<package>\lib\login.mjs' login-status # offline status
node '<package>\lib\login.mjs' refresh # refresh now
node '<package>\lib\login.mjs' logout # delete local token/pending files
~/.dsh/coros-mcp/<region>/token.json (0600, atomic writes). That is outside the profile directory, so profile-config backups never capture them.~/.coros-mcp-skill-gateway-ts/<region>/token.json (the official COROS CLI cache) is read as a fallback, so an existing login keeps working with zero migration. A new login writes to the plugin-owned path, which wins afterwards.token.json.lock).--region cn|eu|us or configuration.Optional config: fields on the bundle row (defaults are built in):
| Field | Default | Meaning |
|---|---|---|
serverName |
coros |
Tool prefix (mcp__coros__*) |
cacheRoot |
$DSH_HOME/coros-mcp |
Token cache root |
region |
inferred | cn / eu / us |
issuer |
per region | Override the OAuth issuer |
mcpUrl |
<issuer>/mcp |
Override the MCP endpoint |
nodePath |
auto-detected | Node executable used to spawn the bridge |
requestTimeoutMs |
30000 |
Per-request timeout towards COROS |
toolCallTimeoutMs |
120000 |
Per-tool-call timeout (DSH side) |
failOnStartupError |
false |
Fail profile startup when the bridge cannot start |
enabled |
true |
Keep installed but disconnected when false |
Environment fallbacks (lower priority): COROS_MCP_CACHE_ROOT, COROS_MCP_REGION, COROS_MCP_ISSUER, COROS_MCP_URL, COROS_MCP_TIMEOUT_MS.
lib/proxy.mjs is a plain MCP stdio server and works with any MCP client:
{
"mcpServers": {
"coros": { "command": "node", "args": ["D:\\path\\to\\dsh-coros-mcp\\lib\\proxy.mjs"] }
}
}
Diagnostics:
node lib\proxy.mjs --status # region / cache / expiry, offline
node lib\proxy.mjs --selftest # real initialize + tools/list against COROS
| Symptom | Fix |
|---|---|
No mcp__coros__* tools |
node lib\proxy.mjs --status; search DSH logs for stderr lines starting with [coros-mcp] |
no COROS login found |
run login-start / login-finish |
token refresh failed (HTTP 400) |
refresh token rotated/revoked — log in again |
timed out waiting for the token lock |
delete token.json.lock after confirming no other COROS process runs |
| Tools disappear after a DSH upgrade | 1.0.2+ is no longer gated by the version check; if it still happens, search the DSH log for [coros-mcp] (likely an MCP-client API change) and install the plugin build for that DSH version |
Tokens never leave the machine, are stored 0600 outside the profile, and are never printed; logs contain only region, endpoint and expiry metadata. The plugin makes no network request at startup — only tool calls, --selftest and explicit login/refresh commands reach COROS.
npm test # 39 unit + mock-issuer end-to-end tests (no network)
npm run status # offline status
npm run selftest # real endpoint: initialize + tools/list
npm pack # prepack runs scripts/prepack-check.mjs
| Path | Purpose |
|---|---|
lib/index.js |
Host half: registers the DSH MCP client (direct import + Loader fallback) |
lib/proxy.mjs |
stdio↔HTTP bridge (--status / --selftest / MCP stdio server) |
lib/login.mjs |
Self-contained OAuth: login-start / login-finish / login-status / refresh / logout |
lib/config.mjs |
Token cache, region resolution, refresh with a cross-process file lock |
cordis.patch.yml · dsh.plugin.json |
Bundle manifest and plugin metadata |
assets/icon.png |
Plugin icon (DSH plugin page / marketplace card) |
test/ |
42 offline tests, including the full mock-issuer login/refresh flow |
scripts/prepack-check.mjs |
Pre-publish static checks (manifest/icon/secret leakage) |
engines.dsh: >=0.2.1-rc.1 (no upper bound, covers future releases; DSH evaluates with includePrerelease: true); dsh.compatibility.dshReleases: 0.2.1-rc.5, 0.2.2-rc.1 = compatible.See README.zh.md for the full Chinese documentation.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: mcp、deepseek-harness。