# MCP

> Let AI tools such as Claude Desktop, Cursor, Codex and OpenCode use your Deck clipboard history.

MCP (Model Context Protocol) lets AI tools call programs on your Mac. Deck provides an MCP server through `deckclip`, so a client can read, search and write your clipboard history and run script plugins.

## Set up

1. Install `deckclip` and turn on **Settings › Deck CLI › Enable Deck CLI**. See [The deckclip command line](https://deckclip.app/docs/automation/cli).
2. Run `deckclip mcp` in a terminal. It finds the supported apps you have installed and lets you choose which to configure.
3. Restart the AI tool.

To preview or write the configuration for one client yourself:

```sh
deckclip mcp setup --client cursor
deckclip mcp setup --client cursor --write
```

Without `--write`, the command only prints the configuration. With `--write`, it adds Deck to the client's file and keeps a backup of the old file. `--client` defaults to `all`. `--path <file>` changes the file, for one client at a time, and `--command <cmd>` changes how the client launches `deckclip`.

| Client | `--client` | Configuration file |
|---|---|---|
| Claude Desktop | `claude-desktop` | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| Cursor | `cursor` | `~/.cursor/mcp.json` |
| Codex | `codex` | `~/.codex/config.toml` |
| OpenCode | `opencode` | `~/.config/opencode/opencode.json` |

Claude Desktop and Cursor receive this entry:

```json
{
  "mcpServers": {
    "deck": {
      "command": "deckclip",
      "args": ["mcp", "serve"]
    }
  }
}
```

Codex receives:

```toml
[mcp_servers.deck]
command = "deckclip"
args = ["mcp", "serve"]
```

OpenCode receives an entry named `deck` under `mcp` with `"type": "local"` and the command `deckclip mcp serve`.

## Tools

| Tool | What it does | Changes data |
|---|---|---|
| `deck_health_status` | Checks that Deck is reachable. | No |
| `deck_read_latest_clipboard` | Reads the latest item. | No |
| `deck_list_clipboard_items` | Lists recent items (`limit`, default 20). | No |
| `deck_search_clipboard_items` | Searches history and returns items (`query`, `mode`, `limit`). | No |
| `deck_search_clipboard_history` | Searches history with AI (`query`, `mode`, `limit`). | No |
| `deck_transform_clipboard_text` | Transforms text with AI (`prompt`, `text`, `plugin`). Uses the latest item if `text` is empty. | No |
| `deck_list_script_plugins` | Lists installed script plugins (`query`, `limit`). | No |
| `deck_read_script_plugin` | Reads a plugin's manifest and main file (`plugin_id`). | No |
| `deck_write_clipboard_text` | Adds text to history (`text`, `tag`, `tag_id`, `raw`). | Yes |
| `deck_run_script_transform` | Runs a script plugin on text (`plugin_id`, `input`). | Runs code |

The AI tools use the provider you set up in Deck.

## Check and clean up

```sh
deckclip mcp tools
deckclip mcp doctor
deckclip mcp cleanup --dry-run
```

- `tools` lists the tools and their parameters.
- `doctor` checks that Deck is reachable and shows the status of each client's configuration.
- `cleanup` stops `deckclip mcp serve` processes that have been running longer than `--idle-hours` (default 2). Use `--dry-run` to list them without stopping them.

## Permissions

An MCP client gets the same access as the `deckclip` command line, with no extra approval prompt for each call. Because of that:

- Deck must be running and **Enable Deck CLI** must be on.
- When security mode is on, reading history asks you to authenticate.
- Writing fails while recording is paused.
- `deck_run_script_transform` refuses plugins that need network access you have not authorized.

The MCP tools cannot delete items or create, change or delete plugins and rules. Only Deck's own AI chat can, and it asks you first. See [AI assistant](https://deckclip.app/docs/automation/ai-assistant).

> [!IMPORTANT]
> Anything an AI tool reads from your history goes to that tool's provider. Turn MCP on only for clients you trust.

- Previous: [The deckclip command line](https://deckclip.app/docs/automation/cli.md)
- Next: [AI assistant](https://deckclip.app/docs/automation/ai-assistant.md)

---

- HTML: https://deckclip.app/docs/automation/mcp
- 中文: https://deckclip.app/zh-cn/docs/automation/mcp.md

© 2026 Yuze Pan
