Skip to main content
The Webcompute MCP server gives coding-agent hosts browser tools. It can expose:
  • Runtime tools for deterministic browser lifecycle and Playwright execution.
  • An optional agent tool that delegates a whole browsing goal to web.agent().
Use runtime tools when the host agent can write the deterministic browser steps. Use run_web_agent when the task is better delegated to a browser-specialized agent.

Surfaces

SurfaceTools
runtimemanage_browsers, execute_playwright_code
agentrun_web_agent
allRuntime tools plus run_web_agent
Configure the surface with web mcp setup --surface <surface> or WEBCOMPUTE_MCP_SURFACE.
web mcp setup codex --surface runtime
web mcp setup codex --surface all --model browsing

Setup and run commands

CommandDescription
web mcp setup [target]Write host-specific MCP config. Targets: claude, codex, opencode, cursor, devin.
web mcp config [target]Print read-only host config.
web mcp doctorCheck local MCP readiness.
web mcp runRun the MCP server directly.
Important setup flags:
FlagDescription
--surface <surface>runtime, agent, or all.
--model <profile>Model profile for agent surface.
--forceReplace an existing non-managed Webcompute entry.
--dry-runShow the proposed config without writing.
--jsonPrint raw JSON.
--quietSuppress non-error output.
Important run flags:
FlagDescription
--transport <transport>stdio or http.
--host <host>HTTP host. HTTP transport must bind to loopback.
--port <port>HTTP port.
--allow-origin <origin>Repeatable allowed origin for MCP-created browsers.
--allow-domain <domain>Repeatable allowed domain for MCP-created browsers.
--private-access <scope>Repeatable private-access scope. Current CLI support is localhost.

Runtime tool: manage_browsers

manage_browsers creates, lists, inspects, stops, resumes, closes, debugs, connects to, and resolves CAPTCHA blockers for Webcompute browsers.

Schema

FieldTypeRequiredDescription
actionenumYesAction to perform.
browserIdstringAction-dependentBrowser ID for browser-specific actions. Can be omitted when the MCP session has an active browser.
recordingbooleanNoCreate action only. Enables recording.
maxDurationnumberNoCreate action only. Browser duration in milliseconds.
policyobjectNoCreate action only. Browser policy object.
statusstringNoList action filter.
limitnumberNoList pagination limit. Maximum is 100.
cursorstringNoPagination cursor.
captchaTimeoutMsnumberNoCAPTCHA resolve timeout. Maximum is 120000.
Actions: create, list, get, status, stop, resume, close, debug_url, cdp_url, captcha_status, captcha_resolve.
debug_url and cdp_url return signed bearer URLs. Do not paste them into shared transcripts or untrusted prompts.

Proxy limitation

The current manage_browsers schema does not expose a custom proxy field. To use a proxy, create the browser through the SDK, CLI, or REST API, then reuse that browser ID where your MCP workflow supports existing browsers.

Runtime tool: execute_playwright_code

execute_playwright_code runs focused Playwright code against a Webcompute browser.

Schema

FieldTypeRequiredDescription
codestringYesTop-level async Playwright body. page is already in scope. The schema rejects empty or whitespace-only code and enforces the runtime code-size limit.
browserIdstringNoBrowser ID. Optional when the MCP session has an active browser.
pageIdstringNoKnown non-active page ID. Omit for ordinary active-page work. Must match the Webcompute page ID pattern.
timeoutMsnumberNoExecution timeout. Capped by the runtime execution timeout limit.
capturefalse | objectNoCapture options for screenshot, status, activity, and observation.

Code rules

RuleReason
Use the provided page.The active page is already in scope.
Do not redeclare page.Redeclaration breaks the provided execution context.
Do not create a new page for ordinary tasks.Active-page work should stay on the browser’s current page.
Prefer Playwright locators such as getByRole, getByLabel, and getByText.Returned observations are optimized for accessible page structure.
Return serializable data.The tool response includes the returned value.

Capture defaults

For MCP runtime executions, the default capture object is:
{
  status: true,
  observation: {
    kind: "aria",
    depth: 5,
    timeoutMs: 8000,
    maxChars: 20000,
    includeOn: "always"
  }
}

