Skip to main content
Glama
README.md
# @putervision/behavior-mcp

[![npm version](https://img.shields.io/npm/v/@putervision/behavior-mcp.svg)](https://www.npmjs.com/package/@putervision/behavior-mcp)
[![version](https://img.shields.io/badge/version-0.4.1-blue.svg)](./CHANGELOG.md)
[![CI](https://github.com/putervision/behavior-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/putervision/behavior-mcp/actions/workflows/ci.yml)
[![Node](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg)](https://nodejs.org)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

> **High-Frequency (~60Hz) In-Browser Behavior Tree Tactical Runtime Engine for AI Agents**

`@putervision/behavior-mcp` is a Model Context Protocol (MCP) server that executes deterministic behavior trees directly in browser runtimes at ~60Hz with reactive trigger preemption, frame recordings, SHA-256 Merkle audit chains, and a 5-layer safety guardrail stack.

๐ŸŒ **Official Documentation**: [putervision.com](https://putervision.com) โ€ข [Interactive Web Docs](docs/index.html)

---

## โšก 15-Second Quick Start

```bash
# 1. Initialize runtime & seed default behavior trees in your workspace
npx @putervision/behavior-mcp init

# 2. Run system diagnostic and health checks
npx @putervision/behavior-mcp doctor

# 3. Inspect active executions, blackboard state, and reactive triggers
npx @putervision/behavior-mcp inspect
```

---

## ๐Ÿ› ๏ธ 10 Core MCP Tools

| Tool | Actions | Purpose |
|------|---------|---------|
| `load_behavior` | `load`, `unload`, `swap` | Inject, initialize, or hot-swap a behavior tree in browser runtime |
| `set_parameters` | `set`, `get`, `reset` | Dynamically update or query runtime execution parameters |
| `get_status` | `current`, `history`, `tree_state` | Query active status, node traversal path, tick count, duration |
| `abort_behavior` | `abort`, `pause`, `resume` | Halt, pause, or resume behavior execution safely |
| `register_trigger` | `register`, `list` | Configure reactive interrupt triggers with priority preemption |
| `replay_recording` | `capture`, `list` | Capture or inspect deterministic browser action sequences |
| `get_metrics` | `current`, `history` | Retrieve runtime telemetry, tick durations, and stuck events |
| `manage_behaviors` | `register`, `get`, `list` | CRUD for immutable behavior tree JSON with SHA-256 tree hashes |
| `manage_blackboard` | `get`, `set` | Read, write, or query shared behavior tree blackboard variables |
| `manage_runtime_db` | `stats`, `audit`, `snapshot`, `restore` | SQLite diagnostics, SHA-256 Merkle audit, and checkpoint rollback |

---

## ๐Ÿ›ก๏ธ 5-Layer Safety Guardrail Stack & System 1 Invariants

1. **Fail-Closed Evaluator**: Unrecognized node definitions throw fatal exceptions immediately.
2. **60Hz Tick Invariant & Synchronous `semantic_check`**: The loop never blocks on external network calls; semantic condition checks resolve synchronously against blackboard caches.
3. **HMAC Intention Gate Verification**: Intentions dispatched to execution nodes require unexpired, cryptographically signed dispatch tokens (`PENTAD_HMAC_SECRET`).
4. **Action Rate Limiter & Leaf Policy Gate**: Strict 60 actions/sec maximum throughput ceiling and policy guardrails blocking irreversible mutations.
5. **Emergency Kill Switch & Watchdog Heartbeat**: Atomic safety latch and watchdog timers halting execution if tick stalls beyond 5,000ms.

---

## ๐Ÿ“š Deep Documentation Guides

- ๐Ÿ“– **[Formal API Reference](docs/api-reference.md)**: Full parameter tables, type definitions, and tool schemas.
- ๐Ÿ’ก **[Core Architecture & Concepts](docs/concepts.md)**: Behavior tree execution model, ~60Hz loop, and trigger lifecycle.
- ๐Ÿ–ฅ๏ธ **[CLI Usage Guide](docs/cli-usage.md)**: Complete CLI command reference (`init`, `doctor`, `inspect`, `run`).
- ๐Ÿ’พ **[Database Schema](docs/database-schema.md)**: SQLite table structures, indexes, and Merkle audit ledger.
- โš™๏ธ **[Configuration Reference](docs/configuration.md)**: `.behavior-mcp.json` parameters and environment variables.

---

## ๐Ÿ”— Client Configuration & Environment

Add to `.cursor/mcp.json` or `.vscode/mcp.json`:
```json
{
  "mcpServers": {
    "behavior-mcp": {
      "command": "behavior-mcp",
      "args": ["run"],
      "env": {
        "PENTAD_HMAC_SECRET": "your-secure-shared-secret-here"
      }
    }
  }
}
```

---

## ๐Ÿงช Testing

```bash
# Run full unit and integration test suite across 38 test files (266 tests)
npm test
```

---

## ๐Ÿ“„ License
MIT ยฉ PuterVision

TDQS

A4.2/5.0

Scored across 10 tools

Disambiguation5/5

Each tool targets a distinct aspect of behavior tree runtime management, and descriptions explicitly guide against misselection (e.g., 'use X instead of Y'). Overlaps like get_status vs get_metrics and load_behavior vs manage_behaviors are clearly differentiated.

Naming Consistency5/5

All tool names follow a consistent snake_case verb_noun pattern (e.g., load_behavior, set_parameters, get_status, manage_blackboard). No mixing of conventions or vague abbreviations.

Tool Count5/5

10 tools is well-scoped for a behavior tree runtime server. Each tool earns its place by covering a unique functional area without redundancy.

Completeness4/5

The surface covers definition, execution, monitoring, data sharing, triggers, recordings, metrics, and DB maintenance. Minor gaps exist: no explicit delete/update for behavior definitions (immutability may excuse this), no release for blackboard leases, and no delete for recordings.

Maintenance

ActivityNo data
ResponsivenessNo issues