Black FridaySpecial - USA & Europe - 100 MBPS: $999.00 instead of $2,000.00. Coupon: BLACKFRIDAY, until November 27.See the plan
WeProxy
Guide

How to Connect an AI Agent to a Proxy: WeProxy MCP Setup for Claude and Cursor

10 min read

Steps to add the WeProxy AI Access MCP server to Claude Code, Cursor and Claude Desktop with a wpk_ API key; a get_quota connection test, a table of the 9 tools, requesting proxies by country and sticky session, a Python script that compares a page across countries, limits and error codes.

Key takeaways

  • WeProxy AI Access is the MCP server at https://mcp.weproxy.io/mcp; it works with a key that starts with wpk_, is tied to one order and is created in the order’s “AI (MCP) / API” tab in the client area.
  • Claude Code needs a single claude mcp add command, Cursor an mcp.json entry, and Claude Desktop a claude_desktop_config.json entry using the mcp-remote bridge (Node.js required).
  • The MCP server does not open pages; it generates proxy lines (get_proxies) and manages quota, usage and the whitelist. Pages are opened by code the agent writes and runs.
  • get_proxies accepts country, region, rotating or 1–1440 minute sticky sessions, five line formats and a count of 1–1000; generating lines is free and only transferred data is deducted from quota.
  • Each key is limited to 120 API calls per minute; keep the key in the WEPROXY_KEY environment variable and regenerate it in the client area if it leaks. The service is currently available only for Premium Rotating Residential orders.

