Skip to main content
Glama

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-mcp

The 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

FORGESPEC_CURSOR_SECRET

32+ byte HMAC secret (or comma-separated key ring for zero-downtime rotation)

Ephemeral random secret

FORGESPEC_DB

Path to the SQLite database file

~/.forgespec/forgespec.db

FORGESPEC_DIR

Base directory for ForgeSpec data storage

~/.forgespec/

FORGESPEC_NODE_PATH

Explicit Node binary path for the identity broker

process.execPath


🔄 SDD 2.0 Lifecycle Pipeline

ForgeSpec enforces a strictly sequenced 8-phase contract progression:

init ➔ explore ➔ proposal ➔ spec ➔ design ➔ tasks ➔ apply ➔ verify
  • Cryptographic Revisions: Each contract commit produces a deterministic SHA-256 digest linked to the parent contract and board revision.

  • Attempt Gating: Execution transitions from tasks to apply and verify require 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

board_createcontract_commitcontract_querycontract_validate

Project workspaces, phase progression, schema validation, and immutable SDD specs.

Tasks & Planning

task_definetask_querytask_transition

DAG dependency definition, state machine transitions (ready, in_progress, in_review, done).

Execution & Attempts

attempt_claimattempt_recoverattempt_renew

Worker assignment, bounded TTL execution attempts, recovery protocol.

File Leases

lease_reservelease_renewlease_release

Scoped optimistic file reservations preventing write collisions across agents.

Governance & Events

authority_manageapproval_recordevent_query

Delegated capability grants, human/reviewer sign-offs, HMAC-paginated audit trail.

Core & Diagnostics

forge_healthforge_negotiate

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 arguments
  1. Identity Isolation: The identity sidecar (5 tables) is physically separated from the domain store (16 fs_* tables).

  2. No Actor Fields in Model Payload: Models do not provide caller/actor IDs. The plugin injects cryptographic _identity envelopes validated by the server.

  3. Shell-Free Execution: The broker process launches with shell: false to eliminate shell-injection attack surfaces.

  4. Token Security: Authority and lease tokens are issued once, returned in memory, and stored exclusively as SHA-256 hashes.

  5. HMAC Event Cursors: Pagination cursors for event_query are signed with FORGESPEC_CURSOR_SECRET (supports key ring rotation).

  6. 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-mcp in mcp) without the identity broker environment throws TRUST_BOOTSTRAP_INVALID by design.

  • The opencode-forgespec plugin automatically spins up the private Identity Broker sidecar, initializes trusted key pairs, securely injects bootstrap credentials into forgespec-mcp, and signs every tool call with session-bound _identity cryptographic 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"
  ]
}
WARNING

Donot define a manual "forgespec" entry under "mcp". The plugin registers and connects the authenticated MCP server automatically.

IMPORTANT

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_validate

  • forgespec_task_define, forgespec_task_query, forgespec_task_transition

  • forgespec_attempt_claim, forgespec_attempt_recover, forgespec_attempt_renew

  • forgespec_lease_reserve, forgespec_lease_renew, forgespec_lease_release

  • forgespec_authority_manage, forgespec_approval_record, forgespec_event_query

  • forgespec_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_idempotency
  • Prerequisites: Requires SQLite STRICT table support, JSON1, foreign keys (PRAGMA foreign_keys = ON), and WAL journal 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.

NOTE

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 tools
file_releaseB
Idempotent

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_reserveA
Idempotent

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 CapabilitiesC
Read-onlyIdempotent

Negotiate ForgeSpec coordination mode, schemas, independently versioned features, and limits.

Inputs: client, required, requested_mode. Returns: modes, limits, server, schemas, +3 more

forgespec_healthA
Read-onlyIdempotent

Get server health diagnostics, database integrity status, system time, active leases, and version telemetry.

Inputs: no named parameters.

sdd_getA
Read-onlyIdempotent

Get a single SDD contract by ID. Returns full contract data.

Inputs: contract_id (required).

sdd_historyA
Read-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_listA
Read-onlyIdempotent

List all SDD contracts with optional filters by project and phase.

Inputs: limit, phase, project.

sdd_saveB
Idempotent

Validate and persist an SDD contract. Records the phase transition for project traceability.

Inputs: contract (required), actor, api_version, schema_version, +5 more.

sdd_validateA
Read-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_logA
Read-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_grantA
Idempotent

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_handoffC
Idempotent

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_revokeA
DestructiveIdempotent

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

    C2.7/5.0

    Scored across 30 tools

    Disambiguation3/5

    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.

    Naming Consistency3/5

    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.

    Tool Count2/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables 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.
      4
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An 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.
      58
      22
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Centralized 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 npm
      1
      MIT