# StateCore MCP server

> Provides auditable long-term memory for AI agents using an evidence-based digest pipeline and versioned state history.

- Repository: https://github.com/yul761/StateCore
- Page: https://hostedmcp.org/servers/yul761/statecore
- Transport: stdio
- Stars: 1
- License: MIT
- Latest version: 0.1.2

## Install

### Claude Code

```sh
claude mcp add --env 'MODEL_API_KEY=<YOUR_MODEL_API_KEY>' statecore -- npx -y statecore-mcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "statecore": {
      "command": "npx",
      "args": [
        "-y",
        "statecore-mcp"
      ],
      "env": {
        "MODEL_API_KEY": "<YOUR_MODEL_API_KEY>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "statecore": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "statecore-mcp"
      ],
      "env": {
        "MODEL_API_KEY": "<YOUR_MODEL_API_KEY>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"statecore","type":"stdio","command":"npx","args":["-y","statecore-mcp"],"env":{"MODEL_API_KEY":"<YOUR_MODEL_API_KEY>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "statecore": {
      "command": "npx",
      "args": [
        "-y",
        "statecore-mcp"
      ],
      "env": {
        "MODEL_API_KEY": "<YOUR_MODEL_API_KEY>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add statecore --env 'MODEL_API_KEY=<YOUR_MODEL_API_KEY>' -- npx -y statecore-mcp
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.statecore]
command = "npx"
args = ["-y", "statecore-mcp"]

[mcp_servers.statecore.env]
MODEL_API_KEY = "<YOUR_MODEL_API_KEY>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'MODEL_API_KEY=<YOUR_MODEL_API_KEY>' statecore npx -- -y statecore-mcp
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "statecore": {
      "command": "npx",
      "args": [
        "-y",
        "statecore-mcp"
      ],
      "env": {
        "MODEL_API_KEY": "<YOUR_MODEL_API_KEY>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `MODEL_API_KEY` | no | yes | OpenAI-compatible API key for background distillation (DeepSeek, OpenAI, Ollama, ...); not required for core memory, audit, and recall |
| `DATABASE_URL` | no | no |  |
| `FEATURE_LLM` | no | no | Set to 'true' together with MODEL_* variables to enable background distillation of conversational events; everything else works without it |
| `LOCAL_USER_TOKEN` | no | no |  |
| `MODEL_BASE_URL` | no | no | OpenAI-compatible base URL for the distillation model (e.g. https://api.deepseek.com/v1) |
| `MODEL_NAME` | no | no | Model used for background distillation (e.g. deepseek-chat) |
| `MODEL_PROVIDER` | no | no |  |
| `REDIS_URL` | no | no |  |
| `STATECORE_SCOPE` | no | no | Override the memory scope name (defaults to the git repository root, else the working directory) |

## FAQ

### How do I add StateCore to Claude Code?

You can add it using the command: claude mcp add statecore -- npx -y statecore-mcp

### Does StateCore require a running server or API keys?

The MCP version can run embedded with a single SQLite file and requires no server or signup, making it keyless by default.

### How does StateCore handle deleted or replaced information?

Information is never silently deleted; replaced facts maintain a supersession chain and retired facts are marked for auditability.