To connect an AI agent to a proxy, add the WeProxy AI Access MCP server (https://mcp.weproxy.io/mcp) to your client and send the API key from your client area, which starts with wpk_, in an Authorization: Bearer header. In Claude Code this is a single claude mcp add command; in Cursor and Claude Desktop it is a few lines of JSON configuration. Once it is set up, the agent can check your quota from the chat, generate proxy lines by country, region and session type, and write and run a research script that uses those lines.

The MCP server does not open web pages or crawl anything itself. Its job is to generate proxy lines, report quota and usage, and manage the IP whitelist. The page is opened by code the agent writes and runs: Python requests, Playwright or the client’s own tools. WeProxy AI Access currently works only with Premium Rotating Residential orders.

What is MCP and what does WeProxy AI Access give an agent?

MCP (Model Context Protocol) is a protocol that lets AI clients connect to external services through a standard interface. The client receives the list of tools a server offers; the model calls those tools when needed and uses the result in its answer. Claude Code, Claude Desktop, Cursor and other MCP-capable tools can all connect to the same server.

WeProxy AI Access exposes your proxy order through this interface. Tasks you would otherwise do by hand in the client area, the agent does from the chat: it reads the remaining GB, requests five sticky proxies from Germany, adds your server’s IP to the whitelist. The endpoint is a stateless JSON-RPC server over Streamable HTTP; in Claude Code and Cursor you do not need to run any extra local process.

The same functions are available as REST (https://mcp.weproxy.io/v1). MCP is for working from the chat, REST is for calling from your own code. Research scripts use both: the agent uses the MCP tools, and the code it writes calls REST. The WeProxy site also has a keyless, read-only catalog MCP; it only returns product and coverage information and does not manage orders (MCP integration).

How do you get an API key before you start?

The key is created in the client area, inside your proxy order:

  1. Open your Premium Rotating Residential order in the client area.
  2. Switch to the "AI (MCP) / API" tab.
  3. Click "Create API key".
  4. Pick the tool you use and click "Copy with key" to get a ready-made configuration.

The key starts with wpk_ and is tied to a single order. If you have several orders, create a separate key for each; the agent sees the quota and proxies of the order its key belongs to. If you do not have an order yet, you can start with the 1 GB free trial.

The examples below use wpk_YOUR_KEY in place of the key. In your own code, keep the key in an environment variable:

export WEPROXY_KEY="wpk_YOUR_KEY"

How do you add the WeProxy MCP server to Claude Code?

Claude Code supports remote HTTP servers directly. Run this command in your terminal:

claude mcp add --transport http weproxy https://mcp.weproxy.io/mcp \
  --header "Authorization: Bearer wpk_YOUR_KEY"

weproxy is the local name of the server; its tools are grouped under that name. After the command, claude mcp list shows whether the server is registered. Because Claude Code can run commands, the scenario in this article works most completely here: the agent gets the proxy through the MCP tool, writes the script to a file and runs it in the terminal.

For the script to call the REST API, define WEPROXY_KEY in the shell you start Claude Code from. Commands the agent runs inherit that environment.

How do you set up an MCP proxy in Cursor?

The shortest route is the client area: the Add to Cursor button on your order’s AI (MCP) / API tab installs the server with your key in one click. To add it manually, use the configuration below.

Cursor reads MCP servers from an mcp.json file. Open the file and add this entry under mcpServers:

{
  "mcpServers": {
    "weproxy": {
      "url": "https://mcp.weproxy.io/mcp",
      "headers": { "Authorization": "Bearer wpk_YOUR_KEY" }
    }
  }
}

If the file already lists other servers, add only the weproxy block to the existing mcpServers object. After saving, check in Cursor’s MCP settings that the server appears with its tool list. Cursor’s agent mode can also run terminal commands, so the write-and-run script workflow works the same way here.

If you keep mcp.json in a project repository, do not commit it while it contains the key; add it to .gitignore.

How do you set it up in Claude Desktop?

For claude.ai and Claude Desktop, the easiest route is a connector: Claude → Settings → Connectors → + Add → Add custom connector. Enter WeProxy as the Name and https://mcp.weproxy.io/mcp as the Remote MCP URL, choose No sign in for Authentication and add Authorization = Bearer wpk_YOUR_KEY under Request headers. Connectors are available on Free, Pro, Max, Team and Enterprise; Free allows one custom connector, and on Team and Enterprise the organization owner adds it. If you prefer a configuration file, the method below also works.

Claude Desktop connects to remote servers through the mcp-remote bridge, so Node.js must be installed on the computer. Go to Settings → Developer → Edit config and add the following to claude_desktop_config.json:

{
  "mcpServers": {
    "weproxy": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.weproxy.io/mcp", "--header", "Authorization:${WEPROXY_AUTH}"],
      "env": { "WEPROXY_AUTH": "Bearer wpk_YOUR_KEY" }
    }
  }
}

Save the file and restart Claude Desktop. The key sits in the env field, and ${WEPROXY_AUTH} in args puts that value into the header. In Claude Desktop the agent handles tasks such as checking quota, fetching proxy lists and managing the whitelist. You run the script it produces on your own computer.

For clients that cannot add headers there is also an endpoint that embeds the key in the URL: https://mcp.weproxy.io/k/wpk_YOUR_KEY/mcp. With this method the key is visible in the address, and therefore in logs; use the header method if your client supports it.

How do you check that the connection works?

The quickest test is to ask the agent about your quota. Type "How much proxy quota do I have left?" in the chat. The agent calls the get_quota tool and returns the remaining, used and total GB. If you get an answer, the key is valid, the order is active and the client is connected to the server.

As a second test, ask "Show my order details". The get_order_info tool shows the order status, the product, the proxy host (for example rotating2.weproxy.io) and the tools available with the key.

To tell whether a problem is in the client or the key, run the same check over REST from the terminal:

curl -s -H "Authorization: Bearer $WEPROXY_KEY" https://mcp.weproxy.io/v1/quota

If cURL gets a response and the client does not, the problem is in the configuration file: the server URL, the header spelling or the JSON syntax. If cURL also returns 401, the key is missing, was copied incorrectly or has been regenerated.

Which tools does the WeProxy MCP server provide?

The server offers nine tools. Each one has a REST counterpart; the agent reaches the data through MCP, your own code through REST.

MCP toolREST endpointWhat it doesExample prompt
get_order_infoGET /v1/orderOrder, product, status, proxy host and enabled tools"What is the status of my order?"
get_quotaGET /v1/quotaRemaining, used and total GB"How much proxy quota do I have left?"
get_proxiesPOST /v1/proxiesGenerates proxy lines by country, region, session and format"Give me 5 sticky German proxies for 10 minutes."
list_countriesGET /v1/countriesCodes and names of targetable countries"Which countries can I choose?"
list_statesGET /v1/countries/{country}/statesStates and regions of a country"Which regions are available for California?"
list_whitelistGET /v1/whitelistIP addresses on the whitelist"Which IPs are on my whitelist?"
add_whitelist_ipPOST /v1/whitelistAdds an IPv4 or IPv6 address"Add my server IP to the whitelist: 203.0.113.10"
remove_whitelist_ipDELETE /v1/whitelistRemoves an address from the whitelist"Remove 203.0.113.10 from the whitelist."
get_usageGET /v1/usageDaily GB usage (period: day, week, month, 3months, 6months)"How much traffic did I use this week?"

The default period for get_usage is month. Calling get_quota before a large job and get_usage after it is the simplest way to see how much traffic the job used.

How do you request proxies by country, region and sticky session?

The get_proxies tool accepts these fields:

FieldValuesDefault
country2-letter country code (us, de, tr…) or randomrandom
stateRegion name from list_states (e.g. New York)empty
sessionrotating (new IP per request) or sticky (same IP for a while)rotating
sticky_minutes1–1440, sticky sessions only30
formathttp_url, user:pass@host:port, host:port:user:pass, host:port@user:pass, host:portuser:pass@host:port
count1–10001

You do not have to spell out these fields for the agent; a plain-language request is translated into them. "Give me 5 sticky German proxies for 10 minutes" means country: de, session: sticky, sticky_minutes: 10, count: 5. To target a region, first ask "Which regions are available for the US?"; the agent fetches the list with list_states and uses the returned name in the state field.

A line returned in http_url format looks like this:

http://USER-region-US-sid-AbCd1234-t-10:[email protected]:1000

In the example line, the username carries the country (region-US), the session ID (sid-AbCd1234) and the sticky duration (t-10). Each line generated in the same request comes with its own session ID; if you request several lines, each one is used as a separate session. The host:port format contains no credentials and requires the IP of the machine running the code to be on the whitelist. The difference between the authentication methods is covered in the proxy authentication guide.

Generating lines is free. Only data transferred through a proxy is deducted from your quota; generating a thousand lines and not using them costs no GB. Which jobs need sticky and which need rotating sessions is explained in the sticky vs rotating guide.

How does the agent write and run a research script with these proxies?

In clients that can run code (Claude Code, Cursor agent mode) the workflow has three steps: the agent decides the proxy parameters, writes the script, then runs it in the terminal and interprets the result. An example prompt:

Write a Python script that opens https://example.com/pricing from the US, Germany and France.
For each country, print the exit IP, the page title, the response size and a content hash.
Get the proxies from the WeProxy REST API and read the key from the WEPROXY_KEY environment variable.

From this prompt the agent produces a script similar to the one below. Having the script fetch proxies from the REST API itself, instead of pasting proxy lines into the chat, keeps the proxy password out of the code file and the chat history:

import hashlib
import os
import re

import requests

API = "https://mcp.weproxy.io/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['WEPROXY_KEY']}"}
TARGET = "https://example.com/pricing"
COUNTRIES = ["us", "de", "fr"]


