Statewright

Self-Hosted

Run the full Statewright stack locally with Docker Compose

Self-Hosted

Run PocketBase, the MCP gateway, and the workflow editor locally. No cloud dependency, no external API keys. BYO Ollama.

Prerequisites

Quick Start

git clone https://github.com/statewright/statewright.git
cd statewright/self-hosted
docker compose up --build

First build takes a few minutes (Rust compilation). Subsequent starts are fast.

ServicePortDescription
Gateway:3001MCP protocol server
UI:8080Workflow editor
PocketBase:8090State persistence (SQLite) + admin UI

Connect Your Agent

Pi

pi install /path/to/statewright/plugins/pi
cd /path/to/statewright/plugins/pi && npm install
export STATEWRIGHT_GATEWAY_URL=http://localhost:3001
pi

Claude Code

claude /plugin marketplace add statewright/statewright

Then in your project's .mcp.json:

{
  "mcpServers": {
    "statewright": {
      "command": "bash",
      "args": ["path/to/plugins/claude-code/mcp-proxy.sh"],
      "env": {
        "STATEWRIGHT_GATEWAY_URL": "http://localhost:3001"
      }
    }
  }
}

Codex

codex plugin marketplace add statewright/statewright
codex plugin add statewright --marketplace statewright

Set the gateway URL in ~/.codex/config.toml:

[mcp_servers.statewright]
env_vars = ["STATEWRIGHT_GATEWAY_URL"]

Load a Workflow

From any connected agent:

> load the bugfix workflow, then fix the failing tests

The gateway ships with the bugfix workflow template. Create custom workflows through the UI at http://localhost:8080 or via MCP tools.

Add Ollama

The self-hosted stack doesn't include Ollama — bring your own. If you're using Pi with local models:

ollama serve &
pi --model ollama/gemma4:12b

Data

All state is persisted in a Docker volume (pb_data). To reset:

docker compose down -v
docker compose up --build

On this page