@mcpbox/mcpbox-claude 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +6 -1
- package/bin/mcpbox-claude.mjs +24 -1
- package/commands/status.md +27 -11
- package/lib/opencode.mjs +115 -0
- package/lib/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcpbox-claude",
|
|
3
3
|
"description": "MCPBox × Claude Code glue. Drives the mcpbox MCP server (daruma tracker + full MeiSei pipeline torii→…→fujin→daruma). Ships /mcpbox:{tasks,plan,next,mine,status,close,sync,capture,doctor,mode} and pipeline commands, SessionStart/Stop/UserPromptSubmit hooks, and a managed CLAUDE.md policy that makes mcpbox the default tracker AND pipeline substrate.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.17",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tupical"
|
|
7
7
|
},
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mcpbox/mcpbox-claude
|
|
2
2
|
|
|
3
|
-
MCPBox agent harness for **Claude Code**, **Codex**, **Cursor**,
|
|
3
|
+
MCPBox agent harness for **Claude Code**, **Codex**, **Cursor**, **Kimi Code**, and **OpenCode**.
|
|
4
4
|
Wires the single canonical MCP server (`https://mcpbox.ru/v1/mcp` — the daruma
|
|
5
5
|
tracker tools plus the platform pipeline `torii→satori→enma→yatagarasu→fujin→daruma`)
|
|
6
6
|
and drops a managed policy into each agent's native config file.
|
|
@@ -52,6 +52,7 @@ init to update:
|
|
|
52
52
|
```bash
|
|
53
53
|
npx -y @mcpbox/mcpbox-claude@latest cursor-init
|
|
54
54
|
npx -y @mcpbox/mcpbox-claude@latest kimi-init
|
|
55
|
+
npx -y @mcpbox/mcpbox-claude@latest opencode-init
|
|
55
56
|
```
|
|
56
57
|
|
|
57
58
|
A stale version announces itself at session start on Claude, Codex, and Kimi.
|
|
@@ -68,6 +69,7 @@ installs, CI).
|
|
|
68
69
|
| Codex | `AGENTS.md` block (`mcpbox:policy`) | `[mcp_servers.mcpbox]` in `~/.codex/config.toml` | — |
|
|
69
70
|
| Cursor | `.cursor/rules/mcpbox-policy.mdc` + `/mcpbox-mode` | `mcpbox` entry in `.cursor/mcp.json` | — |
|
|
70
71
|
| Kimi | `AGENTS.md` block (`mcpbox:policy`) | `mcpbox` entry in `~/.kimi-code/mcp.json` | `[[hooks]]` block in `~/.kimi-code/config.toml` |
|
|
72
|
+
| OpenCode | `AGENTS.md` block (`mcpbox:policy`) | `mcpbox` remote entry under `mcp` in `~/.config/opencode/opencode.json` | — |
|
|
71
73
|
|
|
72
74
|
All four agents accept `mcpbox mode [off|lite|full]` through the managed
|
|
73
75
|
policy. Claude also exposes `/mcpbox:mode`, Cursor exposes `/mcpbox-mode`, and
|
|
@@ -95,6 +97,9 @@ mcpbox-claude cursor-uninit [--dir DIR]
|
|
|
95
97
|
mcpbox-claude kimi-init [--dir DIR] AGENTS.md policy + ~/.kimi-code/mcp.json server
|
|
96
98
|
+ ~/.kimi-code/config.toml [[hooks]].
|
|
97
99
|
mcpbox-claude kimi-uninit [--dir DIR]
|
|
100
|
+
mcpbox-claude opencode-init [--dir DIR] AGENTS.md policy + `mcpbox` entry under
|
|
101
|
+
"mcp" in ~/.config/opencode/opencode.json.
|
|
102
|
+
mcpbox-claude opencode-uninit [--dir DIR]
|
|
98
103
|
mcpbox-claude doctor [--json] Check the mcpbox MCP server + policy are wired.
|
|
99
104
|
mcpbox-claude mode [off|lite|full] Show or set the shared pipeline mode.
|
|
100
105
|
```
|
package/bin/mcpbox-claude.mjs
CHANGED
|
@@ -28,12 +28,13 @@ import {
|
|
|
28
28
|
installCursorModeCommand,
|
|
29
29
|
} from "../lib/cursor.mjs";
|
|
30
30
|
import { installKimi, removeKimi } from "../lib/kimi.mjs";
|
|
31
|
+
import { installOpencode, removeOpencode } from "../lib/opencode.mjs";
|
|
31
32
|
import { readMode, writeMode, MODES } from "../lib/mode.mjs";
|
|
32
33
|
|
|
33
34
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
34
35
|
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf8"));
|
|
35
36
|
|
|
36
|
-
const HELP = `mcpbox-claude v${pkg.version} — MCPBox agent harness (Claude / Codex / Cursor / Kimi)
|
|
37
|
+
const HELP = `mcpbox-claude v${pkg.version} — MCPBox agent harness (Claude / Codex / Cursor / Kimi / OpenCode)
|
|
37
38
|
|
|
38
39
|
Usage:
|
|
39
40
|
mcpbox-claude init [--dir DIR] Write the managed CLAUDE.md policy block
|
|
@@ -50,6 +51,10 @@ Usage:
|
|
|
50
51
|
mcpbox entry + [[hooks]] in ~/.kimi-code/config.toml.
|
|
51
52
|
Idempotent.
|
|
52
53
|
mcpbox-claude kimi-uninit [--dir DIR]
|
|
54
|
+
mcpbox-claude opencode-init [--dir DIR] Write AGENTS.md policy + mcpbox entry
|
|
55
|
+
under "mcp" in ~/.config/opencode/
|
|
56
|
+
opencode.json. Idempotent.
|
|
57
|
+
mcpbox-claude opencode-uninit [--dir DIR]
|
|
53
58
|
mcpbox-claude doctor [--json] Check the mcpbox MCP server + policy are wired.
|
|
54
59
|
mcpbox-claude mode [off|lite|full] Get/set pipeline strictness (how raw ideas route).
|
|
55
60
|
mcpbox-claude export-marketplace [--dir DIR]
|
|
@@ -151,6 +156,20 @@ async function cmdKimiUninit(rest) {
|
|
|
151
156
|
report(hooks);
|
|
152
157
|
}
|
|
153
158
|
|
|
159
|
+
async function cmdOpencodeInit(rest) {
|
|
160
|
+
const { projectDir } = parseDirFlag(rest);
|
|
161
|
+
const { policy, mcp } = await installOpencode({ projectDir });
|
|
162
|
+
report(policy);
|
|
163
|
+
report(mcp);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function cmdOpencodeUninit(rest) {
|
|
167
|
+
const { projectDir } = parseDirFlag(rest);
|
|
168
|
+
const { policy, mcp } = await removeOpencode({ projectDir });
|
|
169
|
+
report(policy);
|
|
170
|
+
report(mcp);
|
|
171
|
+
}
|
|
172
|
+
|
|
154
173
|
// Policy-only variants — for callers (mcpbox-cli setup) that already own the
|
|
155
174
|
// MCP-server wiring and just need the managed policy file dropped.
|
|
156
175
|
async function cmdCodexPolicy(rest) {
|
|
@@ -261,6 +280,10 @@ async function main(argv) {
|
|
|
261
280
|
return cmdKimiInit(rest);
|
|
262
281
|
case "kimi-uninit":
|
|
263
282
|
return cmdKimiUninit(rest);
|
|
283
|
+
case "opencode-init":
|
|
284
|
+
return cmdOpencodeInit(rest);
|
|
285
|
+
case "opencode-uninit":
|
|
286
|
+
return cmdOpencodeUninit(rest);
|
|
264
287
|
case "codex-policy":
|
|
265
288
|
return cmdCodexPolicy(rest);
|
|
266
289
|
case "cursor-policy":
|
package/commands/status.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Show
|
|
2
|
+
description: Show who and where you are on mcpbox — workspace, account, this repo's project — plus server and pipeline health.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
The user invoked `/mcpbox:status`.
|
|
@@ -8,18 +8,34 @@ The user invoked `/mcpbox:status`.
|
|
|
8
8
|
|
|
9
9
|
1. `daruma_healthz` — if it fails, report "mcpbox unreachable" and how to start the
|
|
10
10
|
server; stop (do not fall back to `.omc/plans/` or markdown).
|
|
11
|
-
2.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
→
|
|
15
|
-
|
|
11
|
+
2. `daruma_workspace_info` — one call carries most of the answer:
|
|
12
|
+
- `workspace.slug` / `workspace.title` — the authorized workspace;
|
|
13
|
+
- `account.email` — who this MCP session is authenticated as;
|
|
14
|
+
- `scopes[]` — repo→project bindings; match the current working directory
|
|
15
|
+
against `scope` (longest matching prefix wins, since repos nest) to find
|
|
16
|
+
this repo's `project_id`.
|
|
17
|
+
- Self-hosted installs have no cloud account, so `workspace` and `account`
|
|
18
|
+
may be absent. Omit the line entirely — never print `null` or a bare UUID.
|
|
19
|
+
3. Resolve the project **title** for that `project_id` via `daruma_project_list`
|
|
20
|
+
(the `name` inside `scopes` is only the directory basename, not the project's
|
|
21
|
+
title). Skip if the cwd matches no scope.
|
|
22
|
+
4. One scoped `daruma_list status=active` → count open tasks (do not enumerate
|
|
23
|
+
the archive).
|
|
24
|
+
5. `mcpbox_runs_list` with `limit=5` (and `status=failed` if the user asked about
|
|
25
|
+
failures) → recent pipeline runs.
|
|
26
|
+
6. Render, dropping any line whose value is unknown:
|
|
16
27
|
|
|
17
28
|
```
|
|
18
29
|
## mcpbox status
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
workspace: <title> (<slug>)
|
|
31
|
+
account: <email>
|
|
32
|
+
project: <project title> — <repo path>
|
|
33
|
+
open: <N> tasks
|
|
34
|
+
server: ok (v<version>, sha <git_sha>)
|
|
35
|
+
runs: <run_id> <status> · <run_id> <status> …
|
|
23
36
|
```
|
|
24
37
|
|
|
25
|
-
|
|
38
|
+
Identity first: "which workspace am I in, as whom, on what project" is the
|
|
39
|
+
question this command exists to answer; server health is the footnote.
|
|
40
|
+
|
|
41
|
+
7. Read-only.
|
package/lib/opencode.mjs
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// OpenCode surface for the mcpbox harness — parity with the Codex/Kimi
|
|
2
|
+
// surfaces. Two idempotent writes:
|
|
3
|
+
// 1. AGENTS.md policy block in the project directory. OpenCode discovers
|
|
4
|
+
// AGENTS.md from the working directory up the tree (same convention as
|
|
5
|
+
// Codex), so a project install covers that project without extra wiring.
|
|
6
|
+
// 2. `$OPENCODE_CONFIG_DIR/opencode.json` (default follows XDG:
|
|
7
|
+
// `$XDG_CONFIG_HOME/opencode`, else `~/.config/opencode/opencode.json`)
|
|
8
|
+
// — upsert the `mcpbox` entry under the top-level `mcp` key, preserving
|
|
9
|
+
// every other config key and server. A remote entry (`type: "remote"` +
|
|
10
|
+
// `url`) is OpenCode's HTTP transport.
|
|
11
|
+
//
|
|
12
|
+
// The policy body is BLOCK_BODY_PLAIN from lib/policy.mjs — one source of
|
|
13
|
+
// truth shared across CLAUDE.md / AGENTS.md / .cursor/rules, minus the
|
|
14
|
+
// Claude-only slash commands this surface cannot run.
|
|
15
|
+
|
|
16
|
+
import { promises as fs } from "node:fs";
|
|
17
|
+
import { homedir } from "node:os";
|
|
18
|
+
import { dirname, join, resolve } from "node:path";
|
|
19
|
+
import {
|
|
20
|
+
BLOCK_BODY_PLAIN,
|
|
21
|
+
MCP_URL,
|
|
22
|
+
installManagedBlock,
|
|
23
|
+
removeManagedBlock,
|
|
24
|
+
} from "./policy.mjs";
|
|
25
|
+
|
|
26
|
+
const BEGIN = "<!-- mcpbox:policy:begin -->";
|
|
27
|
+
const END = "<!-- mcpbox:policy:end -->";
|
|
28
|
+
|
|
29
|
+
const MCP_ENTRY = { type: "remote", url: MCP_URL, enabled: true };
|
|
30
|
+
|
|
31
|
+
// OpenCode config dir: explicit override (tests) > $OPENCODE_CONFIG_DIR >
|
|
32
|
+
// XDG ($XDG_CONFIG_HOME/opencode, else ~/.config/opencode).
|
|
33
|
+
export function opencodeHomeDir(home) {
|
|
34
|
+
if (home) return resolve(home);
|
|
35
|
+
const env = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
36
|
+
if (env) return env;
|
|
37
|
+
const xdg = process.env.XDG_CONFIG_HOME?.trim();
|
|
38
|
+
return join(xdg || join(homedir(), ".config"), "opencode");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function opencodeConfigPath(configPath, home) {
|
|
42
|
+
return configPath ? resolve(configPath) : join(opencodeHomeDir(home), "opencode.json");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// --- 1. AGENTS.md policy block in the project directory ---
|
|
46
|
+
|
|
47
|
+
export function installOpencodePolicy({ projectDir } = {}) {
|
|
48
|
+
const dir = projectDir ? resolve(projectDir) : process.cwd();
|
|
49
|
+
return installManagedBlock({ target: join(dir, "AGENTS.md"), begin: BEGIN, end: END, block: BLOCK_BODY_PLAIN });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function removeOpencodePolicy({ projectDir } = {}) {
|
|
53
|
+
const dir = projectDir ? resolve(projectDir) : process.cwd();
|
|
54
|
+
return removeManagedBlock({ target: join(dir, "AGENTS.md"), begin: BEGIN, end: END });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// --- 2. `mcpbox` entry under `mcp` in opencode.json ---
|
|
58
|
+
|
|
59
|
+
async function readConfig(target) {
|
|
60
|
+
try {
|
|
61
|
+
const doc = JSON.parse(await fs.readFile(target, "utf8"));
|
|
62
|
+
if (!doc || typeof doc !== "object" || Array.isArray(doc)) {
|
|
63
|
+
throw new Error(`${target} is not a JSON object`);
|
|
64
|
+
}
|
|
65
|
+
if (!doc.mcp || typeof doc.mcp !== "object") doc.mcp = {};
|
|
66
|
+
return doc;
|
|
67
|
+
} catch (err) {
|
|
68
|
+
if (err.code === "ENOENT") return {};
|
|
69
|
+
throw err;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function installOpencodeMcp({ configPath, home } = {}) {
|
|
74
|
+
const target = opencodeConfigPath(configPath, home);
|
|
75
|
+
const doc = await readConfig(target);
|
|
76
|
+
const before = doc.mcp?.mcpbox;
|
|
77
|
+
if (before && JSON.stringify(before) === JSON.stringify(MCP_ENTRY)) {
|
|
78
|
+
return { action: "unchanged", path: target };
|
|
79
|
+
}
|
|
80
|
+
doc.mcp = { ...doc.mcp, mcpbox: MCP_ENTRY };
|
|
81
|
+
await fs.mkdir(dirname(target), { recursive: true });
|
|
82
|
+
await fs.writeFile(target, JSON.stringify(doc, null, 2) + "\n");
|
|
83
|
+
return { action: before ? "updated" : "installed", path: target };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function removeOpencodeMcp({ configPath, home } = {}) {
|
|
87
|
+
const target = opencodeConfigPath(configPath, home);
|
|
88
|
+
let doc;
|
|
89
|
+
try {
|
|
90
|
+
doc = await readConfig(target);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
if (err.code === "ENOENT") return { action: "missing", path: target };
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
95
|
+
if (!doc.mcp?.mcpbox) return { action: "missing", path: target };
|
|
96
|
+
delete doc.mcp.mcpbox;
|
|
97
|
+
await fs.writeFile(target, JSON.stringify(doc, null, 2) + "\n");
|
|
98
|
+
return { action: "removed-block", path: target };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// --- Both surfaces at once (what `mcpbox-claude opencode-init` calls) ---
|
|
102
|
+
|
|
103
|
+
export async function installOpencode({ projectDir, home } = {}) {
|
|
104
|
+
const policy = await installOpencodePolicy({ projectDir });
|
|
105
|
+
const mcp = await installOpencodeMcp({ home });
|
|
106
|
+
return { policy, mcp };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export async function removeOpencode({ projectDir, home } = {}) {
|
|
110
|
+
const policy = await removeOpencodePolicy({ projectDir });
|
|
111
|
+
const mcp = await removeOpencodeMcp({ home });
|
|
112
|
+
return { policy, mcp };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { BEGIN, END };
|
package/lib/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.17";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcpbox/mcpbox-claude",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "MCPBox agent harness for Claude Code: managed policy (daruma tracker + full pipeline), hooks, and slash commands over the single mcpbox MCP server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|