> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/help-center/data-for-llms/how-do-i-use-model-context-protocol-mcp-with-web-api.md).

# How do I use Model Context Protocol (MCP) with Web API?

Learn how to connect an MCP client to Web API.

MCP is optional. Your existing requests to [Web API](https://developers.oxylabs.io/products/web-api) keep working, and you can connect the MCP server whenever you want an AI agent to call Web API directly.

### **Connect to the Oxylabs MCP server**

The remote MCP server is hosted and maintained by Oxylabs, so there is nothing to install.

{% stepper %}
{% step %}
In the dashboard, create a Web API instance and copy its API key.
{% endstep %}

{% step %}
Add your API key to the environment:

{% code overflow="wrap" expandable="true" %}

```bash
export OXYLABS_WEB_API_KEY="your_api_key_here"
```

{% endcode %}
{% endstep %}

{% step %}
Add the server to your MCP client.

{% tabs %}
{% tab title="Claude Code" icon="claude" %}

```bash
claude mcp add --transport http --scope user oxylabs-web-api \
  https://mcp.oxylabs.io/web-api-mcp \
  --header "Authorization: Bearer ${OXYLABS_WEB_API_KEY}"
```

{% endtab %}

{% tab title="ChatGPT/Codex" icon="openai" %}

```bash
codex mcp add oxylabs-web-api \
  --url https://mcp.oxylabs.io/web-api-mcp \
  --bearer-token-env-var OXYLABS_WEB_API_KEY
```

{% endtab %}

{% tab title="Cursor (+ others)" icon="cursor" %}
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 Cursor `mcp.json`:

```json
{
  "mcpServers": {
    "oxylabs-web-api": {
      "url": "https://mcp.oxylabs.io/web-api-mcp",
      "headers": {
        "Authorization": "Bearer ${env:OXYLABS_WEB_API_KEY}"
      }
    }
  }
}
```

Field names can differ between clients – check your client's documentation for how to add a remote MCP server with headers.
{% endtab %}
{% endtabs %}
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**Note:** Remote MCP works with clients that support remote MCP servers with custom headers. Clients that only support OAuth sign-in, such as custom connectors in the claude.ai web interface, can't connect to it. If your client falls into that group, or you prefer to run the server yourself, use the [self-hosting option](https://developers.oxylabs.io/ai-workflows/mcp#option-2-self-hosted-mcp).
{% endhint %}

For configuration, self-hosting, and the full tool list, see [MCP server documentation](https://developers.oxylabs.io/ai-workflows/mcp) and [GitHub](https://github.com/oxylabs/web-api-mcp).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/help-center/data-for-llms/how-do-i-use-model-context-protocol-mcp-with-web-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
