API Documentation

The Nervous System MCP Server - v1.1.0

Overview

The Nervous System is an MCP (Model Context Protocol) server that provides behavioral enforcement for LLMs. It exposes 11 tools and 4 resources that any MCP-compatible client can use to implement AI governance.

GitHub: github.com/levelsofself/mcp-nervous-system

Endpoints

SSE/sseServer-Sent Events (MCP standard)
POST/messageMCP message handler
POST/mcpHTTP transport (stateless)
GET/healthHealth check
GET/Server info + tool list
POST/killEmergency kill switch (auth required)
GET/audit/verifyVerify audit chain integrity
GET/dispatchesList active dispatched agents

Tools

Each tool returns structured data that can be used to build system prompts, enforce guardrails, or implement governance workflows.

get_framework
Returns the complete Nervous System framework: all 7 behavioral rules, the permission protocol (DATA vs LOGIC changes), enforcement mechanisms, and implementation patterns. Use this to bootstrap a governed LLM session.
guardrail_rules
Returns the 7 core behavioral rules: DISPATCH DONT DO, UNTOUCHABLE, WRITE PROGRESS, STEP BACK, DELEGATE AND RETURN, ASK BEFORE TOUCHING, HAND OFF. Each rule includes its trigger condition, enforcement mechanism, and failure mode it prevents.
preflight_check
Returns the preflight check system. This is the mechanical enforcement layer: a shell script that checks every file edit against an UNTOUCHABLE list, blocks unauthorized edits, and logs violations with timestamps.
session_handoff
Returns the session handoff pattern: templates for writing continuity documents that preserve context across LLM sessions. Prevents the #1 failure mode of long-running AI work: context loss.
worklog
Returns the worklog pattern: continuous progress documentation that prevents silent failures. The LLM writes what it did, files changed, and system state after every session.
violation_logging
Returns the violation logging pattern: how to track every guardrail breach with timestamps, violation type, and context. Creates an auditable enforcement history.
step_back_check
Returns the forced reflection system. Every N messages, the LLM is required to stop and evaluate: are we solving the real problem? This is a circuit breaker against drift and tunnel vision.
get_nervous_system_info
Overview of the entire system: origin, motivation, implementation guide, operational stats, and what problems it solves.
emergency_kill_switch
Emergency stop all agents. Immediately halts all running processes managed by the Nervous System. Requires KILL_SECRET bearer token for authentication. Returns confirmation with timestamp. Input: { reason: "string" }
verify_audit_chain
Verify tamper-evident audit trail integrity. Walks the SHA-256 hash-chained violation log and checks every entry against its predecessor. Returns chain validity status. Response: { valid: boolean, entries: number, broken_at: number|null }
dispatch_to_llm
Spawn a background LLM agent for complex tasks. Any MCP client can delegate heavy work to a dedicated agent process. Max 2 concurrent dispatches, requires 500MB+ free RAM. Input: { task: "string", max_turns: number } Response: { dispatched: boolean, pid: number, log: "filepath" }

Resources

URIName
nervous-system://frameworkThe Nervous System Framework
nervous-system://quick-startQuick Start Guide
nervous-system://rulesThe 7 Core Rules
nervous-system://templatesTemplates

Quick Start

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "nervous-system": {
      "command": "npx",
      "args": ["-y", "mcp-nervous-system"]
    }
  }
}

Claude Code

claude mcp add nervous-system npx mcp-nervous-system

HTTP Integration

# Get complete framework
curl -X POST http://localhost:3475/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "get_framework",
      "arguments": {}
    },
    "id": 1
  }'

What It Solves

ProblemRuleMechanism
Context loss between sessionsHand Off / Write ProgressDisk-based handoff files, mandatory before session end
Silent failuresWrite ProgressProgress noted before each action; if timeout, last state visible
Goal drift / tunnel visionStep BackForced reflection every N messages, non-optional
File damage / overreachUntouchable + PreflightShell script blocks edits to protected files, logs violations
Debug loops / rabbit holesDispatch Dont DoTasks taking 2+ messages dispatched to background agents
Unauthorized changesAsk Before TouchingLogic changes require human approval; data changes can proceed

Production Stats

From the live Palyan AI deployment (February 28 - March 5, 2026):

MetricValue
Violations caught56
Edits blocked by preflight32
Stale handoff warnings24
Unique files protected13
Rules bypassed0
Processes monitored22
Tools available11