// DOCUMENTATION

MCP tools

Model Context Protocol integration for AI agents in Cursor and other MCP hosts.

Protocols

Koko implements MCP (Model Context Protocol) so AI agents can browse, extract, and act on pages through standardized tools — without writing custom CDP scripts for every workflow.

Launch MCP server

zig-out/bin/koko mcp --browser-profile chrome-macos-catalina

Cursor and other MCP hosts connect to the Koko MCP server and receive tools for navigation, extraction, and interaction.

Tool semantics

MCP tools mirror the SDK agent workflow ordering:

  1. Navigate with waitUntil: "done" (default)
  2. LP.getSemanticTree — pruned accessibility DOM for LLMs
  3. LP.detectForms — form schema with backendNodeId
  4. LP.fillNode / LP.clickNode — stable backend-node actions
  5. LP.getMarkdown — token-efficient page text

SDK parity

The SDK example sdk/examples/agent-semantic.mjs runs the same agent loop without Cursor — useful for CI smoke tests. Cursor users should prefer koko mcp for daily agent work.

When to use MCP vs SDK

Use MCP whenUse SDK when
AI agent in Cursor/IDEProgrammatic test suites
Exploratory browsingCI pipelines and benchmarks
No TypeScript projectCustom orchestration logic

Implementation

MCP server code lives in src/protocols/mcp/ — router, tools, resources, and protocol handlers.