# okl MCP server

> Maintains coding agent alignment by recording rules, architecture decisions, and lessons learned to prevent drift from specifications and code.

- Repository: https://github.com/emeraldleaf/okl
- Page: https://hostedmcp.org/servers/emeraldleaf/okl
- Transport: stdio
- Stars: 4
- License: MIT
- Latest version: 0.18.0

## Install

### Claude Code

```sh
claude mcp add okl -- uvx observed-knowledge-ledger
```

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

```json
{
  "mcpServers": {
    "okl": {
      "command": "uvx",
      "args": [
        "observed-knowledge-ledger"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "okl": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "observed-knowledge-ledger"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"okl","type":"stdio","command":"uvx","args":["observed-knowledge-ledger"]}'
```

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

```json
{
  "mcpServers": {
    "okl": {
      "command": "uvx",
      "args": [
        "observed-knowledge-ledger"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add okl -- uvx observed-knowledge-ledger
```

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

```toml
[mcp_servers.okl]
command = "uvx"
args = ["observed-knowledge-ledger"]
```

### Gemini CLI

```sh
gemini mcp add -s user okl uvx -- observed-knowledge-ledger
```

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

```json
{
  "mcpServers": {
    "okl": {
      "command": "uvx",
      "args": [
        "observed-knowledge-ledger"
      ]
    }
  }
}
```

## FAQ

### How does okl prevent agents from repeating mistakes?

It uses a briefing process that provides matching lessons to the agent before it writes code, based on the task's words or the files being read.

### Can okl prevent code from drifting away from documentation?

Yes, it uses a pre-push hook or CI gate that flags when code changes violate the rules or checks that govern them.

### Does okl use generative models automatically?

No, it does not run generative models by default and only calls them if you explicitly name one for optional review steps.

### How do I add a new rule to the ledger?

You can use the okl_record MCP tool or the CLI command to record a lesson with a title, symptom, and fix.