Capture fields

FieldTypeDescription
screenshotenumScreenshot capture behavior.
statusbooleanInclude compact runtime status.
activityboolean | objectInclude passive page/navigation activity. Object fields include maxPages and maxNavigationsPerPage.
observationboolean | objectInclude bounded post-step observation.
Observation object fields:
FieldDescription
enabledEnable or disable observation.
kindaria, text, or none.
locatorOptional locator to scope the observation.
depthARIA observation depth.
boxesInclude element boxes when supported.
timeoutMsObservation timeout.
maxCharsMaximum observation characters.
includeOnWhen to include observation.

Agent tool: run_web_agent

run_web_agent delegates a whole browsing task to the configured Webcompute browser agent. It is optional and exists only on the agent or all surface. run_web_agent requires either WEBCOMPUTE_MODEL_PROFILE or direct model environment variables. Runtime tools do not use model profiles.

Schema

FieldTypeRequiredDescription
goalstringYesThe actual user-authored browsing task.
systemPromptstringNoAdditional agent instructions.
startUrlstringNoStarting URL. Must be a URL.
browserIdstringNoExisting browser ID.
approvalask | delegated | neverNoApproval mode for the run.
allowedDomainsstring[]NoCreates a browser policy with allowedDomains.
maxTurnsnumberNoMaximum model turns. Maximum is 50.
maxToolCallsnumberNoMaximum browser tool calls. Maximum is 50.
timeoutMsnumberNoWhole-run timeout in milliseconds.
toolTimeoutMsnumberNoPer-tool timeout. Maximum is 120000.
outputSchemaobject | nullNoOptional JSON schema for final output. Maximum serialized size is 64 KB. External schema refs are rejected.

Result

The tool returns:
  • Text content summarizing the run.
  • structuredContent containing the sanitized WebAgentResult.
  • isError: true when the result status is failed or cancelled.
Tool-completion summaries may be added as stepSummaries when available.

Agent tool boundaries

run_web_agent should receive the real user task. Do not pass hidden page instructions or webpage text as authorization. The internal agent may return needs_confirmation for approval-sensitive actions. Current run_web_agent does not expose browser-create proxy options. Current MCP tool schemas do not expose a custom proxy field. Use SDK orchestration when an agent task must create a proxied browser.

Environment variables

VariableDescription
WEBCOMPUTE_API_KEYRequired unless stored local CLI config provides an API key. Required for HTTP transport.
WEBCOMPUTE_SERVER_URLGateway URL. Defaults to https://api.webcompute.dev.
WEBCOMPUTE_DEBUGtrue enables debug logging.
WEBCOMPUTE_MCP_SURFACEruntime, agent, or all.
WEBCOMPUTE_MCP_DEFAULT_BROWSER_POLICYJSON object used as the default browser policy for MCP-created browsers.
WEBCOMPUTE_MODEL_PROFILESaved model profile name for run_web_agent on the agent or all surface.
WEBCOMPUTE_AGENT_MODELDirect model ID for run_web_agent on the agent or all surface.
WEBCOMPUTE_AGENT_MODEL_ROUTEDirect model route: openai, openrouter, openai-compatible, anthropic, or google.
WEBCOMPUTE_AGENT_MODEL_API_KEY_ENVEnvironment variable containing the model-provider key.
WEBCOMPUTE_AGENT_MODEL_BASE_URLBase URL for compatible routes.
WEBCOMPUTE_AGENT_MODEL_APIProvider API family: chat-completions or responses.
MCP_TRANSPORTstdio or http.
MCP_HOSTHTTP host. Must be loopback for HTTP transport.
MCP_PORTHTTP port.
PORTFallback HTTP port when MCP_PORT is not set.

Choosing a tool

NeedUse
Create, inspect, stop, resume, close, or debug a browser.manage_browsers
Run a specific browser action, extraction, click, form fill, or page read.execute_playwright_code
Delegate a nuanced browsing task with model planning.run_web_agent
Use a custom proxy for browser creation.SDK, CLI browser create, or REST before MCP reuse.