
ClockNext
io.github.ClockNext由 GitHub 账号 ClockNext 发布v0.6.0更新于 Oct 24, 2026
Meter usage and manage usage-based billing from AI tools via the ClockNext API.
概览
让助手查看和配置 ClockNext 按用量计费:模型、套餐、额度、客户与用量日志。
- 可以做什么
- 提供访问 ClockNext 计费 API 的工具:识别密钥所属组织以及处于沙箱还是正式环境,列出已启用模型及其每百万 token 的美元价格,启用目录中的模型,并读取客户的用量日志、余额和当前套餐。还包括目录增删改查(套餐、额度、成果、单位)、客户工具(create_customer、create_purchase、bulk_import_customers)以及文档搜索。它只配置计费,不负责计量;真实用量信号由产品自身代码通过 ClockNext SDK 发出。
- 适用场景
- 当助手需要为某个组织搭建或检查 ClockNext 按用量计费时使用:查看有哪些模型和套餐、创建客户与购买记录,或确认产品代码发出的用量信号是否真正到达。它面向接入引导和计费管理,而不是运行时计量。
- 运行要求
- 通过 stdio 在本地运行,通常使用 npx -y @clocknext/mcp,因此需要 Node.js 以及访问 ClockNext API 的网络。必须在 CLOCKNEXT_API_KEY 环境变量中提供 ClockNext 组织 API 密钥。可选的 CLOCKNEXT_BASE_URL 和 CLOCKNEXT_DOCS_URL 可覆盖 API 与文档地址。仅支持桌面端,没有托管端点。
安装
在 SourceWeft 中
- 打开 控制台中的 ClockNext,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@clocknext/mcp
The Clocknext MCP server — meter usage, verify signals, and manage usage‑based billing directly from AI coding tools (Claude Code, Cursor, Codex, Antigravity, …) and any other Model Context Protocol client.
It runs locally over stdio: your AI tool spawns it as a subprocess, and your
organisation's cnk_… API key stays in the server's environment — never in the
model's context.
This repo ships two things:
- the MCP server (
@clocknext/mcp) — the tools an agent calls. - the
clocknext-onboardingskill — the step‑by‑step playbook that drives a full setup using those tools (human‑in‑the‑loop, sandbox‑first).
Install them together (the Claude Code plugin) or separately. Pick by what you want and which agent you're on:
The skill and the MCP server work together — the skill drives the tools — so for the full guided experience install both (or just use the plugin, which bundles them). The plugin is the one‑command option, but Claude Code only.
A Clocknext API key is required for the tools: Settings → API Keys →
cnk_…. It is a server‑side secret — keep it in env/secret config, never in client code or a repo.
1 — The skill (every AI coding agent)
The clocknext-onboarding skill is the guided playbook (detect models →
entitlements → plan → meter the codebase → test with a dummy customer). It
drives the MCP tools, so install the MCP server too (§2 below) — the skill
on its own has nothing to call.
Install it with npx skills — one command, works
across Claude Code, Cursor, Codex, Windsurf, Gemini, Antigravity, VS Code, and
~20 other agents. Target your agent with --agent so it lands where that
agent actually looks:
Swap claude-code for cursor, codex, windsurf, … (or * for every
detected agent). npx skills list shows what's installed;
npx skills remove clocknext-onboarding removes it. After installing, restart
the agent — most load skills at startup.
Claude Code, read this. Claude Code only loads skills from
~/.claude/skills/,.claude/skills/, or a plugin — not the CLI's default universal.agents/skills/folder. So you must pass--agent claude-code(as above), which installs to~/.claude/skills/(with--global) or.claude/skills/. A barenpx skills add …puts it in.agents/skills/, where Claude Code will never see it. Simplest of all for Claude Code: use the plugin — it registers the skill natively and wires the MCP in one step.
Manual install (no CLI)
Copy the folder from the repo into your agent's skills directory:
For tools without a native skills folder (Cursor / Windsurf / Codex / Antigravity),
point their rules file at skills/clocknext-onboarding/SKILL.md — e.g.
.cursor/rules/clocknext-onboarding.md, Windsurf Rules, or AGENTS.md. Keep the
references/*.md files alongside SKILL.md.
2 — The MCP server (every AI coding agent)
Gives you the tools the skill (and you) call — one stdio server,
npx -y @clocknext/mcp, with your CLOCKNEXT_API_KEY in its env.
Most clients take the standard block below — same JSON, they just differ on the file it goes in:
CLI agents
Claude Code — one command:
Gemini CLI — ~/.gemini/settings.json → the standard block.
Codex — ~/.codex/config.toml:
GitHub Copilot CLI — copilot mcp add, or ~/.copilot/mcp-config.json:
OpenCode — ~/.config/opencode/opencode.json (note: mcp root, command
is an array, env is environment):
Factory (Droid) — droid mcp add, or the standard block in its config
with "type": "stdio" added to the server:
Kimi Code — kimi mcp add clocknext -- npx -y @clocknext/mcp (set
CLOCKNEXT_API_KEY in the environment; config lives in ~/.kimi/config.toml).
IDEs
Cursor — .cursor/mcp.json (project) or ~/.cursor/mcp.json (global) → the
standard block.
Windsurf — ~/.codeium/windsurf/mcp_config.json → the standard block.
Antigravity — its MCP settings JSON → the standard block.
Kiro — .kiro/settings/mcp.json (project) or ~/.kiro/settings/mcp.json
(user) → the standard block. Kiro doesn't inherit your shell PATH, so if
npx isn't found, use its full path (which npx).
VS Code (native MCP / Copilot) — .vscode/mcp.json (uses servers, not
mcpServers):
Any other MCP client — point it at the stdio command npx -y @clocknext/mcp
with CLOCKNEXT_API_KEY in env. @clocknext/mcp is also in the official
MCP Registry as
io.github.Clocknext-Inc/mcp, so registry‑aware clients can discover it directly.
(The older entry io.github.Clocknext/mcp stops at 0.13.0: the GitHub
organisation was renamed to Clocknext-Inc, and the registry only lets it publish
under its own name.)
Environment
3 — The Claude Code plugin (Claude Code only)
The one‑command option — installs the MCP server and the clocknext-onboarding
skill together, and wires the API key for you. Claude Code only (the plugin
format is Claude Code's; other agents use §1 + §2 above).
Claude Code prompts for your Clocknext API key at install (stored securely), runs
the bundled server, and auto‑discovers the skill from the plugin's skills/
folder. Verify:
/mcp→ theclocknexttools are listed.- The skill triggers automatically when you start any Clocknext work (or check your installed skills).
No manual config, no env vars, nothing to build.
Tools
Plus catalogue CRUD (create_plan / create_credit / create_outcome /
create_unit …), customer tools (create_customer, create_purchase,
bulk_import_customers), and the docs tools (search_docs, get_doc). Run
/mcp to see the full list.
A typical agent flow: whoami → list_models → get_customer_plan (confirm
the plan, and that every model and agent key the code will send resolves) → run
the product's own code so it fires a real signal through @clocknext/sdk →
the SDK's signals.usageLog({ customerId }) (confirm it landed). The clocknext-onboarding skill
orchestrates all of this.
The MCP configures billing but never meters it. There is no record/track
tool by design, and no preview either: real signals come from your product's
code via the SDK (signals.credit / .wallet / .outcome), which is also the
only thing that proves the integration end-to-end. The SDK's signals.usageLog()
is the proof one landed; the MCP has no usage-read tool.
Development
Built on the official @modelcontextprotocol/sdk, with its own small fetch
client for the Clocknext API (src/api.ts), all bundled into dist/ by tsup. stdio today; a hosted Streamable‑HTTP variant is planned.
Logs go to stderr (stdout is the protocol channel). The committed dist/ is
what the plugin runs — rebuild and commit it on any code change.
Releasing (maintainers) — automated
A tag push publishes both the npm package and the official MCP Registry entry,
via .github/workflows/publish-mcp.yml:
The workflow checks the tag matches package.json, builds, npm publishes (with
provenance), then authenticates to the registry with GitHub OIDC (no secret)
and publishes server.json. It hosts only metadata pointing at the npm package,
so the npm publish runs first.
One‑time setup: add an NPM_TOKEN secret (repo → Settings → Secrets → Actions).
To drop the token entirely, configure npm trusted publishing (OIDC) for
@clocknext/mcp on npmjs.com and delete the NODE_AUTH_TOKEN line.
Manual release (no CI)
See the MCP Registry docs.
来源:README.md,提交 e8ecff6
工具
0版本历史
1- v0.6.0最新Sep 16, 2026
评分
已满足适用检查项的 40%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
请在仓库或注册中心条目中声明许可证。