Positions by what stands on the board, found across master games, each with a game that reached it.
edgecaseai/ chessdrive-plugin On a phone or the Free plan? Add just the Connector
https:/ / api.chessdrive.io/ mcp Paste this one line into Claude Code, Codex or Cursor. It sets everything up, gives you one link to sign in with, and starts your first review.
Set up ChessDrive for me: fetch and follow https://chessdrive.io/setup.md, which installs its CLI with `npm install -g chessdrive`.
# Set up ChessDrive
> Official instructions from ChessDrive for setting it up in a coding agent: the `chessdrive` CLI, the ChessDrive Skills and the ChessDrive Connector. They are published at https://chessdrive.io/setup.md, so you can check where they come from before you follow them.
Your person asked you to set ChessDrive up. ChessDrive gives you Skills for chess: game reviews, the mistakes they keep making, opponent prep and more, every move checked by an engine. Do every step yourself by running its commands, except the ones marked **Your person's step**: a browser sign-in or a restart happens outside your session, so ask them and wait. Never run a command that waits at a prompt. Every command here is safe to run again on a machine that is already set up.
**In Claude's or ChatGPT's chat app, not a coding agent?** No terminal is needed: follow https://chessdrive.io/cookbook/add-to-your-ai.md instead.
## 1. Install the CLI
```
npm install -g chessdrive
```
Without npm, run `curl -fsSL https://chessdrive.io/install.sh | sh` instead, or follow https://chessdrive.io/docs/cli on Windows. Either one also updates a CLI that is already there.
Check: `chessdrive version` prints a version.
## 2. Sign the CLI in
If `chessdrive balance` already prints a Plan and a Balance, the CLI is signed in: go on to step 3. Otherwise run `chessdrive login --no-wait`. It prints a link and a code, and returns.
> **Your person's step.** Give them the link and the code, and ask them to open the link, check the code, pick their Account and choose Allow. Wait for them to say they have.
Then run `chessdrive login`, which finishes at once. That's their only sign-in: the Connector uses the key the CLI saved. Never print that key, or write it anywhere a step doesn't say.
Check: `chessdrive balance` prints their Plan and Balance. If the Balance isn't what they expect, they allowed another Account: run `chessdrive logout`, then this step again, and ask them to pick the right Account.
## 3. Add the Skills and the Connector
Use your agent's section.
### Claude Code
Install the Plugin, which brings the Skills and the Connector. The Connector uses the key the CLI saved, so there is no second sign-in.
```
claude plugin marketplace add edgecaseai/chessdrive-plugin
claude plugin install chessdrive@chessdrive
```
Check: `claude plugin list | grep -A2 'chessdrive@chessdrive'` shows it enabled. If it's listed but disabled, run `claude plugin enable chessdrive@chessdrive`.
> **Your person's step.** Ask them to run `/reload-plugins` in Claude Code, or restart it, to load the Plugin. Wait for them to say they have.
### Codex
Download https://chessdrive.io/plugin/chessdrive.zip, unzip it and copy every folder in its `skills` folder, with all its files, to the folder where Codex reads your person's own Skills, so they work in every project. Copying again replaces them with the latest.
Then the Connector: in `~/.codex/config.toml`, a `[mcp_servers.chessdrive]` table with `url = "https://api.chessdrive.io/mcp"` and `http_headers_helper = "<the full path of chessdrive> key --headers"`. If the table is already there, leave it.
Check: `codex mcp list` lists chessdrive.
> **Your person's step.** Ask them to restart Codex. In Codex Desktop, quit it fully and open it again.
### Cursor
Download https://chessdrive.io/plugin/chessdrive.zip, unzip it and copy every folder in its `skills` folder, with all its files, to the folder where Cursor reads your person's own Skills, so they work in every project. Copying again replaces them with the latest.
Then the Connector: in `~/.cursor/mcp.json`, a server named chessdrive with `"url": "https://api.chessdrive.io/mcp"` and `"headers": { "Authorization": "Bearer ${env:CHESSDRIVE_CONNECTOR_KEY}" }`. Merge it into the file, and keep the other servers. Then add `export CHESSDRIVE_CONNECTOR_KEY="$(chessdrive key 2>/dev/null)"` to their shell's startup file, once. On Windows, leave out the headers and the export: Cursor signs in through their browser.
Check: `~/.cursor/mcp.json` has the chessdrive server.
> **Your person's step.** Ask them to restart Cursor.
### Any other agent
Download https://chessdrive.io/plugin/chessdrive.zip, unzip it and copy every folder in its `skills` folder, with all its files, to the folder where you read your person's own Skills, so they work in every project. Copying again replaces them with the latest.
Then add a remote MCP server named chessdrive at https://api.chessdrive.io/mcp, sending `Authorization: Bearer` and the key `chessdrive key` prints. Merge it into your MCP settings, and keep the other servers. Restart if your agent needs it.
## 4. Report the result
Report only what you checked. Don't mark a line done that you couldn't confirm.
```
┌─ ChessDrive set-up ────────────────────────────┐
│ ✓ CLI signed in: Free plan, $10.00 │
│ ✓ Skills Game review, Patterns, Prep, … │
│ ⚠ Connector restart your agent to load it │
└────────────────────────────────────────────────┘
```
Use ✓ for checked, ⚠ for waiting on your person, and ✗ for failed. After the banner, give the next action for every line that isn't ✓.
## 5. Get them started
Ask for their Lichess or chess.com username. If you can use the ChessDrive Skills now, offer to review their last game, and on their yes do it with the Game review Skill. Otherwise, once they've restarted you, they can send one of these:
- "Review my last game. I’m <username> on Lichess."
- "Find the mistakes I keep making. I’m <username> on chess.com."
- "Prep me for my game against <opponent> on Lichess."
## No person present
In CI or an agent SDK run, nobody can do the person's steps. Read the key from `CHESSDRIVE_API_KEY`: if it isn't set, stop and say so. Save it for the CLI with `printenv CHESSDRIVE_API_KEY | chessdrive login`, and never ask for it, print it or write it to a file. Then do step 3 and skip the restarts: your agent loads the Skills and the Connector the next time it starts.
## If something fails
- **No npm, or npm can't install globally:** use the installer in step 1. It needs neither npm nor sudo.
- **Your agent's safety check refuses an install:** don't work around it. Ask your person to run that command themselves; in Claude Code, `!` before a command runs it in the session.
- **`No ChessDrive API at …`:** the CLI is pointed at the wrong address. Check `--base-url` and `CHESSDRIVE_BASE_URL`.
- **The link or the code has expired:** run step 2 again for a new one.
- **Don't open https://api.chessdrive.io/mcp in a browser:** it's for agents, not a web page. Every sign-in starts from the CLI.
- **The Skills or the Connector's tools are missing:** your person restarts the agent. Then ask them to try "Which ChessDrive Skills do you have?".The Connector’s address is the same in every agent. The MCP docs
Check it worked: ask What’s my ChessDrive balance?
Runs cost about $0.10 from your Balance · Free’s $10 covers about 100 runs(estimate)
---
name: chessdrive-position-filter
description: Find chess positions by what stands on the board, across over two million games by strong players, with ChessDrive's Search. Use when someone asks for positions or examples such as "rook endings with White to move", "a knight on the rim", "opposite-coloured bishops", "a passed pawn on the seventh" or "kings castled on opposite sides", from master games rather than their own. Writes a Position filter from their words, runs it with Search's `where` mode, and links each position to a board. Calls ChessDrive with the ChessDrive Connector's `search` tool in a chat app, Claude's or ChatGPT, and through the `chessdrive` CLI in a coding agent.
---
# Find positions by a filter
You turn what someone describes on a board into a **Position filter**, run it with Search, and show them the positions it finds, each with a game that reached it. Read `<this Skill's folder>/../chessdrive-vectors/references/calls.md` before your first call: it says how to call ChessDrive and what to do when a call is refused. `<this Skill's folder>` is the folder this file is in, which your app gave you, so don't search for it. If what you need isn't there, read `<this Skill's folder>/../chessdrive-vectors/references/set-up.md` and walk the person through it one step at a time.
Search looks at games up to October 2025, mostly by titled and master-level players. It can't yet look only at one player's games, some years or some ratings. For an idea across the person's **own** games, use the `chessdrive-game-search` Skill instead.
If they ask what this does, or give too little, say this and wait: "Describe a kind of position, such as rook endings with White to move or a knight on the rim, and I'll find examples from master games, each with a board."
## Step 1: Write the filter
A filter is a JSON tree, true or false for each position. Each node is an object with one key.
- **Board expressions** give squares: `{"piece": "wN"}` (`w` or `b`, then `P N B R Q K`); `{"attacks": "wB"}` or `{"attacks": "white"}`, where a side's own pieces count as attacked, so it also means defended; `{"occupied": "white" | "black" | "any"}`; `{"squares": ["g8", "h7"]}`; `{"rank": 7}`; `{"file": "a"}`; `{"and": [..]}`, `{"or": [..]}`, `{"not": X}`; `{"shift": [X, "N"]}`, one step N S E W NE NW SE SW; `{"fill": [X, "N"]}`, 1 to 7 steps without X; `{"flip": X}`, colours swapped and ranks mirrored.
- **Tests** give true or false: `{"any": X}`, `{"none": X}`, `{"count": X, "gte": 3}` (or `lte`, `eq`), `{"to_move": "white"}`, `{"castling": "K"}`, `{"en_passant": true}`, `{"all": [..]}`, `{"some": [..]}`, `{"not": T}`, `{"flip": T}`.
- **The root is a test.** Squares go inside `any`, `none` or `count`: `{"piece": "wN"}` alone is refused.
- **"Either side"** is `{"some": [T, {"flip": T}]}`: write T from White's side.
- **Named parts** go in `define` and are used as `{"ref": "name"}`.
Start from `<this Skill's folder>/references/parts.json`: ready parts for a rook ending, White's passed pawns, light squares, opposite-coloured bishops, a piece on the rim and kings castled on opposite wings. Copy into `define` only the parts you use and the parts they use: `opposite_bishops` needs `light_squares`. `<this Skill's folder>/references/examples.json` has five requests worked through, from words to `where` and `define`. `<this Skill's folder>/references/position-filter.schema.json` is the full schema, if a node's exact form is in doubt.
Read their words as a chess player would. "A knight on the rim" is on the a- or h-file. "Rook ending" allows pawns and kings. "White has" means White's pieces; "either side" needs `flip`. If the words could mean two filters, take the plainer one and say which you took.
## Step 2: Run it
A call costs half a cent a position returned, at least one a call: 20 positions are 10 cents. Go ahead without asking.
- **CLI:** write the filter to `where.json` and the parts to `define.json`, then run `chessdrive search --where @where.json --define @define.json --limit 20 --json`. Leave out `--define` when there are no parts.
- **Connector:** call `search` with `where`, `define` and `limit: 20`.
The answer's `positions` each have a `fen`, `occurrences` (how many times games reached it), `quiet`, and in `examples` one game with its players, date and the `ply` it reached the position. `next_cursor`, when it isn't null, gets more: send it as `cursor` with the same `where` and `define`, only if they ask for more.
## Step 3: When it's refused
- **`invalid_filter`:** `param` names the node at fault, such as `where.all[1].ref`. Mend that node alone and send once more. If it's refused again, tell them in plain words what you tried to find, and stop.
- **`upstream_unavailable` saying the filter took too long:** narrow it once, for example with `to_move` or a piece count, say what you added, and send again.
- **Anything else:** as `calls.md` says.
## Step 4: Answer
- **None found:** say so, and offer one way to loosen it, such as either side to move.
- **Otherwise:** one line on what the filter looks for, in words. Then up to 5 positions, most played first by `occurrences`: each a link to its position on the Board, its `board_url` from the Connector or, with the CLI, the link Board links in `calls.md` builds from its `fen`, labelled with the game, as in `[Carlsen–Caruana, 2019, move 29](link)`. Its move number is `ply / 2 + 1`, rounded down. Say how many positions came back and what the call cost.
- **Never** name where the games came from, and never paste a filter's JSON unless they ask for it.
Fair play: ChessDrive is for review and prep after the game, not for help during rated play.