zeronews-mcp

v0.1.6
zeronews-mcp Checked 4 days ago Published 1 month ago

ZeroNews MCP connector (stdio) — wraps the zeronews CLI for Cursor / WorkBuddy

npm 包名 zeronews-mcp(CLI bin 同名)。源码目录仍为 zeronews-mcp-connector/。 Point the host at dist/index.js (see Cursor config below). Per WorkBuddy MCP+Skill layout: zip root contains connector-meta.json, mcp.json, icon.svg, skills/, plus dist/ + production node_modules/. Set connectorRoot to the unzip root (not a connector/ subfolder). User supplies auth token via token-schema.json.

Summary extracted from the README.

zeronews-mcp

npm 包名 zeronews-mcp(CLI bin 同名)。源码目录仍为 zeronews-mcp-connector/。

在线安装(对外可发): ../docs/zeronews-mcp-online-install.md
Agent 自动配置(npx + 声明 executable/workdir): ../docs/zeronews-mcp-agent-install.md
离线 tgz(内网 handoff): ../docs/zeronews-mcp-local-install.md

Prerequisites

  • Node.js ≥ 20
  • ZeroNews client on the machine (download); MCP wraps the CLI, it does not replace the client binary
  • An MCP host: Cursor, WorkBuddy, Claude Desktop, or any stdio MCP client

Installation (choose one)

A. Monorepo / git checkout (typical for developers)

git clone <repo> && cd zeronews-mcp-connector
npm install    # runs prepare → build
npm test       # optional

Point the host at dist/index.js (see Cursor config below).

B. WorkBuddy connector zip (open platform upload)

npm run pack:connector
# → release/zeronews-mcp-<version>-workbuddy.zip   (upload this)

Per WorkBuddy MCP+Skill layout: zip root contains connector-meta.json, mcp.json, icon.svg, skills/, plus dist/ + production node_modules/. Set connectorRoot to the unzip root (not a connector/ subfolder). User supplies auth token via token-schema.json.

B2. WorkBuddy 专家 zip (market expert, not connector)

npm run pack:expert
# → release/zeronews-expert-<version>-workbuddy.zip   (开放平台「专家」上传)

Source: workbuddy-expert/ — user-facing expert copy + skill (not the connector SKILL). Standalone expert (no dependencies.connectors); uses local CLI when present (open.workbuddy.cn/docs/expert). Run npm run pack:workbuddy to build connector + expert zips.

C. Local .tgz (offline or internal handoff)

npm run pack:connector
cd /target/dir && npm install /path/to/release/zeronews-mcp-0.1.2.tgz

MCP config:

{
  "mcpServers": {
    "zeronews": {
      "command": "npx",
      "args": ["-y", "zeronews-mcp"],
      "env": {
        "ZERONEWS_EXECUTABLE": "/path/to/zeronews",
        "ZERONEWS_WORKDIR": "/path/to/workdir"
      }
    }
  }
}

(npx resolves the package’s bin → zeronews-mcp → dist/index.js.)

D. Public npm / npx (metadata ready; publish when you run npm publish)

Package is MIT, publishConfig.access: public, not yet on registry until first publish.

npm login
cd zeronews-mcp-connector && npm test && npm publish

Users then:

npx -y zeronews-mcp

Maintainer flow: ../docs/zeronews-mcp-connector-npm-publish.md.

Host MCP config: "command": "npx", "args": ["-y", "zeronews-mcp@<version>"] or global npm i -g zeronews-mcp + "command": "zeronews-mcp".

Without public npm, alternatives that work today:

  • npm install github:<org>/<repo>#path=zeronews-mcp-connector (if repo is accessible)
  • npm install file:./zeronews-mcp-0.1.2.tgz

