From spec-first
Installs MCP tools (Serena, Sequential Thinking, Context7, Playwright MCP) for Claude Code/Codex, rebuilds host configs, bootstraps Serena for repo, verifies host readiness ledger.
npx claudepluginhub sunrain520/spec-firstThis skill uses the workspace's default tool permissions.
Install, repair, and verify the MCP tools used by spec-first workflows.
mcp-tools.jsonreferences/config-template.yamlreferences/supported-mcp-tools.mdscripts/activate-serena.ps1scripts/activate-serena.shscripts/check-deps.ps1scripts/check-deps.shscripts/check-healthscripts/configure-host.ps1scripts/configure-host.shscripts/detect-host.ps1scripts/detect-host.shscripts/detect-tools.ps1scripts/detect-tools.shscripts/install-mcp.ps1scripts/install-mcp.shscripts/repair-install.ps1scripts/repair-install.shscripts/uninstall-mcp.ps1scripts/uninstall-mcp.shHandles Claude Code MCP integration: installs/manages servers (HTTP/SSE/stdio), scopes, enterprise configs, OAuth auth, resources/@mentions, prompts, limits, security; delegates to docs-management.
Checks and configures MCP servers in .mcp.json for project integration. Use for setup, status checks, adding core servers like context7 and sequential-thinking, or specific ones like playwright.
Configures MCP servers for Claude Code Tool Executor sandbox using tool-executor.config.json. Covers adding/removing servers, TypeScript types, env vars, registry regeneration, and rebuilds.
Share bugs, ideas, or general feedback.
Install, repair, and verify the MCP tools used by spec-first workflows.
Claude entry point: /spec:mcp-setup [quick|custom]
Codex entry point: $spec-mcp-setup [quick|custom]
This workflow rebuilds the host MCP setup around a deterministic installer pipeline instead of the retired install-coordinator.* flow.
| Tool | Required | Purpose |
|---|---|---|
| Serena | Yes | Symbol-level editing and current-repo bootstrap |
| Sequential Thinking | Yes | Dynamic reflective problem solving |
| Context7 | Yes | Latest framework documentation lookup |
| Playwright MCP | No | Frontend automation testing |
The active host is detected automatically. Claude Code now prefers the official managed MCP target (managed-mcp.json) and falls back to ~/.claude.json when the managed target is not writable; Codex writes user-scoped MCP config to ~/.codex/config.toml while also surfacing /etc/codex/config.toml precedence facts on Unix. The host readiness ledger is written to the current host's spec-first/host-setup.json marker path.
Route B host facts intentionally expose:
managed / user)This keeps one machine truth in mcp-tools.json and lets scripts stay deterministic.
If both CLIs are present and no host hint is available, set MCP_SETUP_HOST=claude|codex explicitly; the workflow will not guess.
Platform entrypoints:
*.sh*.ps1Tool metadata is defined in skills/spec-mcp-setup/mcp-tools.json.
The current schema provides one machine truth for:
Do not create a second machine-readable registry for the same tool catalog in this workflow.
Goal: Reuse the migrated deterministic preflight to diagnose helper tools, legacy Spec-First residue, and repo-local .spec-first config before entering MCP baseline setup.
Before running the script, tell the user:
Spec-First -- checking your environment...
macOS/Linux:
bash skills/spec-mcp-setup/scripts/check-health
Display the script output to the user verbatim.
The migrated check-health script is the single deterministic input for this phase.
Use it for:
agent-browser is required; gh, jq, vhs, silicon, and ffmpeg are recommended).spec-first/config.local.yaml presence.spec-first/config.local.example.yaml freshness.gitignore coverage hintsagent-browser is a browser automation helper substrate, not an MCP server. This workflow is the project-owned entry point for detecting and installing the external CLI, running agent-browser install, and installing the upstream/global agent-browser skill with npx skills add https://github.com/vercel-labs/agent-browser --skill agent-browser -g -y.
The preflight output should show helper-tool install status, and the final completion summary must merge helper-tool rows into the same table as MCP tools. Keep agent-browser as Type=helper, Required=yes, Dependency=ready|missing, Host Config=n/a, and Project Bootstrap=n/a.
Do not:
mcp-tools.jsondetect-tools.*Continue to use the preflight output to drive user-confirmed actions only when the action would write user-owned project config or install optional helper tooling:
.spec-first/config.local.example.yaml refresh from skills/spec-mcp-setup/references/config-template.yaml.spec-first/config.local.yaml bootstrap from skills/spec-mcp-setup/references/config-template.yaml.gitignore coverage promptThese remain Phase-A facts only. They do not change baseline_ready.
Goal: Detect prerequisite dependencies and establish whether the host can proceed to installation.
macOS/Linux:
bash skills/spec-mcp-setup/scripts/check-deps.sh
Windows:
pwsh -File skills/spec-mcp-setup/scripts/check-deps.ps1
Expected output shape:
{
"os": "macos",
"node": { "installed": true, "version": "v20.11.0", "install_suggestion": null },
"uv": { "installed": true, "version": "uv 0.4.0", "install_suggestion": null },
"jq": { "installed": true, "version": "jq-1.7", "install_suggestion": null }
}
For each missing dependency, decide whether the workflow already has enough user intent to proceed:
Typical outcomes:
uv → safe auto-install path; after explicit $spec-mcp-setup / /spec:mcp-setup, install or repair directly unless the script reports a destructive or privileged stepjq → package-manager install path; ask before privileged package-manager writesnode → gated auto-install path with PATH-risk warning; ask before changing Node/PATHIf the user declines installation, display manual instructions and stop.
After dependency installation, re-run the same platform dependency check. If any required dependency is still missing, do not continue into host configuration.
Goal: Build a machine-readable view of host + project readiness before installation.
macOS/Linux:
bash skills/spec-mcp-setup/scripts/detect-tools.sh
Windows:
pwsh -File skills/spec-mcp-setup/scripts/detect-tools.ps1
Expected output shape:
{
"host": "claude",
"platform": "macos",
"repo_root": "/path/to/repo",
"overall_status": "partial",
"baseline_ready": false,
"tools": {
"serena": {
"required": true,
"dependency_status": "ready",
"host_config_status": "action-required",
"project_status": "pending",
"next_action": "configure host"
}
},
"crg": {
"cli_status": "ready",
"native_modules_status": "ready"
},
"next_actions": ["bootstrap project"]
}
overall_status is one of:
readypartialaction-requiredfailedbaseline_ready=true means the required MCP baseline is ready across:
Per-tool fields explain where readiness stops:
dependency_statushost_config_statusselected_scopeproject_statusnext_actionhost_config_status meanings:
ready — preferred target configured and effectivefallback-active — Claude fell back from managed-mcp.json to ~/.claude.json, but the baseline is still usableprecedence-blocked — Codex user config exists, but a higher-precedence config file may override itaction-required — no usable host config detectedcrg.cli_status and crg.native_modules_status remain downstream machine facts for graph bootstrap decisions. Native module detection must resolve better-sqlite3 and tree-sitter from the real spec-first CLI installation context, not from the caller's current working directory. A current-directory bare require() can misreport global installs as missing.
For Route B host selection, detect-host.* also exposes:
These stay machine-readable only; the workflow still keeps a single registry in mcp-tools.json.
Goal: Run deterministic install/configure/repair/bootstrap steps based on the readiness facts.
macOS/Linux:
bash skills/spec-mcp-setup/scripts/install-mcp.sh
Windows:
pwsh -File skills/spec-mcp-setup/scripts/install-mcp.ps1
The pipeline layers are:
install-mcp.* — orchestrationconfigure-host.* — host MCP config writesrepair-install.* — deterministic repair pathactivate-serena.* — current-repo Serena bootstrapThe retired install-coordinator.* flow is not part of this workflow anymore.
In quick mode, install the required baseline only.
In custom mode, ask which optional tools to include, then rerun the same installer pipeline with the selected tool ids passed explicitly.
For example, if the user selects Playwright MCP:
macOS/Linux:
bash skills/spec-mcp-setup/scripts/install-mcp.sh --install playwright
Windows:
pwsh -File skills/spec-mcp-setup/scripts/install-mcp.ps1 -Install playwright
Do not treat optional-tool selection as implied by custom mode alone; pass the chosen optional tool ids into install-mcp.* explicitly.
configure-host.* writes the selected tool into the host config selected by detect-host.*:
managed-mcp.json, fall back to ~/.claude.json when the managed target is not writable~/.codex/config.toml, but also surface Unix /etc/codex/config.toml precedence factsThe write result must expose:
configured_pathselected_scopefallback_appliedKeep host-specific path resolution, fallback logic, uninstall target handling, and same-name replacement logic in scripts, not in the prose.
Route B adds a deterministic uninstall path:
bash skills/spec-mcp-setup/scripts/uninstall-mcp.sh [--tool <tool-id>]pwsh -File skills/spec-mcp-setup/scripts/uninstall-mcp.ps1 [-Tool <tool-id>]Uninstall removes the named MCP entry from every declared uninstall target for the current host. It does not introduce a second registry.
If no tool id is passed, uninstall removes all tools declared in mcp-tools.json for the current host.
Keep uninstall bounded to host config cleanup only; it must not delete repo bootstrap files or invent extra cleanup heuristics.
For Claude Code:
fallback-active still counts as usable baseline when required tools and project bootstrap are readyFor Codex:
precedence-blocked means the user config entry exists but may not be effectiveDo not collapse these distinctions into a single boolean.
Claude managed MCP target paths:
/Library/Application Support/ClaudeCode/managed-mcp.json/etc/claude-code/managed-mcp.jsonC:\Program Files\ClaudeCode\managed-mcp.jsonCodex precedence note:
/etc/codex/config.tomlKeep managed-mcp.json and /etc/codex/config.toml wording aligned across source docs, mirrors, tests, and reference.
Keep host-specific wrapping logic there, not in the prose.
Context7 remains part of the same unified installer metadata source and continues to use @upstash/context7-mcp in the deterministic pipeline. Do not split it into a second setup flow.
After configure-host.*, the workflow should be able to explain:
These are Route B machine facts, not human-only summary text.
Do not add:
All of these facts stay inside skills/spec-mcp-setup/mcp-tools.json.
When summarizing readiness:
ready and fallback-active both mean the write path succeededprecedence-blocked means human attention is required before claiming the config is effectiveaction-required means the host config layer is still missing or invalidThis projection belongs in detect-tools.* / verify-tools.*, not in a second rule engine.
repair-install.* may reuse the same host facts and rerun configure-host.*, but should not start open-ended filesystem surgery or guess undocumented host paths.
When showing final machine-derived summary, use one table with these columns:
Tool | Type | Required | Dependency | Host Config | Project Bootstrap | Result | Next Action
Render rows from both ledger fields:
tools as Type=MCPhelper_tools as Type=helperSort rows in this order:
For human display, map machine-only values without changing the ledger:
not-applicable -> n/arequired=false, host_config_status=action-required, and no install requested -> Result=optional-pending, Next Action=run custom setup if neededHost Config=n/a and Project Bootstrap=n/aThe Host Config column may contain ready, fallback-active, precedence-blocked, action-required, or n/a.
Downstream consumers such as graph bootstrap should keep reading the readiness ledger v1 shape, but now interpret the richer host_config_status values rather than assuming only ready / action-required.
Even with Route B changes, keep the readiness ledger marker paths stable:
~/.claude/spec-first/host-setup.json~/.codex/spec-first/host-setup.jsonDo not move marker paths just because host config targets changed.
The workflow may prefer the managed target, fall back to user target, and expose precedence facts, but it still reports one deterministic selected write target per run.
Keep host-specific wrapping logic there, not in the prose.
If deterministic install or configure fails:
repair-install.* for the same toolUnknown failures should surface bounded facts and next actions; do not hard-code open-ended shell heuristics.
After Serena host config is ready, run activate-serena.*.
Success means the current repo now has Serena project metadata (for example .serena/project.yml) and an explicit ready marker for the latest successful index refresh (currently .serena/index-ready.json).
If Serena host config is ready but repo bootstrap is still pending or the latest index refresh failed, the host remains only partially ready.
tools.serena.project_status uses these states:
pending — project metadata is missingfailed — project metadata exists but the latest index-ready marker is missingready — project metadata and the latest index-ready marker both existDo not treat .serena/project.yml alone as proof that Serena bootstrap is complete.
For tools whose metadata declares installation.kind = warmup, install-mcp.* runs the metadata-defined warmup command before host config writes. If warmup fails, stop claiming success and surface bounded failure facts.
activate-serena.* must fail when the Serena index command fails. It may create project metadata before attempting the index, but it must not report bootstrap success unless the index-ready marker is written.
If Serena bootstrap fails after host config is already ready, mark the run as partial rather than silently downgrading the repo to "ready".
If Serena host config is ready but repo bootstrap is still pending, the host remains only partially ready.
When configure-host.* writes host config:
Do not reintroduce the old install-coordinator.* abstraction to preserve this behavior.
Goal: Write the single machine-truth ledger for the current host after installation.
macOS/Linux:
bash skills/spec-mcp-setup/scripts/verify-tools.sh
Windows:
pwsh -File skills/spec-mcp-setup/scripts/verify-tools.ps1
The final ledger answers:
Do not ask for confirmation before re-running detect-tools.* or verify-tools.*; they are deterministic fact collection / ledger write steps for the active setup workflow. Ask before privileged installs, optional-tool selection, destructive cleanup, or ambiguous project config writes.
baseline_ready=true means the required MCP baseline is ready.
overall_status is one of:
readypartialaction-requiredfailednext_actions[] is the machine-truth next-step list that the human summary should project. It must aggregate repo-level blockers (for example CRG CLI/native-module issues) and each tool's non-empty next_action without duplicates.
If verify-tools.* exits non-zero:
If baseline_ready=false after verification:
If only optional tools remain absent:
After all installations:
baseline_ready == true when setup is completeTool | Type | Required | Dependency | Host Config | Project Bootstrap | Result | Next Action
The table must include MCP baseline rows from tools and helper-tool rows from helper_tools; do not put helper tools into mcp-tools.json just to make them appear in the summary.
Use the display rules from 3.3i Table Output Contract so the table distinguishes MCP readiness from helper tool installation and does not make optional MCP tools look like baseline failures.
Recommended next steps after success:
/spec:graph-bootstrap or $spec-graph-bootstrap)| Scenario | Action |
|---|---|
| Dependency missing and user declines install | Show manual instructions, exit |
| Deterministic install/configure fails but repair can resolve it | Run repair-install.*, continue, mark tool as repaired |
| Deterministic install/configure fails and repair cannot resolve it | Return structured failure facts, stop claiming completion |
| Current host config doesn't exist | Create the host-specific config file through the installer path |
| Serena repo bootstrap is still pending | Mark host as partial, surface next_action |
jq not available | Require jq, show install instructions |
Includes:
Excludes:
Route B now includes bounded MCP tool uninstallation via uninstall-mcp.*.
The readiness ledger is host-specific:
~/.claude/spec-first/host-setup.json~/.codex/spec-first/host-setup.json{
"schema_version": "v1",
"host": "claude",
"platform": "macos",
"repo_root": "/path/to/repo",
"overall_status": "partial",
"baseline_ready": false,
"completed_at": "2026-04-22T12:00:00Z",
"tools": {
"serena": {
"required": true,
"dependency_status": "ready",
"host_config_status": "ready",
"project_status": "failed",
"next_action": "bootstrap project"
},
"context7": {
"required": true,
"dependency_status": "ready",
"host_config_status": "ready",
"project_status": "not-applicable",
"next_action": ""
}
},
"crg": {
"cli_status": "ready",
"native_modules_status": "ready"
},
"next_actions": ["bootstrap project"]
}
| Field | Consumer | Purpose |
|---|---|---|
host / platform | runtime host selector | pick the matching marker and host path |
overall_status | spec-mcp-setup summary / graph-bootstrap gate | decide whether the host is ready, partial, or blocked |
baseline_ready | graph-bootstrap host readiness | determine whether required MCP baseline is ready |
tools.<tool>.host_config_status | graph-bootstrap / future skills | know whether the MCP entry is configured |
tools.<tool>.project_status | Serena-aware workflows | know whether the current repo bootstrap is pending / failed / ready |
crg.cli_status | graph-bootstrap Phase 0.2b | skip CRG operations when CLI is unavailable |
crg.native_modules_status | graph-bootstrap Phase 0.2b | warn before attempting crg build |
next_actions[] | spec-mcp-setup human summary | present the next deterministic steps |
completed_at | stale detection | know when the ledger was last refreshed |
For full tool descriptions and host-specific notes, use references/supported-mcp-tools.md.
skills/spec-mcp-setup/references/supported-mcp-tools.mdskills/spec-mcp-setup/mcp-tools.jsoninstall-mcp.sh, configure-host.sh, repair-install.sh, activate-serena.sh, verify-tools.shinstall-mcp.ps1, configure-host.ps1, repair-install.ps1, activate-serena.ps1, verify-tools.ps1skills/spec-graph-bootstrap/SKILL.mdtemplates/claude/commands/spec/mcp-setup.mdDo not refer users to install-coordinator.*; it is a retired implementation.