Skip to main content

MCP Server

The ssg CLI ships a built-in MCP (Model Context Protocol) server that exposes SigmaShake governance directly to AI coding agents. Connect it once and your agent evaluates tool calls against your rules, checks health, searches the Hub, or manages Fleet organizations — all through natural conversation.

Transport: stdio (local process, zero network latency)
Protocol: JSON-RPC 2.0 (MCP spec 2024-11-05)
Default tools: 4 core tools (~428 tokens) — opt-in to more as needed


Quick Setup

Step 1 — Install ssg

pnpm add -g @sigmashake/ssg

Step 2 — Connect your AI client

# Auto-configures the MCP server in your client's config:
ssg init --client=claude-code # Claude Code
ssg init --client=antigravity # Antigravity / Gemini
ssg init --client=gemini # Gemini CLI
ssg init --client=codex # OpenAI Codex

Or add it manually to your MCP config file:

{
"mcpServers": {
"ssg-governance": {
"command": "ssg",
"args": ["mcp-server"],
"env": {
"SSG_CLIENT": "claude-code"
}
}
}
}

For Codex, the equivalent manual config lives in ~/.codex/config.toml:

[mcp_servers.ssg-governance]
command = "ssg"
args = ["mcp-server"]

[mcp_servers.ssg-governance.env]
SSG_CLIENT = "codex"

To include Fleet admin or onboarding tools, add --tools:

{
"mcpServers": {
"ssg-governance": {
"command": "ssg",
"args": ["mcp-server", "--tools=fleet,onboarding"],
"env": {
"SSG_CLIENT": "claude-code"
}
}
}
}

Config file locations:

ClientConfig file
Claude Code.claude/mcp_config.json or ~/.claude/mcp_config.json
Antigravitymcp_config.json or ~/.gemini/mcp_config.json
Codex~/.codex/config.toml
Cursor.cursor/mcp.json
Windsurf~/.codeium/windsurf/mcp_config.json

Step 3 — Restart your client

The MCP server is registered at startup. Restart your AI client once to pick up the new tools.

Step 4 — Say hello

"Set up SigmaShake governance for my project"

Token Budget

MCP servers expose their tool definitions in every conversation — this costs tokens. SSG uses opt-in tool groups so you only pay for what you need.

ModeToolsApprox. tokensUse case
ssg mcp-server (default)4~428Daily coding — evaluate, check, status, blocked
--tools=onboarding9~1,468Project setup and Hub search
--tools=fleet14~2,104Fleet administration
--tools=all19~3,144Everything

The startup log tells you exactly what's loaded:

[ssg] MCP server v0.21.1 started (SSG_CLIENT=cursor, tools=core, 4 tools ≈ 428 tokens)

Choosing a tool group

# Default — core governance only (recommended for coding sessions)
ssg mcp-server

# Add onboarding tools (first-time setup, Hub search, rule writing)
ssg mcp-server --tools=onboarding

# Add Fleet admin tools (org creation, SSO, enrollment)
ssg mcp-server --tools=fleet

# Multiple groups
ssg mcp-server --tools=fleet,onboarding

# Everything
ssg mcp-server --tools=all

Or set SSG_MCP_TOOLS in your MCP config's env block instead of passing --tools as an argument:

{
"mcpServers": {
"ssg-governance": {
"command": "ssg",
"args": ["mcp-server"],
"env": {
"SSG_CLIENT": "cursor",
"SSG_MCP_TOOLS": "onboarding"
}
}
}
}

Per-call overhead is low regardless of mode: a typical ssg_evaluate call (tool name + input) + allow response costs ~62 tokens. The token budget above is the one-time system prompt injection cost.


Tool Reference

The MCP server provides 19 tools across three groups. Only core tools are active by default.

Core Governance (always active)

ToolDescription
ssg_evaluateEvaluate a tool call against active rules. Returns allow, block, ask, log, or force. Called automatically before every agent tool use.
ssg_checkScan a file or directory path for rule violations.
ssg_statusReturn governance health: active rule count, daemon status, plan tier.
ssg_blockedReturn all blocked or forced tool calls from this session.

Onboarding & Setup (--tools=onboarding)

ToolDescription
ssg_onboardFull project setup in one call. Detects your tech stack, initializes .sigmashake/, pulls matching Hub rulesets, runs lint, returns a health summary. Start here.
ssg_doctorComprehensive health check. Returns status for every subsystem: rules loaded, daemon, license tier, client adapter.
ssg_hub_searchSearch hub.sigmashake.com for rulesets by technology or keyword. Returns IDs, titles, rule counts.
ssg_hub_pullDownload and install a Hub ruleset. SHA-256 integrity + Ed25519 signature verified before install.
ssg_write_ruleWrite a custom .rules file to .sigmashake/rules/. AI authors the rule from your description; lint runs automatically to validate.

Enterprise Fleet Admin (--tools=fleet)

