MCP Setup
Connect CUP to AI agents like Claude Code, Cursor, and Codex via the Model Context Protocol.
What is MCP?
The Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools. CUP ships with a built-in MCP server that exposes 9 tools for UI perception and interaction.
Start the server
cup-mcp
# or
python -m cup.mcpnpx cup-mcpConfigure your agent
Add CUP to your agent's MCP configuration file (.mcp.json, mcp_config.json, etc.):
{
"mcpServers": {
"cup": {
"command": "cup-mcp",
"args": []
}
}
}{
"mcpServers": {
"cup": {
"command": "npx",
"args": ["cup-mcp"]
}
}
}Compatible agents
CUP's MCP server works with any MCP-compatible agent:
| Agent | Configuration file |
|---|---|
| Claude Code | .mcp.json in project root |
| Cursor | Settings > MCP Servers |
| Codex | MCP configuration |
| Custom agents | Any MCP client implementation |
CUP automatically detects your operating system and loads the appropriate platform adapter. No additional configuration is needed.
Advanced configuration
Web platform (CDP)
To capture Chrome/Chromium pages, see Web platform setup for launching Chrome with remote debugging, then configure the MCP server:
{
"mcpServers": {
"cup": {
"command": "cup-mcp",
"args": ["--platform", "web", "--cdp-port", "9222"]
}
}
}Verbose mode
For debugging, enable verbose output:
{
"mcpServers": {
"cup": {
"command": "cup-mcp",
"args": ["--verbose"]
}
}
}Best practices
Minimize token usage
- Use
find()to locate elements instead of repeatedly callingsnapshot() - Use
overview()(instant) to discover apps beforesnapshot_app() - Use
screenshot()only when you need visual context the tree doesn't capture
Workflow
For the typical agent workflow (snapshot → find → action → verify), see the Quick Start.