def get_proxy(country: str) -> str:
    r = requests.post(
        f"{API}/proxies",
        headers=HEADERS,
        json={
            "country": country,
            "session": "sticky",
            "sticky_minutes": 5,
            "format": "http_url",
            "count": 1,
        },
        timeout=30,
    )
    r.raise_for_status()
    return r.json()["proxies"][0]


for country in COUNTRIES:
    proxy = get_proxy(country)
    proxies = {"http": proxy, "https": proxy}
    ip = requests.get("https://api.ipify.org", proxies=proxies, timeout=30).text
    page = requests.get(TARGET, proxies=proxies, timeout=30)
    match = re.search(r"<title>(.*?)</title>", page.text, re.S | re.I)
    title = match.group(1).strip() if match else "-"
    digest = hashlib.sha256(page.content).hexdigest()[:12]
    print(f"{country.upper()} | {ip} | {page.status_code} | {len(page.content)} bytes | {title} | {digest}")

The sticky session makes the IP check and the page request go out from the same IP. Five minutes is enough for this job. The agent reads the output and reports in which country the title, size or content differs; if there are differences, it can write a second step that extracts and compares the relevant sections. For pages whose prices, language or campaign text change by country, this gives a quick first check.

If the page is rendered with JavaScript, ask the agent to write the same flow with Playwright. How to pass a proxy to the browser is covered in Playwright and Puppeteer proxy setup, and the requests and httpx details in using a proxy in Python. A browser uses far more traffic because it loads images and scripts; on a per-GB plan, prefer an HTTP client when the text is enough.

