forgespec-mcp
The forgespec-mcp server is a coordination backbone for multi-agent AI development, enforcing Spec-Driven Development (SDD) workflows through structured contracts, task management, and file conflict prevention.\n\n- SDD Contract Lifecycle: Manage contracts across a 9-phase pipeline (init → archive) with tools to validate, save, retrieve, list, and view phase history, enforcing confidence thresholds for transitions.\n- Task Board Coordination: Create boards and add tasks with priorities, dependencies, and acceptance criteria. Claim, update, and heartbeat tasks; auto-unblock dependents; recover stale claims; requeue; approve; batch status; and monitor events—all with dependency DAG normalization.\n- File Reservation: Reserve files or glob patterns with configurable TTL to prevent concurrent edits; check for conflicts without locking; release or renew leases.\n- Persistence & Integration: Uses SQLite for durable state and immutable audit trails, supports Cortex for persistent memory and knowledge graphs, and provides advanced coordination via Compare-And-Swap, idempotency, and exclusive leases. Compatible with any MCP client.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@forgespec-mcp Show the status of the task board and list any unblocked tasks"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ForgeSpec MCP Protocol 2.0
📖 Overview
ForgeSpec MCP provides a rigorous, fail-closed coordination substrate for autonomous AI agents and pair-programming assistants. Built specifically for Spec-Driven Development (SDD), it replaces chaotic multi-agent file modifications with cryptographic revisions, scoped file locks, deterministic role profiles, and an immutable audit trail.
ForgeSpec exposes a single canonical protocol: Protocol 2.0 (forgespec-mcp@2.0.0).
Related MCP server: Specky
⚡ Quick Start
Installation & Execution
# Install dependencies and build
npm ci
npm run build
# Launch the stdio MCP server with a secure cursor secret
FORGESPEC_CURSOR_SECRET="at-least-32-bytes-of-secret-material" npx forgespec-mcpThe server communicates via standard MCP JSON-RPC over stdio. Protocol messages are received on stdin and returned on stdout; all startup diagnostics and preflight warnings are routed to stderr. The entrypoint executable is build/index.js.
Environment Configuration
Variable | Description | Default |
| 32+ byte HMAC secret (or comma-separated key ring for zero-downtime rotation) | Ephemeral random secret |
| Path to the SQLite database file |
|
| Base directory for ForgeSpec data storage |
|
| Explicit Node binary path for the identity broker |
|
🔄 SDD 2.0 Lifecycle Pipeline
ForgeSpec enforces a strictly sequenced 8-phase contract progression:
init ➔ explore ➔ proposal ➔ spec ➔ design ➔ tasks ➔ apply ➔ verifyCryptographic Revisions: Each contract commit produces a deterministic SHA-256 digest linked to the parent contract and board revision.
Attempt Gating: Execution transitions from
taskstoapplyandverifyrequire verified attempt claims and file lease grants.
🛠️ Canonical Tool Catalog (18 Tools)
The server publishes exactly 18 tools in deterministic order, partitioned into 6 domain modules:
Domain | Tools | Description |
Boards & Contracts |
| Project workspaces, phase progression, schema validation, and immutable SDD specs. |
Tasks & Planning |
| DAG dependency definition, state machine transitions ( |
Execution & Attempts |
| Worker assignment, bounded TTL execution attempts, recovery protocol. |
File Leases |
| Scoped optimistic file reservations preventing write collisions across agents. |
Governance & Events |
| Delegated capability grants, human/reviewer sign-offs, HMAC-paginated audit trail. |
Core & Diagnostics |
| Capability handshake, profile negotiation, storage and runtime qualification. |
Deterministic Profiles
Four deterministic role profiles expose tailored tool subsets:
planner: Focuses on contract authoring, task decomposition, and board querying.worker: Focused on attempt claiming, file lease reservation, and execution transitions.reviewer: Evaluates gate decisions and records verified approvals.orchestrator: Full coordination capability across boards, authority delegation, and task pipelines.
🛡️ Security & Identity Threat Boundary
OpenCode Plugin ──private stdio──> Identity Broker ──> Sidecar Store (5 tables)
│ └──── root handle + worker handles
└─ Signed Identity Envelopes (_identity); no actor fields in tool argumentsIdentity Isolation: The identity sidecar (5 tables) is physically separated from the domain store (16
fs_*tables).No Actor Fields in Model Payload: Models do not provide caller/actor IDs. The plugin injects cryptographic
_identityenvelopes validated by the server.Shell-Free Execution: The broker process launches with
shell: falseto eliminate shell-injection attack surfaces.Token Security: Authority and lease tokens are issued once, returned in memory, and stored exclusively as SHA-256 hashes.
HMAC Event Cursors: Pagination cursors for
event_queryare signed withFORGESPEC_CURSOR_SECRET(supports key ring rotation).Fail-Closed Guarantees: A malformed store, missing metadata, or schema corruption halts startup cleanly. Database reset is supported for fresh stores only.
🧩 OpenCode Integration (opencode-forgespec)
The official OpenCode integration is exported via forgespec-mcp/plugin and packaged as opencode-forgespec.
Why Use opencode-forgespec Instead of Raw MCP?
In ForgeSpec Protocol 2.0, the MCP server operates under a fail-closed cryptographic identity model:
AI models are prevented from self-assigning caller identities or forging permissions.
Direct invocation (
npx -y forgespec-mcpinmcp) without the identity broker environment throwsTRUST_BOOTSTRAP_INVALIDby design.The
opencode-forgespecplugin automatically spins up the private Identity Broker sidecar, initializes trusted key pairs, securely injects bootstrap credentials intoforgespec-mcp, and signs every tool call with session-bound_identitycryptographic envelopes.
Installation
Install the plugin in your project (or in your OpenCode configuration directory):
# In your local project repository
npm install --save-dev opencode-forgespec
# Or globally for your user profile
npm install -g opencode-forgespec
# (On Windows, you can also install directly in %USERPROFILE%\.config\opencode)Configuration in opencode.json / opencode.jsonc
Add "opencode-forgespec" to the "plugin" array in your project or global opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"opencode-forgespec"
]
}Donot define a manual "forgespec" entry under "mcp". The plugin registers and connects the authenticated MCP server automatically.
After installing or configuringopencode-forgespec, restart OpenCode to initialize the private identity broker. Ensure Node 22+ is available on your system path.
Available Tools in OpenCode
All 18 canonical ForgeSpec tools are automatically exposed to OpenCode agents with the forgespec_ prefix:
forgespec_board_create,forgespec_contract_commit,forgespec_contract_query,forgespec_contract_validateforgespec_task_define,forgespec_task_query,forgespec_task_transitionforgespec_attempt_claim,forgespec_attempt_recover,forgespec_attempt_renewforgespec_lease_reserve,forgespec_lease_renew,forgespec_lease_releaseforgespec_authority_manage,forgespec_approval_record,forgespec_event_queryforgespec_forge_health,forgespec_forge_negotiate
🗄️ Storage Architecture (16 STRICT Tables)
ForgeSpec utilizes an atomic, qualified SQLite schema with 16 strict fs_* tables:
fs_schema_meta · fs_boards · fs_tasks · fs_task_dependencies · fs_gates · fs_gate_decisions
fs_attempts · fs_contracts · fs_leases · fs_lease_scopes · fs_authority · fs_authority_revocations
fs_approvals · fs_audit_events · fs_evidence · fs_idempotencyPrerequisites: Requires SQLite
STRICTtable support,JSON1, foreign keys (PRAGMA foreign_keys = ON), andWALjournal mode.Further architecture details are documented in docs/architecture.md and docs/protocol-2.md.
🧪 Verification & Quality Contract
The complete runtime contract and documentation consistency are verified with:
# Run unit, domain, security, and integration tests (229+ tests)
npm test
# Check strict TypeScript types
npm run lint
# Compile production bundle
npm run build
# Run runtime smoke preflight
npm run runtime:smoke📄 License & Threat Model Notice
Distributed under the MIT License.
The private stdio broker boundary prevents language models from tampering with session identity. However, it is not an OS-level user security boundary. Host isolation should be applied when untrusted local users share execution environments.
Available Tools
30 toolsfile_releaseBIdempotent
Release file reservations held by an agent.
Inputs: agent (required), actor, task_id, lease_id, +9 more.
file_renewB
Renew an active direct-v1 file lease with matching task-attempt authority and revision.
Inputs: actor (required), task_id (required), lease_id (required), attempt_id (required), +8 more.
file_reserveAIdempotent
Reserve files or glob patterns to prevent conflicts between agents. Use check_only=true to check for conflicts without reserving. Reservations expire after TTL.
Inputs: patterns (required), actor, agent, task_id, +12 more.
forgespec_capabilitiesForgeSpec CapabilitiesCRead-onlyIdempotent
Negotiate ForgeSpec coordination mode, schemas, independently versioned features, and limits.
Inputs: client, required, requested_mode. Returns: modes, limits, server, schemas, +3 more
forgespec_healthARead-onlyIdempotent
Get server health diagnostics, database integrity status, system time, active leases, and version telemetry.
Inputs: no named parameters.
sdd_getARead-onlyIdempotent
Get a single SDD contract by ID. Returns full contract data.
Inputs: contract_id (required).
sdd_historyARead-onlyIdempotent
Get the SDD phase history for a project. Shows all contract transitions in chronological order.
Inputs: project (required), limit, phase, cursor, +3 more.
sdd_listARead-onlyIdempotent
List all SDD contracts with optional filters by project and phase.
Inputs: limit, phase, project.
sdd_saveBIdempotent
Validate and persist an SDD contract. Records the phase transition for project traceability.
Inputs: contract (required), actor, api_version, schema_version, +5 more.
sdd_validateARead-onlyIdempotent
Validate an SDD contract against the phase schema. Returns validation result with confidence check and allowed transitions.
Inputs: contract (required).
tb_add_taskB
Add a task to an existing board. Every task should reference a spec and have acceptance criteria.
Inputs: title (required), board_id (required), actor, gates, +12 more.
tb_approveA
Record an immutable direct-v1 approval decision with asserted provenance for a declared task gate. Asserted provenance is not authentication.
Inputs: actor (required), gate_id (required), task_id (required), decision (required), +9 more.
tb_audit_logARead-onlyIdempotent
Query historical audit trail of authority grants, revocations, and approval decisions.
Inputs: actor, limit, board_id, event_type.
tb_batch_statusC
Query bounded direct-v1 task status summaries for recovery without messaging.
Inputs: actor (required), board_id (required), limit, ready, +9 more.
tb_claimB
Claim a task for execution. Only claims tasks in 'ready' status with all dependencies resolved.
Inputs: agent (required), task_id (required), api_version, lease_seconds, +4 more.
tb_create_boardA
Create a new task board for a project. Optionally include tasks inline to create board + all tasks in a single atomic call (avoids N separate tb_add_task calls).
Inputs: name (required), project (required), actor, tasks, +5 more.
tb_eventsC
Query authorized immutable direct-v1 event deltas in stable revision order.
Inputs: actor (required), board_id (required), limit, cursor, +7 more.
tb_getA
Get full details of a single task by ID.
Inputs: task_id (required).
tb_grantAIdempotent
Create an attenuated, expiring task-authority grant. Requires exact task-authority@1.0.0 negotiation.
Inputs: actor (required), resource (required), operation (required), capability (required), +4 more.
tb_handoffCIdempotent
Create a reference-only attenuated handoff. Requires exact task-authority@1.0.0 negotiation.
Inputs: refs (required), actor (required), toActor (required), resource (required), +5 more.
tb_heartbeatC
Renew an active direct-v1 task attempt lease.
Inputs: actor (required), task_id (required), attempt_id (required), api_version (required), +6 more.
tb_list_boardsA
List task boards, optionally filtered by project. With actor plus direct-v1 context (coordination_mode/api_version/schema_version 1.0.0), also lists direct-v1 boards the actor owns or holds an active grant on. Use this to discover board IDs after context loss.
Inputs: actor, project, capability, api_version, +2 more.
tb_queryD
Query a stable, bounded, authorized direct-v1 task snapshot.
Inputs: actor (required), board_id (required), limit, ready, +9 more.
tb_recover_claimsB
Recover expired direct-v1 attempts. Tasks require explicit requeue afterward.
Inputs: actor (required), board_id (required), api_version (required), schema_version (required), +6 more.
tb_requeueC
Explicitly requeue a recovered direct-v1 task.
Inputs: actor (required), reason (required), task_id (required), api_version (required), +6 more.
tb_revokeADestructiveIdempotent
Append an authority revocation without changing board ownership. Requires exact task-authority@1.0.0 negotiation.
Inputs: actor (required), grantId (required), capability (required), idempotencyKey (required), +2 more.
tb_set_dependenciesB
Atomically replace a direct-v1 task's normalized same-board dependency set.
Inputs: actor (required), task_id (required), board_id (required), api_version (required), +6 more.
tb_statusB
Get the current status of a task board with all tasks grouped by status.
Inputs: board_id (required).
tb_unblockedB
List all tasks that are ready to be worked on (no unresolved dependencies).
Inputs: board_id (required), actor, capability, api_version, +2 more.
tb_updateA
Update a task's status and/or append notes. Moving to 'done' requires 'in_progress' or 'in_review'. Notes are stored as timestamped entries.
Inputs: task_id (required), actor, notes, status, +9 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Many tools share the tb_ prefix and cover overlapping task/status surfaces (tb_status, tb_batch_status, tb_query, tb_unblocked, tb_get), but descriptions generally carve out distinct purposes: current board status, batch recovery summaries, direct-v1 snapshots, ready work lists, and individual task detail. The authority and recovery tools are also distinguishable, though the high number of task-query variants still leaves real room for mis-selection.
The set consistently uses snake_case domain prefixes (tb_, file_, sdd_, forgespec_), which helps, but the action structure is mixed. Some names are verb+object, while others are bare states or nouns like tb_status, tb_heartbeat, and tb_unblocked, making the surface less predictable than a uniform verb_noun pattern.
At 30 tools, this server is past the 25-tool threshold and packing several separate concerns—task boards, file reservations, SDD contracts, authority grants, audit, health, and capabilities—into one surface. Each tool may serve a purpose, but the aggregate surface feels heavy and harder to navigate for an agent.
The main workflows appear broadly covered: task boards have create/add/update/status/dependency/claim/recovery support; SDD docs have validate/save/get/list/history; and file reservations have reserve/release/renew. Minor gaps, like no explicit board archive/delete or no direct reservation listing, may be intentional for audit-oriented design and agents can work around them.
Maintenance
Related MCP Connectors
Spec-driven development for AI coding agents: live requirements, stories and traceability over MCP
Project management shared by people and AI agents, with persistent project state through MCP.
Spec-driven development MCP server: 8 phases, bi-directional traceability, 7 quality gates.
Hosted MCP server and Agent Skills for specs, engineering threads, and project memory.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables spec-driven development workflows with AI assistants, providing tools for managing specification lifecycles, task dependencies, code navigation, testing, and automated reviews through a unified CLI and MCP interface.4MIT
- AlicenseAqualityCmaintenanceAn MCP server for Spec-Driven Development that transforms natural language ideas and meeting transcripts into structured, production-grade specifications using EARS notation. It automates a 7-phase pipeline to generate project artifacts like requirements, architecture designs, and task lists directly to disk.5822MIT
- AlicenseNot gradedqualityCmaintenanceCentralized MCP server for spec-driven AI agent workflows, enabling isolated feature management, task tracking, and implementation with handoff and archiving capabilities across multiple projects and developers.38 npm1MIT
- AlicenseNot gradedqualityDmaintenanceTransforms AI agents into spec-driven product engineers by managing the software project lifecycle through requirements, design, implementation, and archiving phases with state-aware MCP tools.15 npmMIT