singularity-forge/packages/mcp-server
TÂCHES 1c2d7ab307 fix: add missing runtime stage name to Dockerfile (#2765)
* feat: Registered 6 MCP tools (gsd_execute, gsd_status, gsd_result, gsd_…

- "packages/mcp-server/src/server.ts"
- "packages/mcp-server/src/cli.ts"
- "packages/mcp-server/src/index.ts"
- "packages/rpc-client/dist/index.d.ts"

GSD-Task: S05/T02

* docs: Added 31 integration tests, build pipeline, and consumer README f…

- "packages/mcp-server/src/mcp-server.test.ts"
- "packages/mcp-server/README.md"
- "packages/mcp-server/dist/"

GSD-Task: S05/T03

* fix: add missing runtime stage name to Dockerfile

CI pipeline uses `docker build --target runtime` but the FROM line
lacked the `AS runtime` alias, causing the build to fail.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 17:52:45 -06:00
..
src fix: add missing runtime stage name to Dockerfile (#2765) 2026-03-26 17:52:45 -06:00
package.json fix: add missing runtime stage name to Dockerfile (#2765) 2026-03-26 17:52:45 -06:00
README.md fix: add missing runtime stage name to Dockerfile (#2765) 2026-03-26 17:52:45 -06:00
tsconfig.json fix: add missing runtime stage name to Dockerfile (#2765) 2026-03-26 17:52:45 -06:00

@gsd/mcp-server

MCP server exposing GSD orchestration tools for Claude Code, Cursor, and other MCP-compatible clients.

Start GSD auto-mode sessions, poll progress, resolve blockers, and retrieve results — all through the Model Context Protocol.

Installation

npm install @gsd/mcp-server

Or with the monorepo workspace:

# Already available as a workspace package
npx gsd-mcp-server

Configuration

Claude Code

Add to your project's .mcp.json:

{
  "mcpServers": {
    "gsd": {
      "command": "npx",
      "args": ["gsd-mcp-server"],
      "env": {
        "GSD_CLI_PATH": "/path/to/gsd"
      }
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "gsd": {
      "command": "gsd-mcp-server"
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "gsd": {
      "command": "npx",
      "args": ["gsd-mcp-server"],
      "env": {
        "GSD_CLI_PATH": "/path/to/gsd"
      }
    }
  }
}

Tools

gsd_execute

Start a GSD auto-mode session for a project directory.

Parameter Type Required Description
projectDir string Absolute path to the project directory
command string Command to send (default: "/gsd auto")
model string Model ID override
bare boolean Run in bare mode (skip user config)

Returns: { sessionId, status: "started" }

gsd_status

Poll the current status of a running GSD session.

Parameter Type Required Description
sessionId string Session ID from gsd_execute

Returns:

{
  "status": "running",
  "progress": { "eventCount": 42, "toolCalls": 15 },
  "recentEvents": [ ... ],
  "pendingBlocker": null,
  "cost": { "totalCost": 0.12, "tokens": { "input": 5000, "output": 2000, "cacheRead": 1000, "cacheWrite": 500 } },
  "durationMs": 45000
}

gsd_result

Get the accumulated result of a session. Works for both running (partial) and completed sessions.

Parameter Type Required Description
sessionId string Session ID from gsd_execute

Returns:

{
  "sessionId": "abc-123",
  "projectDir": "/path/to/project",
  "status": "completed",
  "durationMs": 120000,
  "cost": { ... },
  "recentEvents": [ ... ],
  "pendingBlocker": null,
  "error": null
}

gsd_cancel

Cancel a running session. Aborts the current operation and stops the agent process.

Parameter Type Required Description
sessionId string Session ID from gsd_execute

Returns: { cancelled: true }

gsd_query

Query GSD project state from the filesystem without an active session. Returns STATE.md, PROJECT.md, requirements, and milestone listing.

Parameter Type Required Description
projectDir string Absolute path to the project directory
query string What to query (e.g. "status", "milestones")

Returns:

{
  "projectDir": "/path/to/project",
  "state": "...",
  "project": "...",
  "requirements": "...",
  "milestones": [
    { "id": "M001", "hasRoadmap": true, "hasSummary": false }
  ]
}

gsd_resolve_blocker

Resolve a pending blocker in a session by sending a response to the blocked UI request.

Parameter Type Required Description
sessionId string Session ID from gsd_execute
response string Response to send for the pending blocker

Returns: { resolved: true }

Environment Variables

Variable Description
GSD_CLI_PATH Absolute path to the GSD CLI binary. If not set, the server resolves gsd via which.

Architecture

┌─────────────────┐     stdio      ┌──────────────────┐
│  MCP Client     │ ◄────────────► │  @gsd/mcp-server │
│  (Claude Code,  │    JSON-RPC    │                  │
│   Cursor, etc.) │                │  SessionManager  │
└─────────────────┘                │       │          │
                                   │       ▼          │
                                   │  @gsd/rpc-client │
                                   │       │          │
                                   │       ▼          │
                                   │  GSD CLI (child  │
                                   │  process via RPC)│
                                   └──────────────────┘
  • @gsd/mcp-server — MCP protocol adapter. Translates MCP tool calls into SessionManager operations.
  • SessionManager — Manages RpcClient lifecycle. One session per project directory. Tracks events in a ring buffer (last 50), detects blockers, accumulates cost.
  • @gsd/rpc-client — Low-level RPC client that spawns and communicates with the GSD CLI process via JSON-RPC over stdio.

License

MIT