npm package: @rubiconsoftware/anchor-mcp
Description: MCP server for Anchor Decision Intelligence — bias detection, decision analysis, and history tracking for Claude Code, Cursor, and MCP-compatible AI tools
Latest version: 0.1.0

# Anchor MCP Server

Decision Intelligence for Claude Code, Cursor, and MCP-compatible AI tools.

Anchor gives your AI coding assistant the ability to check decisions for bias, analyse trade-offs, record decisions into a system of record, and learn from your decision-making patterns over time.

## Quick Start (2 minutes)

**Prerequisites:** Node.js 18+ and an Anchor API key.

### 1. Get an API Key

Ask your Anchor admin for a key, or generate one via the API:

```bash
curl -s -X POST https://ca-anchor-api-dev.orangesmoke-ddb1ea02.uksouth.azurecontainerapps.io/api/apikeys \
  -H "Authorization: Bearer <your-token>" \
  -H "Content-Type: application/json"
```

Save the returned `apiKey` value immediately — it is shown only once.

### 2. Configure Your AI Tool

**Claude Code** — Add to `.mcp.json` in your project root:

```json
{
  "mcpServers": {
    "anchor": {
      "command": "npx",
      "args": ["-y", "@rubiconsoftware/anchor-mcp"],
      "env": {
        "ANCHOR_API_KEY": "ak_live_your_key_here",
        "ANCHOR_API_URL": "https://ca-anchor-api-dev.orangesmoke-ddb1ea02.uksouth.azurecontainerapps.io"
      }
    }
  }
}
```

> **Windows users:** Use `cmd /c npx` instead of `npx`:
>
> ```json
> "command": "cmd",
> "args": ["/c", "npx", "-y", "@rubiconsoftware/anchor-mcp"]
> ```

**Cursor** — Add to MCP settings in Cursor preferences with the same command/args/env.

**Important:** Add `.mcp.json` to your `.gitignore` — it contains your API key.

### 3. Add Decision Protocol to CLAUDE.md

Add these lines to your project's `CLAUDE.md` to tell the AI *when* to use the tools:

```markdown
## Decision Protocol

Before committing to architecture choices, technology selections, design trade-offs,
effort estimates, or irreversible decisions:
1. Call `anchor_check_decision` with the situation — if CAUTION or STOP,
   call `anchor_analyze_decision` for deeper analysis.
2. After a decision crystallizes, call `anchor_capture_decision` to record it.
3. When uncertain about precedent, call `anchor_get_history` to check for
   similar past decisions.
```

### 4. Verify

Start a Claude Code session and ask it to make a decision. You should see it call `anchor_check_decision`.

## Tools

| Tool | Description | Tokens |
|---|---|---|
| `anchor_check_decision` | Lightweight checkpoint — returns CLEAR/CAUTION/STOP with bias flags | ~150 |
| `anchor_analyze_decision` | Deep analysis with bias detection, reframing, recommendations | ~300-500 |
| `anchor_capture_decision` | Record a decision into the system of record | ~50 |
| `anchor_get_history` | Search past decisions for precedent | ~100/entry |
| `anchor_get_profile` | Your cognitive decision-making profile | ~200 |

## Environment Variables

| Variable | Required | Default | Description |
|---|---|---|---|
| `ANCHOR_API_KEY` | Yes | — | API key starting with `ak_live_` |
| `ANCHOR_API_URL` | No | `http://localhost:5000` | Anchor API base URL |

## Development

If you're contributing to the MCP server itself:

```bash
cd mcp-server
npm install
npm run build
npm run dev    # Run with tsx for development
```

## Architecture

This MCP server is a thin wrapper (~160 lines) over the Anchor REST API. All decision intelligence — bias detection, cognitive profiling, two-stage LLM analysis — lives in the API, not here.

See [ADR-010](../docs/adr/ADR-010-mcp-server-architecture.md) for design rationale.