Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(cua-driver): mcp-config --client flag for client-specific install commands

Francesco Bonaccife42309b66c9
diff --git a/libs/cua-driver/Sources/CuaDriverCLI/CuaDriverCommand.swift b/libs/cua-driver/Sources/CuaDriverCLI/CuaDriverCommand.swift
index bed1e59cde..885ffa8233 100644
--- a/libs/cua-driver/Sources/CuaDriverCLI/CuaDriverCommand.swift
+++ b/libs/cua-driver/Sources/CuaDriverCLI/CuaDriverCommand.swift
@@ -35,26 +35,53 @@ struct CuaDriverCommand: AsyncParsableCommand {
struct MCPConfigCommand: ParsableCommand {
static let configuration = CommandConfiguration(
commandName: "mcp-config",
- abstract: "Print an MCP client config snippet pointing at this binary."
+ abstract: "Print MCP server config or a client-specific install command."
)
+ @Option(name: .customLong("client"),
+ help: "Client to print the install command for: claude | codex | cursor. Omit for the generic JSON snippet.")
+ var client: String?
+
func run() throws {
- // Resolve the binary path. Prefer the running executable's
- // path so the snippet references the bundled binary in
- // `/Applications/CuaDriver.app/...` even when `cua-driver`
- // itself was invoked via a `/usr/local/bin/` symlink.
let binary = resolvedBinaryPath()
- let snippet = """
- {
- "mcpServers": {
- "cua-driver": {
- "command": "\(binary)",
- "args": ["mcp"]
+ switch client?.lowercased() {
+ case nil, "":
+ let snippet = """
+ {
+ "mcpServers": {
+ "cua-driver": {
+ "command": "\(binary)",
+ "args": ["mcp"]
+ }
+ }
+ }
+ """
+ print(snippet)
+ case "claude":
+ print("claude mcp add --transport stdio cua-driver -- \(binary) mcp")
+ case "codex":
+ print("codex mcp add cua-driver -- \(binary) mcp")
+ case "cursor":
+ // Cursor has no CLI — emit JSON the user pastes into
+ // ~/.cursor/mcp.json (global) or .cursor/mcp.json (project).
+ let snippet = """
+ {
+ "mcpServers": {
+ "cua-driver": {
+ "command": "\(binary)",
+ "args": ["mcp"],
+ "type": "stdio"
+ }
+ }
}
- }
+ """
+ print(snippet)
+ default:
+ FileHandle.standardError.write(Data(
+ "Unknown client '\(client!)'. Valid: claude, codex, cursor.\n".utf8
+ ))
+ throw ExitCode(2)
}
- """
- print(snippet)
}
private func resolvedBinaryPath() -> String {
diff --git a/libs/cua-driver/scripts/install.sh b/libs/cua-driver/scripts/install.sh
index f1b7fff10b..9f94f0b89b 100755
--- a/libs/cua-driver/scripts/install.sh
+++ b/libs/cua-driver/scripts/install.sh
@@ -171,9 +171,19 @@ Next steps:
cua-driver list_apps
cua-driver --help
- B. As an MCP server for Claude Code / Cursor / other MCP clients:
- cua-driver mcp-config | pbcopy
- Paste into ~/.claude/mcp.json (or your client's equivalent).
+ B. As an MCP server — run the one matching your client:
+
+ • Claude Code:
+ claude mcp add --transport stdio cua-driver -- /usr/local/bin/cua-driver mcp
+
+ • Codex (OpenAI):
+ codex mcp add cua-driver -- /usr/local/bin/cua-driver mcp
+
+ • Cursor / other clients (paste JSON into the client's mcp config):
+ cua-driver mcp-config --client cursor
+
+ For other clients accepting the generic shape:
+ cua-driver mcp-config
Docs: https://github.com/trycua/cua/tree/main/libs/cua-driver
FINALEOF