Skip to content

Commit 2ea69a4

Browse files
SpecBridge v0.5: local MCP server, interactive task execution, and Claude Code plugin (#5)
* SpecBridge v0.5: local MCP server, interactive task execution, and Claude Code plugin Add packages/mcp-server: a local stdio MCP server (pinned @modelcontextprotocol/sdk 1.29.0, protocol baseline 2025-11-25) exposing the shared core packages as 21 typed tools, 7 read-only resources, and 4 workflow prompts, with the stable SBMCP001-020 error envelope, bounded paginated outputs, a per-project write mutex, stderr-only structured logging, and pinned project-root resolution. The CLI gains `mcp serve|doctor|manifest|tools` and `run recover-lock`. Add the direct interactive execution lifecycle in @specbridge/execution: task_begin -> the current host session edits source -> task_complete (plus task_abort), reusing the v0.3 Git snapshots, trusted verification commands, evidence evaluation, append-only evidence, and the verified-only surgical checkbox update. A repository-local lock file serializes runs across processes; recovery is explicit and never automatic. Run schemas gain interactive kinds and lifecycle fields, backward compatibly. Add the self-contained Claude Code plugin (integrations/claude-code-plugin/specbridge): bundled cli.cjs and mcp-server.cjs (no node_modules, no monorepo paths), POSIX and Windows CLI wrappers, eight namespaced skills (approve is human-only via disable-model-invocation), a repository-local marketplace (.claude-plugin/marketplace.json), a third-party license report, a SHA-256 checksum manifest, and a reproducible release ZIP. New scripts: build:plugin, validate:plugin, verify:plugin-bundle (mandatory isolated-copy verification), mcp:inspect. Safety: no arbitrary filesystem/shell/Git MCP tool, no model-controlled stage approval, no nested Claude invocation from plugin or MCP paths (enforced by content scans and tests), candidate hash binding between validate and apply, and no automatic Git mutations of any kind. All versions move to 0.5.0. 631 tests pass (520 regression + 111 new), plus 32 CLI smoke checks and 8 isolated bundle checks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Make plugin license-file discovery filesystem-case-independent The license report generator probed a fixed list of file names with existsSync, which behaves differently across filesystems: on Windows (case-insensitive) "LICENSE.md" matched express-rate-limit's and ms's "license.md", while on Linux it did not — so the ubuntu CI rebuild produced a different THIRD_PARTY_LICENSES.txt (and checksum manifest) than the committed artifact, failing the plugin-bundle reproducibility check. Discovery now lists the package directory and matches names against a case-insensitive licen[cs]e pattern with a deterministic sort, so every platform selects the same file. The committed artifact was already the complete report (generated on the case-insensitive side); only the script needed the fix, and ubuntu now reproduces the committed bytes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3650ff4 commit 2ea69a4

146 files changed

Lines changed: 125353 additions & 115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude-plugin/marketplace.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "specbridge-plugins",
3+
"owner": {
4+
"name": "HelloThisWorld"
5+
},
6+
"description": "Claude Code integrations for SpecBridge, the open spec runtime for existing Kiro projects.",
7+
"plugins": [
8+
{
9+
"name": "specbridge",
10+
"source": "./integrations/claude-code-plugin/specbridge",
11+
"description": "Kiro-compatible spec workflows, verified interactive task execution, and deterministic drift checks.",
12+
"version": "0.5.0",
13+
"license": "MIT",
14+
"keywords": [
15+
"spec-driven-development",
16+
"mcp",
17+
"kiro",
18+
"verification"
19+
],
20+
"category": "development",
21+
"strict": true
22+
}
23+
]
24+
}

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,13 @@ jobs:
4848
- name: GitHub Action bundle is reproducible
4949
if: matrix.os == 'ubuntu-latest'
5050
run: git diff --exit-code integrations/github-action/dist
51+
52+
- name: Validate the Claude Code plugin (deterministic, no Claude Code required)
53+
run: pnpm validate:plugin
54+
55+
- name: Verify the isolated plugin bundle (mandatory self-containment check)
56+
run: pnpm verify:plugin-bundle
57+
58+
- name: Claude Code plugin bundle is reproducible
59+
if: matrix.os == 'ubuntu-latest'
60+
run: git diff --exit-code integrations/claude-code-plugin/specbridge/dist

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ dist/
88
# The GitHub Action ships its reproducible bundle in-repo (checked in CI).
99
!integrations/github-action/dist/
1010

11+
# The Claude Code plugin ships its reproducible bundle in-repo too, so
12+
# installing the plugin straight from the GitHub marketplace source works.
13+
!integrations/claude-code-plugin/specbridge/dist/
14+
1115
# Test output
1216
coverage/
1317

