For the complete documentation index, see llms.txt. This page is also available as Markdown.

Model Context Protocol (MCP)

Use Oxylabs MCP to give AI assistants live web scraping, search, and extraction tools via Oxylabs products.

Model Context Protocol (MCP) is an open standard for connecting AI assistants to external tools and data. With Oxylabs MCP integrations, assistants such as Claude and Cursor can access live web data – scrape pages, search the web, crawl sites, and control remote browsers.

Oxylabs offers MCP integrations for two products:

Product
MCP server
Setup

oxylabs-web-api-mcp

Remote (hosted by Oxylabs) or self-hosted (run by you)

hb-mcp

Self-hosted

Note: Each product has its own MCP server and credentials. Set up only the ones you need – they can also be combined.

Web API

Connect Web API to your AI agent to search the web, scrape pages in the format of your choice, extract fields as JSON, and call dedicated scrapers – all through one MCP connection. You can find all details in the Web API MCP GitHub repository.

You can connect in two ways:

  • Remote MCP – connect to the server hosted and maintained by Oxylabs. There is nothing to install or update.

  • Self-hosted MCP – deploy and manage the server in your own environment for more control.

Remote MCP
Self-hosted MCP

Server runs on

Oxylabs infrastructure

Your machine or infrastructure

Setup

Add the server URL and your API key to your client

Install uv, Python, and the server, then configure your client

Updates and maintenance

Managed by Oxylabs

Managed by you

Server settings

Managed by Oxylabs

Configurable with environment variables

Best for

The quickest way to give a compatible agent access to Web API

Full control over the environment, or clients that can't connect to remote servers with a custom header

Requirements

  • Web API key: in the Oxylabs dashboard, create a Web API product instance, open it, and copy the API key shown at the top of the instance page.

  • For remote MCP: An MCP client that supports remote (HTTP) MCP servers with custom headers, such as Claude Code, Codex, Cursor, etc.

  • For self-hosted MCP: uv and Python 3.10 or higher.

Available tools

Tool
What it does

search

Search the live web – query, max_results, location

scrape

Read one URL, Markdown by default, or return named fields as JSON – url, format, location, device, run_js, json_prompt, json_schema

scrape_target

Call a target-specific scraper – endpoint, params, structured, parser, json_prompt, json_schema

list_scrapers

List available scrape endpoints, or describe one – endpoint

check_scrape

Collect a queued job, such as a JavaScript-rendering scrape – request_id

read_scraped

Read a large page that was offloaded to disk, in chunks – only when the server runs locally (stdio)

Note: All tools are read-only, so many clients can run them without asking for approval.

Option 1: Remote MCP

Connect your client to the Oxylabs-hosted server:

The server authenticates each request with your Web API key, sent as an Authorization: Bearer header.

Set your API key as an environment variable in the terminal where you will run your client:

Then add the server to your client:

--scope user makes the server available in all your projects. Make sure OXYLABS_WEB_API_KEY is set in the environment where you start Claude Code.

Codex reads the key from the OXYLABS_WEB_API_KEY environment variable, so it must be set in the environment where you start Codex.

For any client that supports remote MCP servers with custom headers, add the server URL and an Authorization header to the client's MCP configuration. For example, in Cursor's mcp.json:

Field names can differ between clients – check your client's documentation for how to add a remote MCP server with headers.

Note: Clients that only support OAuth sign-in for remote servers, such as custom connectors in the claude.ai web interface, can't send custom headers and can't connect to the Remote MCP server. Use the self-hosted option with those clients instead.

Option 2: Self-hosted MCP

Note: Remote and self-hosted commands on this page use the same server name, oxylabs-web-api. If you switch from one option to the other, remove the existing server from your client first.

Self-host your Web API MCP server as either Local (stdio) process or a Shared Server (HTTP):

Then point your client at the oxylabs-web-api-mcp command. The source is available in the Web API MCP GitHub repository.

Claude Code
Claude Desktop
Cursor

The agent skill is already built into the server. If you prefer to manage skills separately, Claude Code can instead take the skills repository as a plugin, which wires this server and the skills together:

Run one shared server for a team, or for agents that can't start local processes:

The endpoint is http://<host>:8080/mcp. Callers can send their own key in an Authorization: Bearer header. Otherwise, the server uses OXYLABS_WEB_API_KEY.

A Dockerfile is also available in the repository. To run the server with Docker:

Self-hosted MCP configuration

Configuration variables table
Variable
Description
Default value

OXYLABS_WEB_API_KEY

Web API key, sent as Authorization: Bearer <key>. Required on stdio. Over HTTP, a per-request Authorization header takes precedence.

–

OXYLABS_BASE_URL

Overrides the API base URL, for example to go through a proxy.

https://webapi.oxylabs.io

OXYLABS_RETRIES

Retries on temporary errors (429, 500, 502, 503, 504).

2

OXYLABS_RATE_LIMIT

Caps the server's spend, e.g. 100/1h or 50/30m.

Off

OXYLABS_MAX_INLINE_TOKENS

Content above this size, in tokens, is saved to disk (stdio) or truncated (HTTP).

10000

OXYLABS_SPILL_DIR