Research scripts must also follow the target site’s terms of use and robots.txt rules. Keep the request rate at a level the site can handle. Permitted uses of WeProxy services are listed on the acceptable use page.

What are the limits and error codes?

Each key can make 120 API calls per minute, and a single request can generate up to 1000 proxies. Traffic through the proxies does not count toward the call limit. A script that crawls hundreds of pages makes only a few API calls per minute; the real load is proxy traffic.

CodeMeaningWhat to do
400Invalid parameterCheck the country code, the sticky_minutes range and the format value
401Key missing or invalidCheck the header and the key; a regenerated key invalidates the old one
403Order not activeCheck the order status and quota in the client area
404Unknown endpointCheck that the path starts with /v1/...
429Too many requestsWait 60 seconds and respect the Retry-After header

On the MCP side, tool errors are returned with isError: true; the agent shows the error in the chat and usually explains the cause. If your proxy account is renewed after a top-up, previously generated lines may stop working. In that case, call get_proxies again; the API key stays the same. Once the proxy connection is established, 403 or 429 codes coming from the target site are a separate matter, covered in the proxy error codes guide.

How do you keep the API key safe?

The wpk_ key gives access to your order; store it like a password. Do not hard-code it; keep it in the WEPROXY_KEY environment variable. The Cursor and Claude Desktop configuration files contain the key in plain text; do not share these files, add them to a repository or show them in screenshots.

If you suspect the key has leaked, click "Regenerate key" in the client area. The old key stops working immediately; you then need to put the new key in your client configurations and environment variable. The proxy lines the agent generates also carry a username and password. Do not print them to log files or shared output.

Which products is it available for?

WeProxy AI Access is currently available only for Premium Rotating Residential orders. Support for other products is in preparation. Premium Rotating Residential offers a residential IPv4 pool, HTTP and SOCKS5 support, country and city targeting, and sticky sessions adjustable from 1 to 1440 minutes. It is billed per GB, and purchased quota stays on the account until it is used up.

Plans and prices are on the product page; all parameters and code examples are in the WeProxy AI Access documentation. The 1 GB free trial is enough to try the setup.

Frequently asked questions

Does the WeProxy MCP server open web pages itself?

No. WeProxy AI Access generates proxy lines, reports quota and usage and manages the IP whitelist. Pages are opened by code the agent writes and runs with the proxies it gets from get_proxies, for example Python requests or Playwright. Claude Code and Cursor agent mode can run that code in the terminal themselves.

How do I add the WeProxy MCP server to Claude Code?

Run claude mcp add --transport http weproxy https://mcp.weproxy.io/mcp --header "Authorization: Bearer wpk_YOUR_KEY" in your terminal. Then confirm the server with claude mcp list and ask the agent “How much proxy quota do I have left?”; the answer comes from the get_quota tool.

What configuration does Cursor need for an MCP proxy?

Add a weproxy entry to the mcpServers object in mcp.json with url set to https://mcp.weproxy.io/mcp and a headers field containing Authorization: Bearer wpk_YOUR_KEY. Because the file contains the key, do not commit it to a repository.

Does generating proxy lines use quota?

No. Generating lines with get_proxies is free; only data transferred through a proxy is deducted from quota. On the API side each key is limited to 120 calls per minute and 1000 proxies per request; proxy traffic does not count toward the call limit.

Which products does WeProxy AI Access work with?

It currently works only with Premium Rotating Residential orders; support for other products is in preparation. You can try the setup with the 1 GB free trial. All parameters are in the WeProxy AI Access documentation.

Get Started

Test Your Proxy Setup Today

Check connectivity with free tools or talk to sales to pick the right package.