# Connect an AI agent over MCP

> Connect Claude, ChatGPT, Claude Code or Cursor to your Stolon database: agent memory where every write is a version, undo, history, and review and merge of database branches.

Source: https://stolondb.com/guides/mcp/ · Page title: Connect an AI agent over MCP — Stolon

Your database serves MCP. In a conversation, an agent can fork the database, query it, change its code, and merge the result, and its memory keeps **every write as a version**, so nothing is lost.

## Connect

Your database's MCP address is on its page in [the console](https://console.stolondb.com/app), under **Connect an AI client**:

```text
https://console.stolondb.com/mcp/acme
```

Add it to your client and sign in when asked. Each person signs in as themselves, and their agent writes on its own line.

| Client | How |
| --- | --- |
| Claude | Settings, Connectors, **Add custom connector**, paste the address. |
| ChatGPT | In Settings, add a custom connector with the address (developer mode). |
| Claude Code | `claude mcp add --transport http stolon https://console.stolondb.com/mcp/acme`, then `/mcp` to sign in. |
| Cursor | Add `{"mcpServers": {"stolon": {"url": "https://console.stolondb.com/mcp/acme"}}}` to `~/.cursor/mcp.json`. |

Clients without sign-in can use a token from the same console panel, sent as `Authorization: Bearer <token>`.

## What an agent can do

| Task | Tools | Ask it |
| --- | --- | --- |
| Fork the database | `create_branch` · `branches` | “Fork the database and try the new pricing there.” |
| Query and change data | `sql` | “Which customers signed up last week?” Reads go anywhere; changes belong on a branch. |
| Work on the code | `list_files` · `read_file` · `write_file` | “Fix the rounding bug in `billing.py` on that branch.” |
| Remember | `put` · `get` · `scan` · `search` | “Save the decisions from this session under `project/`.” |
| Look back | `history` · `diff` · `changes` | “What did we believe about the launch date last week, and what changed?” |
| Undo | `checkout` | “Go back to before you rewrote the plan.” The newer versions stay readable. |
| Correct, with a trail | `put` with `supersedes` | “That price was wrong; correct it.” The old value reads as superseded, not just older. |
| Load context | `window` · `brief` | “Load what you need for this task.” Pinned keys come first, under a size budget. |
| Check its own citations | `check` | “Check this summary against what we stored.” Stale or missing facts are flagged. |
| Try several approaches | `rollouts_open` · `rollouts_close` | “Try three plans in parallel and keep the best.” |
| Review database branches | `pull_requests` · `pull_request` · `compare` | “What would merging `agent-7` change?” |
| Merge | `merge` · `approve` · `decide` | “Merge it if there are no conflicts, and record why.” |

Reads also take `as_of`, a time or a date, to see a past moment.

## A session

```text
put {"key": "task/1", "value": "draft plan", "note": "first try"} -> {"version":1}
put {"key": "task/1", "value": "wrong plan"} -> {"version":2}
checkout {"version": 1} -> {"head":1,"previous_head":2}
get {"key": "task/1"} -> {"found":true,"value":"draft plan"}
```

Version 2 is still readable: undo erases nothing.