E. End-user flow after MCP is wired

  1. Host loads MCP → tools appear (install_client, expose_local_service, …).
  2. install_client — find zeronews binary / workdir.
  3. Start client if needed (service_start or zeronews start).
  4. configure_auth — control-plane auth token (WorkBuddy: connector token field).
  5. Map a service — after login and running (client_status), list_local_listeners (host Questions card) then expose_local_service with the chosen port, or add_tunnel when the port is already known.

Reload the MCP process after changing ZERONEWS_* env vars.

Build

cd zeronews-mcp-connector
npm install
npm run build
npm test

Run (stdio MCP)

node dist/index.js

Cursor / local MCP config example

{
  "mcpServers": {
    "zeronews": {
      "command": "node",
      "args": ["/absolute/path/to/zeronews-mcp-connector/dist/index.js"],
      "env": {
        "ZERONEWS_EXECUTABLE": "/Applications/zeronews/zeronews",
        "ZERONEWS_WORKDIR": "/Applications/zeronews"
      }
    }
  }
}

Changing ZERONEWS_WORKDIR / ZERONEWS_EXECUTABLE at runtime requires restarting the MCP process or calling install_client with explicit workdir / executable.

When ZERONEWS_WORKDIR is set, MCP always uses that directory (it does not switch to another path because config.yml exists elsewhere). Run zeronews login / authtoken in that workdir if it has no config yet.

Tools

Tool Description
install_client Probe + official download install when missing (download_install; Linux sh -s install without token). Binding is via login, not install
configure_auth / prompt_auth_token Legacy aliases: browser login (no Auth Token / authtoken in MCP)
auth_status / client_status Config + status --json
list_endpoints Public endpoints on this client (endpoints --json)
list_account_tunnels Account tunnel list (show tunnels --json)
list_account_domains Account domain list (show domains --json)
list_account_clients Account devices (show devices --json)
add_domain Platform domain; omit subdomain → Questions: 输入 first, then 8 random prefixes
delete_tunnel Delete tunnel by ID; picker then user_confirmed: true required
delete_domain Delete platform domain; picker then user_confirmed: true
delete_port Delete domain port; picker then user_confirmed: true
delete_client Delete client device; picker then user_confirmed: true
enable_tunnel / disable_tunnel `zeronews tunnel enable
enable_client / disable_client `zeronews device enable
upgrade_client zeronews device upgrade … --json (precheck via device download-resolve); skips when already latest
install_client Probes install; when installed, CP download/latest precheck + optional binary update from CP download_url
list_local_listeners Port picker (after client logged in + running): local TCP listeners plus choices labels. Returns can_list_listeners: false until ready
expose_local_service Create a tunnel for a port the user already picked. Does not list listeners or open a port form
add_tunnel zeronews add --json (LFS via tunnel_kind=lfs; optional bw Mbps)
service_install / service_start / service_stop / service_restart / service_status / service_uninstall OS service
client_reload reload --json or POST /reconnect fallback
login Browser confirm (zeronews login); poll client_status while login_pending

All tools return JSON text; check the ok field in the payload.

CLI is tried first; when the client is running, read tools may fall back to Local API (used_local_api_fallback: true). Env: ZERONEWS_EXECUTABLE, ZERONEWS_WORKDIR, ZERONEWS_DOWNLOAD_BASE (default https://download.zeronews.cc), ZERONEWS_CONTROL_PLANE_URL, ZERONEWS_LOCAL_API_BEARER, optional ZERONEWS_EXCLUDE_LISTENER_PORTS, optional ZERONEWS_MCP_AUTO_LOGIN=true to let ensure flows open browser login (default: return login in next_steps only).

CI

Monorepo workflow: ../.github/workflows/zeronews-mcp-connector-test.yml

WorkBuddy bundle

connector/ — meta, mcp.json, token schema, skill, icon.

npm run pack:connector
# → release/*-workbuddy.zip (WorkBuddy 控制台上传)
# → release/*.zip (legacy layout)
# → release/*.tgz (npm)

Design: ../docs/workbuddy-mcp-design-token-path.md.