CHANGELOG.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,89 @@
11
# Changelog
22

3+
## 0.5.0
4+
5+
Added:
6+
7+
- Local stdio MCP server (`specbridge mcp serve`) built on the official
8+
`@modelcontextprotocol/sdk` 1.29.0 (pinned; stable protocol baseline
9+
2025-11-25): 21 typed tools with versioned Zod input/output schemas,
10+
annotations, and the stable SBMCP001–SBMCP020 error envelope; 7 read-only
11+
resources (`specbridge://…`); 4 workflow prompts for non-Claude clients;
12+
bounded structured responses (pagination cursors, 1 MB documents, 2 MB
13+
responses, 500-diagnostic cap); `specbridge mcp doctor|manifest|tools`.
14+
- Direct interactive task execution: `task_begin` → the CURRENT host session
15+
edits source → `task_complete` (plus `task_abort`), reusing the v0.3 Git
16+
snapshots, trusted verification commands, evidence evaluation, append-only
17+
evidence, and the verified-only surgical checkbox update. Model-reported
18+
fields are recorded as claims, never proof.
19+
- Interactive execution locking (`.specbridge/locks/interactive-task.lock`):
20+
atomic acquisition, heartbeats, crash-tolerant staleness diagnosis, and
21+
the explicit `specbridge run recover-lock [--remove] [--json]` recovery
22+
command. Ambiguous or actively held locks are never removed.
23+
- Candidate stage authoring over MCP: `spec_stage_validate` (deterministic
24+
analysis + diff + approval effects + candidate hash, read-only) and
25+
`spec_stage_apply` (atomic, hash-bound to the reviewed bytes, dependent
26+
approvals invalidated per workflow rules, append-only
27+
`interactive-authoring` run record, no force option). Preview-first
28+
`spec_create` (apply: false renders without writing).
29+
- Self-contained Claude Code plugin
30+
(`integrations/claude-code-plugin/specbridge`): bundled `dist/cli.cjs` and
31+
`dist/mcp-server.cjs` (no node_modules, no workspace resolution, no
32+
monorepo paths), POSIX + Windows CLI wrappers, eight namespaced skills
33+
(`/specbridge:doctor·status·new·author·approve·implement·continue·verify`),
34+
third-party license report, and a SHA-256 checksum manifest.
35+
- Repository-local plugin marketplace (`.claude-plugin/marketplace.json`,
36+
strict mode) so `/plugin marketplace add HelloThisWorld/specbridge` works
37+
straight from a clone.
38+
- Isolated plugin bundle verification (`pnpm verify:plugin-bundle`): copies
39+
the built plugin to an isolated space-containing directory, runs the
40+
bundled CLI and wrappers against an outside fixture project, performs a
41+
real MCP stdio handshake, and proves no monorepo path is required — plus
42+
deterministic `pnpm validate:plugin` and the reproducible release ZIP
43+
artifact `dist/specbridge-claude-plugin-0.5.0.zip`.
44+
45+
Changed:
46+
47+
- Claude Code plugin task execution now uses the current session
48+
(task_begin/task_complete) instead of starting a nested Claude process;
49+
the v0.3 runner workflow remains fully supported from the standalone CLI.
50+
- Shared core APIs are exposed consistently through CLI and MCP; the MCP
51+
server is a thin typed adapter with no duplicated workflow, verification,
52+
Git, evidence, approval, or Markdown-writing logic
53+
(docs/cli-mcp-parity.md).
54+
- Run schemas now distinguish runner execution, interactive execution,
55+
interactive authoring, and deterministic verification (new optional
56+
`kind` values plus `lifecycleStatus`, `host`, and `abortReason`; every
57+
v0.3 record keeps validating unchanged).
58+
59+
Security:
60+
61+
- No arbitrary filesystem, shell, or Git MCP tool; no user-supplied
62+
executable or working directory; one pinned project root per server
63+
process.
64+
- No model-controlled stage approval: approval is not an MCP tool or
65+
prompt, and the plugin approve skill sets disable-model-invocation.
66+
- No nested Claude invocation from the plugin or MCP handlers — enforced by
67+
automated content scans and tests.
68+
- No stdout logging under stdio (structured stderr only, verified
69+
process-level); no secrets, prompts, or file contents in logs; run views
70+
and resources never expose raw prompts or runner output;
71+
`.specbridge/config.json` is only ever reported as a redacted status.
72+
- Candidate hash binding prevents validation/apply substitution; there is
73+
no force option.
74+
- State-changing MCP operations serialize behind a per-project write mutex,
75+
with the repository lock file guarding cross-process interactive runs.
76+
- No automatic Git commit, push, reset, stash, or rollback — including
77+
after protected-path violations, which are reported instead.
78+
79+
Deferred (documented on the roadmap, not claimed):
80+
81+
- production multi-runner support (v0.6)
82+
- templates, plugin SDK, extension registry, community ecosystem (v0.7)
83+
- remote MCP transports (HTTP/SSE/WebSocket), MCP OAuth, cloud hosting
84+
- public marketplace submission; npm publication of the packages
85+
- `spec sync` / `spec export`, SARIF output, Action PR comments
86+
387
## 0.4.0
488