ToolDescription
ssg_fleet_statusLocal Fleet enrollment status for this machine.
ssg_fleet_create_orgCreate a new Fleet organization. Returns the org_id needed for all subsequent commands.
ssg_fleet_configure_ssoConfigure OIDC or SAML 2.0 SSO for a Fleet org. Prints required redirect URIs.
ssg_fleet_set_domainBind an email domain for automatic Enterprise license tier on SSO login.
ssg_fleet_create_enroll_keyGenerate a reusable enrollment key for developer workstations.
ssg_fleet_add_memberAdd a user to a Fleet org by email with a specific role.
ssg_fleet_create_policyCreate a governance policy (draft state; requires approval to activate).
ssg_fleet_list_agentsList enrolled agents with heartbeat status (🟢 online / 🟡 idle / 🔴 offline).
ssg_fleet_healthAggregate org health: agent count, active policies, SSO status.
ssg_fleet_diagnose_ssoDiagnose SSO issues: tests OIDC discovery, JWKS validity, prints required redirect URIs.

Tool Examples

ssg_onboard — Full project setup

"Set up SigmaShake for my TypeScript + React project"

Response:

SigmaShake Onboarding — /home/user/my-app

Stack Detection
Detected: TypeScript + React

Initializing .sigmashake/
✓ .sigmashake/config.toml
✓ .sigmashake/rules/security.rules

Hub Rulesets (2 detected)
✓ TypeScript Governance Rules v3
✓ React Component Rules v2
2/2 rulesets installed

Validation
✓ All rules pass lint checks

✓ SigmaShake is ready!

ssg_hub_search — Discover rulesets

"Find security rules for Docker"

Response:

Hub Search: "docker" — 3 result(s)

Docker Security Rules
ID: rules-docker
Tech: docker, containers
Rules: 8 | Downloads: 2,341
Author: @sigmashake

ssg_write_rule — Create a custom rule

"Block any command that runs npm publish without my approval"

Agent writes:

rule require-approval-npm-publish {
enabled true
priority 90
severity error
ASK execution
IF command CONTAINS "npm publish"
MESSAGE "npm publish detected."
PROMPT "Allow publishing to npm registry?"
}

Response: ✓ Rule file created: .sigmashake/rules/npm-safety.rules | Lint: PASSED

ssg_evaluate — Manual rule evaluation

{
"tool": "run_command",
"input": { "CommandLine": "git push --force origin main" }
}

Response:

{
"decision": "block",
"rule_id": "no-force-push",
"reason": "Force push is blocked. Use --force-with-lease."
}

Environment Variables

VariableDescription
SSG_CLIENTClient adapter name: claude-code, cursor, antigravity, gemini, codex, copilot, generic
SSG_MCP_TOOLSTool groups to expose: fleet, onboarding, all (comma-separated). Same as --tools flag.
SSG_FLEET_SA_KEYFleet service account key (ssg_sa_...) for admin tool authentication
SSG_FLEET_API_URLOverride Fleet API base URL (default: https://fleet.sigmashake.com)

Governance Enforcement

The MCP server enforces its own governance rules through ssg_evaluate. Every tool call an AI agent makes is evaluated before execution. This applies to all MCP tool calls, not just SigmaShake tools.

The evaluation chain:

  1. Agent calls a tool (e.g. run_command)
  2. ssg_evaluate is called first with the tool name + input
  3. Engine evaluates against active .sigmashake/rules/ files
  4. Decision returned: allow → tool runs, block → tool rejected, ask → paused for approval

Troubleshooting

Tools not appearing in my AI client

  1. Check that ssg mcp-server starts and lists tools:

    echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | ssg mcp-server

    Should return a JSON array. By default this is 4 tools (core only).

  2. If you need onboarding or fleet tools, they must be explicitly enabled:

    echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | ssg mcp-server --tools=all
  3. Restart your AI client — MCP connections are established at startup.

  4. Verify the config file path and JSON syntax are correct.

"Not authenticated" error from onboarding tools

ssg auth login # Browser login — one click
ssg auth status # Verify you're logged in

Fleet tools not available

Fleet tools must be opted-in explicitly:

# Via CLI arg
ssg mcp-server --tools=fleet

# Via mcp_config.json env var
"SSG_MCP_TOOLS": "fleet"

If you call a fleet tool without enabling it, you'll get:

Tool "ssg_fleet_create_org" not enabled. Restart with: ssg mcp-server --tools=fleet

Fleet tools returning permission errors

Use a service account key for Fleet admin operations:

export SSG_FLEET_SA_KEY=ssg_sa_your_key_here

Or ensure your session has org_admin role on the target organization.

ssg_write_rule lint errors

The AI will surface the exact lint error. Common causes:

  • Missing enabled true field
  • Incorrect indentation (rules use 2-space indent)
  • Unknown field name in IF condition

See Rule Syntax for the complete language reference.


Security Notes

  • The MCP server runs locally as a subprocess — no outbound connections except to the Fleet API and hub.sigmashake.com when those tools are used
  • SSG_FLEET_SA_KEY is read from the process environment — never passed to or exposed by the AI agent
  • ssg_write_rule writes only inside .sigmashake/rules/ — path traversal is prevented via basename() validation
  • ssg_fleet_* tools validate fleet_url against *.fleet.sigmashake.com to prevent SSRF
  • All Fleet API requests include AbortSignal.timeout(10_000) to prevent hanging