Where saved pages are written (stdio only).

System temp directory

OXYLABS_SPILL

Set to 0 to keep all content inline, even on stdio.

1

MCP_TRANSPORT

stdio or http.

stdio

HOST / PORT

HTTP bind address.

127.0.0.1 / 8080

MCP_ALLOWED_HOSTS

Comma-separated Host allowlist (HTTP only).

localhost:*,127.0.0.1:*

MCP_ALLOWED_ORIGINS

Comma-separated Origin allowlist for browser clients (HTTP only).

Empty

On stdio, the server also reads OXYLABS_* variables from a .env file in its working directory, or from the file set in OXYLABS_ENV_FILE. Variables already set in the environment take precedence. The API key is read at request time and is never written to disk or logged.

Agent Browser

Connect Agent Browser through its MCP server hb-mcp, to let your assistant open remote browsers, navigate pages, interact with elements, and collect content using advanced autonomous navigation capabilities and Residential Proxy integration. You can find all details in the Agent Browser MCP GitHub repository.

Available tools

hb_connect returns a session label that you pass to the other tools, so you can run several sessions in parallel. Sessions last up to 1 hour and count toward your concurrent session limit until closed.

Tool
What it does

hb_connect

Open a session – accepts Agent Browser parameters such as p_cc, p_device, p_src, p_fp_tag, session_name, o_profile, record, page_handler

hb_disconnect

Close one session, or all sessions

hb_session_info

List open sessions, or show the details of one

hb_page_status, hb_page_handle, hb_classify_page

Work with the Page Handler: read page status, handle a challenge that appeared after page load (hb_page_handle requires page_handler=true), classify the current page

hb_sessions_list, hb_session_stop

List and stop live sessions on your account

hb_recordings_list, hb_recording_url, hb_recording_delete

Manage session recordings

hb_profiles_list, hb_profile_delete

Manage persistent profiles

hb_reference

Return the parameter and error reference

browser_navigate

Open a URL

browser_snapshot

Read the page content

browser_click

Click an element from the snapshot

browser_type, browser_fill_form

Type into one field, or fill several form fields

browser_take_screenshot

Capture a screenshot

browser_close

Close the session

Other browser_* tools

Tabs, hovering, key presses, waiting, file upload, PDF export, and more

Prerequisites

Installation

Install the server from GitHub, as it is not published to the npm registry:

Then point your client at the hb-mcp binary:

Claude Code
Claude Desktop or Cursor

Add this to your claude_desktop_config.json or .mcp.json file:

To skip the global install, use npx -y github:oxylabs/oxylabs-ab-mcp as the command instead of hb-mcp. Startup is slower.

Location selection

Ask your assistant to open the browser in a specific country with p_cc parameter, or set a default for every session with the --default-params argument:

To choose the browser's location options, visit the Geolocation & Proxy Selection page. If you don't specify a location, one is assigned automatically based on availability.

Use multiple products together

You can run both servers in the same client. Combine their entries under one mcpServers object.

Example

To use the Remote MCP server for Web API instead, replace the oxylabs-web-api entry with the remote entry from Option 1, in a client that supports remote servers with headers.

Verify the setup

  1. Check that your servers appear as enabled in your client's MCP list (in Claude Code, run /mcp, or in Codex, run codex mcp list).

  2. Send a test prompt for each product you set up, and approve the tool call if prompted (e.g. Search the web for "oxylabs" and show the top 3 results.).

Troubleshooting

IssueSolution

Server doesn't appear in the client

Make sure the JSON is valid, then restart the app. If you used a command, run it again and check the server list.

Server is connected and tools are listed, but tool calls fail

The API key is checked only when a tool runs. Check that the key is correct and that you're using credentials for the right product: Web API uses an API key, and Agent Browser uses a username and password.

Authentication failed (401)

The Web API key is invalid. Copy it again from the top of your Web API instance in the dashboard.

Message that no Web API key was provided

Remote MCP: the Authorization header is missing, or OXYLABS_WEB_API_KEY is empty in the environment where you started the client – set it, then restart the client.

Self-hosted: the key isn't set in the server's environment.

Remote MCP server won't connect, or your client has no way to set a header

Your client may support only OAuth sign-in for remote servers or not support custom headers. Use the self-hosted option instead.

Page content is cut off

Pages above the token limit are truncated when the server runs over HTTP, which includes Remote MCP. Request only the data you need with json_prompt, or run the self-hosted server locally (stdio), which saves large pages to disk so the agent can read them in chunks.

oxylabs-web-api-mcp: command not found (self-hosted)

Install uv and Python 3.10 or higher, install the server, and make sure the uv tool directory is on your PATH (uv tool update-shell).

421 Misdirected Request (self-hosted HTTP server)

Add the hostname clients connect to in MCP_ALLOWED_HOSTS.

hb-mcp or npx: command not found

Install Node.js 20.0.0 or higher and git, and make sure they are on your PATH.

Agent Browser won't connect

Verify your credentials and make sure your firewall isn't interfering with WebSocket connections.

Cursor menus look different

Edit mcp.json directly – menu labels can change between Cursor versions. Check logs in Output → MCP Logs.

Last updated

Was this helpful?