589
Added:

README.md

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,42 @@ Codex, local models, or any supported coding agent.
1414
1515
> Your `.kiro` specs remain the source of truth.
1616
17-
Now with deterministic spec drift verification (v0.4) — Kiro helps you
18-
write specs; SpecBridge verifies whether the implementation still matches
19-
them:
17+
New in v0.5 — a self-contained **Claude Code plugin** with a local MCP
18+
server and verified interactive task execution:
19+
20+
```text
21+
/plugin marketplace add HelloThisWorld/specbridge
22+
/plugin install specbridge@specbridge-plugins
23+
/reload-plugins
24+
```
25+
26+
Then, inside any project that contains `.kiro/`:
27+
28+
```text
29+
/specbridge:doctor
30+
/specbridge:status
31+
/specbridge:implement notification-preferences 2.3
32+
/specbridge:verify
33+
```
34+
35+
```text
36+
/specbridge:implement
37+
38+
task_begin
39+
40+
current Claude session edits
41+
42+
task_complete
43+
44+
Git evidence + trusted verification
45+
46+
verified task completion
47+
```
48+
49+
The plugin bundles everything (CLI + MCP server + skills) — no global npm
50+
install, no nested Claude processes, and stage approval stays an explicit
51+
human action. Deterministic spec drift verification (v0.4) still guards the
52+
other end:
2053

