Skip to content

Commit d461e4f

Browse files
brettchienthepagent
authored andcommitted
docs(cursor): add MCP usage and --workspace / approval quirks
Document how MCP servers are configured in cursor-agent ACP mode: - The `--workspace` flag determines which `.cursor/mcp.json` is loaded and which approvals slug is used — explicit is safer than relying on cwd auto-detection. - `--approve-mcps` does NOT apply in ACP mode (interactive CLI only); MCP load gating uses an approval file at .cursor/projects/<slug>/mcp-approvals.json. - Two paths to approve: pre-create the file, or approve once interactively so Cursor persists it. - openab auto-replies session/request_permission with allow_always, so once loaded, subsequent tool calls pass without prompting. - Verify with `cursor-agent mcp list`. Part of PR #301 polish.
1 parent 4c35ff2 commit d461e4f

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

docs/cursor.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,60 @@ In ACP mode, `--model` can be appended after `acp`. If omitted, the account defa
9595

9696
To verify which model is active, ask the agent "who are you" — the underlying model will typically self-identify (e.g. "I am Gemini, a large language model built by Google.").
9797

98+
## MCP Usage (ACP mode caveats)
99+
100+
Cursor Agent CLI supports MCP servers configured via `.cursor/mcp.json` in the active workspace directory. **Which directory counts as the workspace is determined by the `--workspace` flag** — if omitted, cursor-agent auto-detects from `cwd`, which is usually `/home/agent` in OpenAB containers via the Dockerfile `WORKDIR` directive but can drift in interactive or local runs. For reproducible MCP loading, pass `--workspace` explicitly:
101+
102+
```toml
103+
[agent]
104+
command = "cursor-agent"
105+
args = ["acp", "--model", "auto", "--workspace", "/home/agent"]
106+
```
107+
108+
This anchors:
109+
- **MCP config lookup**: `/home/agent/.cursor/mcp.json`
110+
- **Approval file path**: `/home/agent/.cursor/projects/home-agent/mcp-approvals.json` (slug = URL-safe workspace path)
111+
112+
Without `--workspace`, a different cwd would produce a different slug and cursor-agent would not find previously saved approvals.
113+
114+
### Example MCP config
115+
116+
```json
117+
{
118+
"mcpServers": {
119+
"playwright": {
120+
"command": "/usr/bin/npx",
121+
"args": ["-y", "@playwright/mcp@latest"]
122+
}
123+
}
124+
}
125+
```
126+
127+
### Approval quirk in ACP mode
128+
129+
Cursor's `--approve-mcps` flag **does not apply in ACP mode** — it only affects the interactive CLI. In ACP mode, MCP servers are gated by an approval file. Two options:
130+
131+
1. **Pre-create the approvals file** at `<workspace>/.cursor/projects/<slug>/mcp-approvals.json`:
132+
```json
133+
["<server-name>-<sha256_hash>"]
134+
```
135+
Hash is derived from workspace path + server config.
136+
137+
2. **Approve once interactively**, then let Cursor persist the approval:
138+
```bash
139+
kubectl exec -it deployment/openab-cursor -- cursor-agent
140+
# invoke an MCP tool, approve the prompt; approval is saved
141+
```
142+
143+
OpenAB itself auto-responds to ACP `session/request_permission` with `allow_always` (see `src/acp/connection.rs`), so once an MCP server is *loaded*, subsequent tool calls pass without prompting. The approval file only gates the initial load.
144+
145+
### Verifying MCP is loaded
146+
147+
```bash
148+
kubectl exec deployment/openab-cursor -- cursor-agent mcp list
149+
# Expected: "<server-name>: ready"
150+
```
151+
98152
## Known Limitations
99153

100154
- Cursor Agent CLI is a separate distribution from Cursor Desktop — they are not the same binary

0 commit comments

Comments
 (0)