Agents
MCP and the command line
Control Deck gives every agent card an MCP server named ctrl-deck. Through it, an agent sees the board, starts workers, and uses the deck's tools. This page covers what Control Deck adds to each provider CLI, what agents can do through the server, and the control-deck command.
The ctrl-deck MCP server
MCP (Model Context Protocol) is the way that an agent CLI connects to tools outside itself. Control Deck has one MCP server. Every provider CLI knows it by the name ctrl-deck.
When Control Deck starts an agent, it sets up the agent's CLI so that the CLI starts the server. The CLI starts it with the Control Deck program in your install folder, Ctrl Deck.exe. The server runs without a window. It passes each request from the agent to the Control Deck app on your PC.
- The server works only for an agent that Control Deck started. Each agent gets its own access token. The app runs a request only if the token is valid.
- The agent's permission mode limits what it can do through the server. See What agents can do through the server.
- The server and the app talk on your PC only, at the address
127.0.0.1. The app refuses a request that comes from another computer.
Check the server in Settings
Open Settings > Status. The Services panel has two rows for the server.
| Row | What it is | States |
|---|---|---|
| Control Deck (built-in) | The ctrl-deck MCP server. | running, offline, or registered. The row shows registered until the app knows the state. |
| Control Deck gateway | The part of the app that answers the server's requests. | running, offline, or unknown. |
To list the providers, click the arrow at the end of the Control Deck (built-in) row. Each provider shows registered and one line of text.
| Provider | Text |
|---|---|
| Claude Code | Registered through CLI launch arguments. |
| Codex | Registered through CLI launch arguments. |
| Cursor | Registered through .cursor/mcp.json at launch. |
| Grok | Registered through .grok/config.toml at launch. |
| OpenCode | Registered through OPENCODE_CONFIG at launch. |
registered means that Control Deck adds the server each time it starts an agent on that provider. It doesn't show whether an agent is using the server now.
Check the server in a provider CLI
Each CLI has its own list of MCP servers. What the list shows depends on where the CLI runs.
| Provider | In a Control Deck card | In a session that you start yourself |
|---|---|---|
| Claude | ctrl-deck is listed. Its tools have names that start with mcp__ctrl-deck__, and all of them are approved in advance. | Not listed. |
| Codex | ctrl-deck is listed. | Not listed. |
| OpenCode | ctrl-deck is listed. | Not listed. |
| Cursor | ctrl-deck is listed and approved. | The entry is in a file in the project folder, so the CLI can list it in that folder. The server has no agent to work for there, so its tools don't work. |
| Grok | ctrl-deck is listed. | The same as Cursor. |
Messages from the server
An agent can report one of these messages when a request fails.
| Message | Meaning and what to do |
|---|---|
| Resident Control Deck gateway is unavailable. No action was taken. | The server couldn't reach the app. Nothing changed. Check that Control Deck is running, then ask the agent to try again. |
| Control Deck did not answer before the connection timed out. The call may still have run; check its result before you call it again. | The app got the request and didn't answer in time. The action can still have happened. Ask the agent to check the result before it repeats the action. |
| The call was cancelled before Control Deck answered. | The request was cancelled before the app answered. |
| CTRL_DECK_MCP_SESSION or CTRL_DECK_MCP_CONTEXT is not set. | The server was started outside Control Deck. See Connect from outside a deck. |
What Control Deck adds to each CLI
This section is about agents that run in a card. A worker that runs without a card gets the server when Control Deck starts its session.
| Provider | How Control Deck adds the server | Files it writes outside the .ctrl-deck folder |
|---|---|---|
| Claude | Options on the command that starts the card's CLI. | .claude.json, to mark the card's folder as trusted, and %UserProfile%\.claude\control-deck-ownership.json, to record that change. |
| Codex | Options on the command that starts the card's CLI. | None. |
| Cursor | A file in the project folder. | <project>\.cursor\mcp.json and <project>\.cursor\rules\ctrl-deck.mdc. |
| Grok | A file in the project folder. | <project>\.grok\config.toml and %UserProfile%\.grok\hooks\ctrl-deck-signals.json. |
| OpenCode | An environment variable for the card's CLI. | None. |
Control Deck also writes its own files for each card in the project's .ctrl-deck folder. See Files in the .ctrl-deck folder.
Claude
- Control Deck adds the server with Claude's
--mcp-configoption. Your own MCP servers still load. - It approves the server's tools in advance with
--allowedTools, so that Claude doesn't ask you about each one. - It passes the agent's context with
--append-system-prompt. See Agent memory. - It adds hooks for that one card with
--settings. The hooks tell Control Deck when you send a prompt, when a turn ends, and when Claude shows a notification. They also pass Claude's permission requests and questions to Control Deck, so that you can answer them in the Control chat. Hooks in your own Claude settings still run. - If the command for the card already has a
--settingsoption, Control Deck adds no hooks. - It marks the card's folder as trusted in Claude's
.claude.jsonfile, so that Claude doesn't ask whether you trust the folder. The file is in your home folder. For an extra Claude account, the file is in that account's folder. - Before it marks a folder as trusted in the
.claude.jsonfile in your home folder, Control Deck records the change in%UserProfile%\.claude\control-deck-ownership.json. When you uninstall, Control Deck takes back only the recorded changes. See How Control Deck cleans up.
Codex
- Control Deck passes everything with
-coptions on the command that starts the card's CLI. It doesn't change yourconfig.toml. - The options add the server as
mcp_servers.ctrl-deck, with a startup time limit of 120 seconds, and pass the agent's context as developer instructions. - The options mark the card's folder as trusted for that one Codex process, so that Codex doesn't show its folder trust screen. If you pass your own project trust setting, yours is used.
- The options set Codex's terminal notification settings for that one process. If you pass your own value for one of these settings, yours is used.
Cursor
- Control Deck writes a
ctrl-deckentry in.cursor\mcp.jsonin the project folder. It keeps your other servers and every other setting in the file. If nothing has changed, it doesn't write the file again. - The entry holds the path of
Ctrl Deck.exein your install folder and references to environment variables, such as${env:CTRL_DECK_MCP_CONTEXT}. It holds no access token and nothing that belongs to one card. - Control Deck writes the rule file
.cursor\rules\ctrl-deck.mdc. The rule always applies. It tells the agent that it runs in Control Deck and to use thectrl-deckserver. Control Deck writes this file again each time a Cursor card starts. It doesn't touch your other rules orAGENTS.md. - Before the card starts, Control Deck runs
cursor-agent mcp enable ctrl-deckin the project folder. This approves thectrl-deckserver only, so that Cursor doesn't ask you. It doesn't approve any other server. Control Deck stops the command if it takes more than 10 seconds. - An older version of Control Deck wrote a
ctrl-deckentry in.cursor\mcp.jsonin your home folder. When Control Deck starts, it removes that entry if it wrote it.
Grok
Control Deck adds a block to .grok\config.toml in the project folder. The block is between these two lines:
# >>> control-deck ctrl-deck mcp (auto-managed) >>>
# <<< control-deck ctrl-deck mcp <<<
- The block defines
[mcp_servers.ctrl-deck]with the path ofCtrl Deck.exein your install folder, a startup time limit of 120 seconds, and references to environment variables. It holds no access token. - Control Deck keeps the rest of the file. If nothing has changed, it doesn't write the file again.
- Control Deck writes
ctrl-deck-signals.jsonin the.grok\hooksfolder in your home folder. The file has hooks for 4 Grok events:UserPromptSubmit,Stop,StopFailure, andNotification. The hooks tell Control Deck when a turn starts, when it ends, and when Grok shows a notification. - The hooks need environment variables that are set only in a Control Deck card. The file holds no access token.
- If
ctrl-deck-signals.jsonalready exists and Control Deck didn't write it, Control Deck leaves it alone. - Control Deck passes the agent's context with Grok's
--rulesoption.
OpenCode
- Control Deck passes the server in the
OPENCODE_CONFIG_CONTENTenvironment variable of the card's CLI. It writes nothing to your OpenCode config files. - The value adds the
ctrl-deckserver, adds the agent's context file toinstructions, and setsautoupdatetofalse. - If you already set
OPENCODE_CONFIG_CONTENT, Control Deck keeps your settings and adds its own. - An older version of Control Deck wrote OpenCode config files in the
.ctrl-deckfolder. Control Deck deletes those files.
In Settings > Status, the OpenCode row names OPENCODE_CONFIG. The variable that Control Deck sets is OPENCODE_CONFIG_CONTENT.
Environment variables in a card
The CLI in an agent card, and every command that the agent runs, gets these variables, including the ones in this table.
| Variable | Value |
|---|---|
CTRL_DECK | 1 |
CTRL_DECK_TERMINAL | 1 |
CTRL_DECK_MCP_SERVER_NAME | ctrl-deck |
CTRL_DECK_GATEWAY_URL | The address of the app on your PC, for example http://127.0.0.1:17321. |
CTRL_DECK_GATEWAY_TOKEN | The card's access token. Treat it like a password. |
A script can test CTRL_DECK to find out whether it runs inside Control Deck.
These files and Git
The Cursor and Grok files are in your project folder, so Git sees them.
- They hold no access token.
- They hold the full path of
Ctrl Deck.exein your install folder. In the default install folder, that path includes your Windows user name. - If you don't want them in the repository, add them to your
.gitignore. Control Deck writes them again when a Cursor or Grok card starts.
Files in the .ctrl-deck folder
For each agent card, Control Deck writes a few files in the .ctrl-deck folder inside the project folder. Most names start with terminal- and end with the card's id.
- The files hold the agent's context and the settings that the card's CLI needs to start the server. For Claude, they also hold the hook settings.
- Some of these files hold the card's access token. Don't share them.
- Control Deck writes a
.gitignorefile in.ctrl-deckthat keeps these files out of Git. - Each time a card starts, Control Deck deletes per-card files that haven't changed for 14 days.
The same folder holds the deck memory. See Agent memory.
If Control Deck can't add the server
Control Deck doesn't overwrite a ctrl-deck entry that it didn't write. It doesn't rewrite a config file that it can't read. In both cases it leaves your file unchanged and reports the problem.
| Card | What happens |
|---|---|
| A card that you open | The card starts without Control Deck tools. A red line in the card's terminal starts with [Control Deck]. It shows the message and then: This interactive card opened without Control Deck tools; resolve that file conflict and restart the card to restore them. |
| A card that Control Deck starts with a task | The card doesn't start. The error shows the message and then: The task was not sent and user-owned provider configuration was left unchanged. |
The message names the provider, the reason, and the file. For example:
Control Deck could not register its tools for cursor-agent-cli (config conflict user owned server) at C:\code\my-app\.cursor\mcp.json.
The provider is written as cursor-agent-cli, grok-cli, or opencode-cli.
Reasons
| Reason in the message | Provider | Meaning and what to do |
|---|---|---|
| config conflict user owned server | Cursor, Grok | The file already has a ctrl-deck server that Control Deck didn't write. Rename or remove your entry, then restart the card. |
| registration failed | Cursor | Control Deck couldn't read or write .cursor\mcp.json. One cause is a file that isn't valid JSON. The detail is in the Control Deck log. Fix the file, then restart the card. |
| scoped enable failed | Cursor | The cursor-agent mcp enable ctrl-deck command failed or took more than 10 seconds. Run the command in a terminal in the project folder to see why. |
| scoped enable provider command missing | Cursor | Control Deck has no Cursor command to run. Check the Cursor command in Sign in to provider CLIs. |
| config conflict malformed markers | Grok | One of the two marker lines in .grok\config.toml is missing, or they're in the wrong order. Remove what is left of the block, then restart the card. |
| config conflict config unavailable | Grok | Control Deck can't read .grok\config.toml. |
| config write failed | Grok | Control Deck couldn't write .grok\config.toml. One cause is a .grok folder that is a link to another place. |
| completion bridge hooks unavailable | Grok | Control Deck couldn't write ctrl-deck-signals.json, or a file with that name exists that Control Deck didn't write. |
| disk config conflict user owned server | OpenCode | One of your OpenCode config files has its own ctrl-deck server. Rename or remove it. |
| disk config conflict invalid config | OpenCode | Control Deck can't read one of your OpenCode config files as valid. Fix the file that the message names. |
| disk config conflict config unavailable | OpenCode | An OpenCode config path isn't a normal file that Control Deck can read. |
| disk config conflict managed autoupdate override | OpenCode | A managed OpenCode config turns automatic updates on. Control Deck needs them off for its cards. |
| disk config conflict managed server override | OpenCode | A managed OpenCode config defines a ctrl-deck server. |
| inline config conflict | OpenCode | The OPENCODE_CONFIG_CONTENT value that you set isn't valid. Control Deck doesn't replace it. |
OpenCode files that Control Deck checks
Control Deck reads these files and doesn't change them:
opencode.jsonandopencode.jsoncin%UserProfile%\.config\opencode.- The file that the
OPENCODE_CONFIGvariable names. opencode.json,opencode.jsonc,.opencode\opencode.json, and.opencode\opencode.jsoncin the project folder and in the folders above it.opencode.jsonandopencode.jsoncin the folder that theOPENCODE_CONFIG_DIRvariable names.- The managed files
opencode.jsonandopencode.jsoncin%ProgramData%\opencode.
How Control Deck cleans up
Control Deck keeps a list of the project folders where it wrote Cursor or Grok files. The list is in %AppData%\Ctrl Deck\port\provider_integrations.json.
When Control Deck starts
- It repairs the Cursor and Grok entries that it wrote in the project folders of your decks. This keeps the path of
Ctrl Deck.execorrect. It adds no entry where there was none. - It removes entries and files that older versions wrote and that this version doesn't use.
When you uninstall
The uninstaller removes these things, for the listed project folders and the project folders of your decks:
- The
ctrl-deckentry in.cursor\mcp.json. - The old
ctrl-deckentry in.cursor\mcp.jsonin your home folder. - The rule file
.cursor\rules\ctrl-deck.mdc, if it's unchanged. - The marked block in
.grok\config.toml. ctrl-deck-signals.jsonin.grok\hooksin your home folder.- The folder trust entries that Control Deck recorded in
control-deck-ownership.json, from the.claude.jsonfile in your home folder. A trust entry that Control Deck made goes back to how it was before. Then the uninstaller deletescontrol-deck-ownership.json. This works even if you deleted the Control Deck data folder first. - The
control-deckcommand and its entry in your PATH.
Control Deck removes only what it can show that it wrote. An entry or file that you changed stays. If a file is locked, the uninstall still finishes, and that file stays.
The uninstaller doesn't remove the .ctrl-deck folders in your projects or your data folder. It also leaves these Claude trust entries: the ones that you gave, the ones that an older version of Control Deck added before it kept a record, and the ones in the folders of extra Claude accounts. See Uninstall.
Remove the entries yourself
Close the Cursor and Grok cards for the project.
In
.cursor\mcp.json, delete thectrl-deckentry undermcpServers. Delete.cursor\rules\ctrl-deck.mdc.In
.grok\config.toml, delete the two marker lines and everything between them.
Control Deck writes the entries again the next time a Cursor or Grok card starts in that project.
What agents can do through the server
This is what an agent can do through the ctrl-deck server. The agent decides when to use each of these. You ask in plain words, for example Open the site in the Preview card.
| Area | What an agent can do |
|---|---|
| Decks | List your decks, switch to another deck, and create a deck. |
| Pages | List, create, and rename the pages of a deck. A deck has up to 6 pages. |
| The board | Read what is on the board: the cards, and the state of every agent. |
| Cards | Open agent cards, rename an agent, close cards, and arrange the cards the way the layout menu does. |
| Preview card | Set the address. List, open, switch, close, and pin tabs. Operate the page: go to an address, wait, take a screenshot, click, and press keys. |
| Markdown card | Open, read, write, add to, rename, focus, close, and export a document, and switch between preview and edit mode. |
| Memory and skills | Read and change deck memory and global memory, replace the persona file, and read, save, and archive skills. See Agent memory. |
| Deck history | Search the records of past work on the deck. |
| Other agents | Send an instruction to another agent on the deck. |
| Development servers | Start, stop, restart, and list local development servers, and read their output. |
| You | Ask you a question, or show you something, in the Control chat. See The Control chat. |
| Turn summary | Report a short summary of what it did when a turn ends. |
| Worker routing and accounts | Read the worker routing settings and your saved Claude and Codex accounts, and switch the Claude or Codex account that new cards and workers use. |
An agent can operate a Preview page on your PC without a question. For a page on another address, you must turn on Agent control in that tab first. See Tool cards.
Commanders
Commanders are orchestrators. Only a commander can do these things:
- Start 1 to 24 workers in one batch, wait for them, and read their results. See Commanders and workers.
- Ask which provider and model Control Deck would pick for a task. See Worker routing.
- Read a worker's changes, merge them, resolve or drop a merge conflict, and change the Merge worker changes setting. See Merging worker changes.
- Set the worker setup command for the deck.
A worker can report its result to its commander.
Limits from the permission mode
The Control Deck tool grants setting in Settings > Workspace sets the permission mode. The default, Autonomous, lets an agent do everything in this section.
The other options remove some of these actions. With the read-only option, an agent can read decks, the board, memory, and skills, report its results, and ask you questions. It can't change anything through the server. The server doesn't offer an agent the actions that its mode doesn't allow.
The setting limits Control Deck tools only. It doesn't restrict the provider CLI.
See Permissions and approvals for every option.
Connect from outside a deck
An agent or tool that Control Deck didn't start can't use the ctrl-deck MCP server. The server needs the context and the access token of a Control Deck agent. Without them, it stops with CTRL_DECK_MCP_SESSION or CTRL_DECK_MCP_CONTEXT is not set.
Control Deck has no MCP connection over HTTP.
What works from outside
A script, or an agent in any terminal on your PC, can use the control-deck command:
- Send a message to Control and get the reply. Control sits over every orchestrator, across all your decks, so this is the way in for an outside tool.
- Approve or deny a permission prompt.
See Talk to Control and answer prompts.
The address of the app
The app listens on 127.0.0.1, port 17321. If that port is in use, it tries the next 10 ports, and then any free port. It accepts connections from your PC only.
To use a fixed port, set the CTRL_DECK_GATEWAY_PORT environment variable before you start Control Deck. With a fixed port, Control Deck doesn't try other ports. If the port is in use, agents get no Control Deck tools.
Terminals that Control Deck starts have the address in CTRL_DECK_GATEWAY_URL.
The control-deck command
The installer can add a command-line program, control-deck.exe. You can use it to send a message to Control and to answer a permission prompt.
Where it is
- The installer adds the program only if control-deck command in terminals is selected on its Choose Components screen. It's selected by default. See The installer's screens.
- The program is
bin\control-deck.exein the install folder. In the default install folder, that is%LOCALAPPDATA%\Programs\Control Deck\bin\control-deck.exe. - The installer adds that
binfolder to the PATH of your Windows user. In a new terminal, you typecontrol-deck. - Each update installs the new version of the program.
- Uninstalling removes the program and the PATH entry.
A terminal that was open before you installed Control Deck doesn't have the new PATH. Open a new terminal.
If the installer can't add the program, the installing screen shows control-deck command: failed and stays open until you go on.
Output
The control, approve, and deny commands print one JSON object. For example, control-deck approve with a valid id prints:
{
"ok": true,
"command": "approve",
"status": "completed",
"message": "Approved Alpha's prompt: Run npm test"
}
| Field | Meaning |
|---|---|
ok | true if the command succeeded. The exit code is 0 when ok is true, and 1 when it isn't. |
command | The command that ran. |
status | A short word for the result, for example completed, failed, or not_running. |
message | A sentence for you, when there is one. |
An unknown command
The program has no help command. With no command, or with a command it doesn't know, it prints the status unknown_command and this message:
Unknown command. Commands: agent, control, approve, deny.
ok is false and the exit code is 1. With no command, command is null.
If the program stops on an error that it didn't expect, it prints a JSON object on the error output. The object has command as control-deck, status as failed, and the error text in error. The exit code is 1.
How a command finds the app
Control Deck must be running. The control, approve, and deny commands work in any terminal of your Windows user. Each time Control Deck starts, it saves its address and a new token in Windows Credential Manager, and the commands read them there. Control Deck removes the token when it quits.
If Control Deck isn't running, the commands print the status not_running and the message Control Deck isn't running. Start it, then try again.
Talk to Control and answer prompts
control-deck control
control-deck control "What are my commanders working on?"
Sends a message to Control and prints the reply. The message and the reply also appear in the Control chat. Everything after control is the message.
| Result | Output |
|---|---|
| Control answered. | status is completed. reply holds Control's answer. |
| No message. | Usage: control-deck control "<message>" |
| Control isn't running. | status is failed. The message is Control isn't running. |
| Control Deck isn't running. | status is not_running. The message is Control Deck isn't running. Start it, then try again. or Couldn't reach Control Deck at followed by the address and the error. |
| Control has no model. | status is not-configured. The message is Pick a model for Control in Settings first. See The Control chat. |
| Control couldn't answer. | The message is the reason, or Control could not answer. |
| The token doesn't match. | Messages to Control need the token Control Deck stores in the system credential store. Run the command again. |
| Windows Credential Manager can't be read. | status is credential_store_unavailable. |
control-deck approve and control-deck deny
control-deck approve <prompt id>
control-deck deny <prompt id>
Answers one permission prompt that waits for you in the Control chat. The first answer wins, the same as when you answer in the app. See Permissions and approvals.
<prompt id> is the id that Control Deck gives the prompt. Control Deck saves the Control chat, with the id of each prompt, in %AppData%\Ctrl Deck\control-thread.json.
| Result | Output |
|---|---|
| The prompt was answered. | status is completed. The message is Approved or Denied, the agent's name, and the action, for example Approved Alpha's prompt: Run npm test. |
| No id, or more than one. | Usage: control-deck approve <prompt id> |
| No prompt has that id. | No prompt has id (id). |
| The id belongs to something else, for example a question. | (id) isn't a permission prompt. |
| The prompt already has an answer. | (id) was already answered. |
If Control Deck isn't running, these commands print the same messages as control-deck control.