2154
```text
2255
approved spec
@@ -179,6 +212,8 @@ Working today (fully offline, no model, no API key):
179212
| `specbridge spec affected` | **v0.4** — which specs does this change set touch (read-only) |
180213
| `specbridge spec policy init / show / validate` | **v0.4** — per-spec verification policies (impact areas, required commands, rule overrides) |
181214
| `specbridge verify rules / explain <id>` | **v0.4** — inspect the stable rule registry SBV001–SBV025 |
215+
| `specbridge mcp serve / doctor / manifest / tools` | **v0.5** — local stdio MCP server (21 tools, 7 resources, 4 prompts) |
216+
| `specbridge run recover-lock` | **v0.5** — diagnose and explicitly recover the interactive execution lock |
182217

183218
Planned commands (`spec sync/export`) are registered, marked "(planned)" in
184219
`--help`, and exit with an honest error — see the [roadmap](docs/roadmap.md).
@@ -444,7 +479,19 @@ SpecBridge stores no credentials of any kind.
444479
secrets or environment variables.
445480
- Full model: [docs/security.md](docs/security.md).
446481

447-
## Limitations (v0.4)
482+
## Limitations (v0.5)
483+
484+
- The MCP server is stdio-only and local-only: no HTTP/SSE/WebSocket
485+
transport, no OAuth, no cloud hosting. One server process serves one
486+
project root.
487+
- The plugin requires Node.js 20+ on PATH (the same requirement as Claude
488+
Code) and a Git repository for interactive task execution.
489+
- Interactive execution is strictly one task per run per repository,
490+
guarded by a lock file; recovery after a crash is explicit
491+
(`specbridge run recover-lock`), never automatic.
492+
- Claude Code plugin-scoped MCP tool prefixes are host-generated; skills
493+
reference tools by short name, and the effective prefixes are only
494+
verifiable inside a real Claude Code session (`/mcp`).
448495

449496
- Verification is deterministic, not semantic: it proves traceability,
450497
approval, evidence, scope, and command facts — it cannot judge whether
@@ -485,12 +532,14 @@ v0.2: offline spec authoring, deterministic analysis, hash-based approvals,
485532
stale-approval detection. v0.3: agent runner contract, the Claude Code local
486533
runner, model-assisted generation/refinement, approved task execution with
487534
git snapshots, trusted verification, append-only evidence, verified-only
488-
checkbox completion, manual acceptance, resumable sessions. v0.4 (this
489-
release): deterministic drift verification (rule engine SBV001–SBV025,
490-
policies, affected-spec resolution, evidence freshness, normalized task-plan
491-
approval hash, four report formats) and the production GitHub Action. Next:
492-
MCP server (K), more runners, `spec sync`/`spec export`, SARIF.
493-
Full detail: [docs/roadmap.md](docs/roadmap.md).
535+
checkbox completion, manual acceptance, resumable sessions. v0.4:
536+
deterministic drift verification (rule engine SBV001–SBV025, policies,
537+
affected-spec resolution, evidence freshness, four report formats) and the
538+
production GitHub Action. v0.5 (this release): the local stdio MCP server,
539+
direct interactive task execution, and the self-contained Claude Code
540+
plugin with its repository-local marketplace. Next — v0.6: production
541+
multi-runner support. v0.7: templates, plugin SDK, extension registry,
542+
community ecosystem. Full detail: [docs/roadmap.md](docs/roadmap.md).
494543

495544
## Documentation
496545

@@ -517,6 +566,18 @@ Full detail: [docs/roadmap.md](docs/roadmap.md).
517566
[GitHub Action](docs/github-action.md) ·
518567
[CI quality gates](docs/ci-quality-gates.md) ·
519568
[Claude Code integration](docs/claude-code-integration.md) ·
569+
[MCP server](docs/mcp-server.md) ·
570+
[MCP tools](docs/mcp-tools.md) ·
571+
[MCP resources](docs/mcp-resources.md) ·
572+
[MCP prompts](docs/mcp-prompts.md) ·
573+
[Interactive task execution](docs/interactive-task-execution.md) ·
574+
[Claude Code plugin](docs/claude-code-plugin.md) ·
575+
[Plugin installation](docs/plugin-installation.md) ·
576+
[Plugin development](docs/plugin-development.md) ·
577+
[Plugin marketplace](docs/plugin-marketplace.md) ·
578+
[Plugin security](docs/plugin-security.md) ·
579+
[Plugin release](docs/plugin-release.md) ·
580+
[CLI/MCP parity](docs/cli-mcp-parity.md) ·
520581
[Migration from Kiro](docs/migration-from-kiro.md) (spoiler: there is none) ·
521582
[Roadmap](docs/roadmap.md) ·
522583
[Changelog](CHANGELOG.md)

docs/architecture.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ instead of duplicating logic.
1515
| `@specbridge/drift` | Deterministic drift verification (v0.4): git comparison resolution, spec policies, the SBV001–SBV025 rule engine, affected-spec resolution, trusted-command orchestration, schema-validated report assembly — plus the v0.1 primitives |
1616
| `@specbridge/runners` | Model/agent adapters behind one `AgentRunner` interface (mock implemented; CLI runners detection-only) |
1717
| `@specbridge/reporting` | Terminal formatting, JSON report envelope, self-contained HTML rendering |
18-
| `specbridge` (packages/cli) | Commander-based CLI wiring the above together |
18+
| `@specbridge/mcp-server` | v0.5 local stdio MCP server: typed tool/resource/prompt adapters over the packages above, SBMCP error model, bounded outputs, per-project write mutex — no duplicated logic |
19+
| `specbridge` (packages/cli) | Commander-based CLI wiring the above together (including `mcp serve/doctor/manifest/tools`) |
1920

2021
Dependency direction (arrows = "may import"):
2122

2223
```
2324
cli ──▶ workflow ──▶ compat-kiro ──▶ core
2425
cli ──▶ reporting ──▶ core
2526
cli ──▶ drift ─▶ compat-kiro, core, workflow, evidence, runners
27+
cli ──▶ mcp-server ─▶ compat-kiro, core, workflow, execution, evidence, drift
2628
runners ─▶ core
2729
integrations/github-action ─▶ drift, reporting, core (bundled; no CLI dependency)
30+
integrations/claude-code-plugin ─▶ cli + mcp-server (bundled; self-contained at runtime)
2831
```
2932

3033
## Design principles

docs/claude-code-plugin.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Claude Code plugin
2+
3+
A self-contained Claude Code plugin that turns the SpecBridge workflow into
4+
namespaced `/specbridge:*` commands backed by the bundled MCP server and
5+
CLI. After installation the plugin needs nothing outside its own directory:
6+
no global npm install, no workspace resolution, no network for normal
7+
operation — only Node.js 20+ on `PATH`.
8+
9+
## Directory structure
10+
11+
```text
12+
integrations/claude-code-plugin/specbridge/
13+
├── .claude-plugin/
14+
│ └── plugin.json plugin metadata (ONLY metadata lives here)
15+
├── .mcp.json bundled stdio MCP server configuration
16+
├── README.md · LICENSE · NOTICE.md
17+
├── skills/
18+
│ ├── doctor/SKILL.md /specbridge:doctor
19+
│ ├── status/SKILL.md /specbridge:status [spec]
20+
│ ├── new/SKILL.md /specbridge:new <spec> [description]
21+
│ ├── author/SKILL.md /specbridge:author <spec> <stage> [note]
22+
│ ├── approve/SKILL.md /specbridge:approve <spec> <stage> (human-only)
23+
│ ├── implement/SKILL.md /specbridge:implement <spec> [task]
24+
│ ├── continue/SKILL.md /specbridge:continue <run-id>
25+
│ └── verify/SKILL.md /specbridge:verify [spec]
26+
├── bin/
27+
│ ├── specbridge POSIX wrapper → dist/cli.cjs
28+
│ └── specbridge.cmd Windows wrapper → dist/cli.cjs
29+
└── dist/
30+
├── cli.cjs self-contained SpecBridge CLI (CJS bundle)
31+
├── mcp-server.cjs self-contained MCP server (CJS bundle)
32+
├── THIRD_PARTY_LICENSES.txt
33+
└── checksums.json SHA-256 manifest of the bundle
34+
```
35+
36+
`.mcp.json` launches the bundled server for the current project:
37+
38+
```json
39+
{
40+
"mcpServers": {
41+
"specbridge": {
42+
"command": "node",
43+
"args": [
44+
"${CLAUDE_PLUGIN_ROOT}/dist/mcp-server.cjs",
45+
"--stdio",
46+
"--project-root",
47+
"${CLAUDE_PROJECT_DIR}"
48+
]
49+
}
50+
}
51+
}
52+
```
53+
54+
`${CLAUDE_PLUGIN_ROOT}` keeps the configuration cache-safe: the plugin works
55+
from wherever Claude Code copies it, with no absolute build-machine path
56+
anywhere in the artifact.
57+
58+
## Skill design
59+
60+
Skills are **thin orchestration** — they call the MCP tools for inspection
61+
and controlled lifecycle operations and never duplicate core logic:
62+
63+
- `doctor`/`status` are read-only (`workspace_detect`, `spec_list`,
64+
`spec_status`).
65+
- `new` previews with `spec_create(apply: false)` and creates only after
66+
explicit confirmation.
67+
- `author` drafts in the current session, validates with
68+
`spec_stage_validate`, shows the diff, and applies via `spec_stage_apply`
69+
only after explicit confirmation — the stage remains unapproved.
70+
- `approve` is the human gate: `disable-model-invocation: true` (Claude can
71+
never trigger it), a narrowly scoped Bash allowance for exactly
72+
`"${CLAUDE_PLUGIN_ROOT}/bin/specbridge" spec approve …`, and a final
73+
explicit confirmation before the CLI runs.
74+
- `implement` uses the interactive lifecycle
75+
(`task_begin` → this session edits → `task_complete`) and reports the
76+
ACTUAL evidence outcome. It never invokes `specbridge spec run`, `claude
77+
-p`, or any nested agent — that invariant is enforced by automated scans
78+
in `pnpm validate:plugin` and the test suite.
79+
- `continue` finishes an interrupted interactive run honestly (never
80+
presenting a fresh run as a resumption).
81+
- `verify` runs `spec_check_drift` and asks before `spec_run_verification`.
82+
83+
No skill uses `bypassPermissions`, `dangerously-skip-permissions`,
84+
unrestricted `Bash(*)`, or unrestricted `Write`, and no skill instructs
85+
direct edits to `.kiro` or `.specbridge`.
86+
87+
## Tool scoping
88+
89+
Claude Code prefixes tools from plugin-bundled MCP servers with a
90+
host-generated scope (visible via `/mcp`), which may differ from manually
91+
configured servers. Skills therefore reference tools by their short names
92+
(`task_begin`, `spec_status`, …). Nothing in the server hardcodes a prefix.
93+
94+
## Why no nested Claude invocation
95+
96+
The plugin's implementation workflow must never start a second agent: the
97+
current session already IS the agent, a nested run would double cost and
98+
confuse permissions, and evidence attribution assumes exactly one actor
99+
between the Git snapshots. The v0.3 runner (`specbridge spec run`) remains
100+
fully supported **from the standalone CLI** for users who want detached
101+
execution — it is only the plugin path that forbids it. Automated tests scan
102+
the skills and the interactive execution code for `claude -p`,
103+
`spec run`, runner-registry usage, and process spawning.
104+
105+
See [plugin-installation.md](plugin-installation.md),
106+
[plugin-development.md](plugin-development.md),
107+
[plugin-security.md](plugin-security.md), and
108+
[plugin-release.md](plugin-release.md).

0 commit comments

Comments
 (0)