# Google search MCP server for Claude Desktop, Cursor and other MCP clients

> Add Google search to Claude Desktop, Claude Code, Cursor and other MCP clients: a 40-line Python MCP server on the SerpCrypto SERP API. No KYC, crypto.

- URL: https://serpcrypto.com/docs/mcp/
- Last updated: 2026-10-22
- Publisher: SerpCrypto (https://serpcrypto.com)

Give any MCP client a `google_search` tool that returns live Google results. The server is one Python file you run yourself; it calls the SerpCrypto API and returns compact text a model can read.

**Quick answer — How do I add Google search to Claude Desktop or Cursor with an MCP server?**

Save the 40-line Python server below, install `mcp[cli]` and `httpx`, and register it in your client's MCP settings with your **SerpCrypto** API key in `env`. The client then gets a `google_search` tool that returns live Google results. Each tool call is one search at 1 credit, from $0.30/1K searches; credits are paid in crypto with no KYC.

## The MCP server at a glance

| Attribute | Value |
| --- | --- |
| Language | Python 3.10+ with the official `mcp` SDK (FastMCP) and `httpx` |
| Transport | stdio: the client starts the script and talks to it |
| Tool | `google_search(query, gl, hl, num_results)` |
| Output | AI Overview text when shown, then title, link and snippet per result |
| Key | Environment variable `SERPCRYPTO_API_KEY`, set in the client config |
| Cost | 1 credit per tool call that succeeds; errors are free |

## What does the server do?

It exposes one tool, `google_search`, over the Model Context Protocol. When the model calls it, the server sends one request to `https://serpcrypto.com/api/v1/search`, then turns the JSON into short plain text: the AI Overview if Google showed one, and the top results with title, link and snippet.

Short text matters. A full results page in JSON is long, and every character sent back to the model uses context. The server keeps up to ten results and cuts the overview at 800 characters; change those limits in the code if your client has room for more.

This is copy-paste code, not a published package: there is no official SerpCrypto MCP package to install. You own the file and can add tools, for example one for `engine=google_news`.

*serpcrypto_mcp.py*

```python
"""serpcrypto_mcp.py: an MCP server that gives AI clients a Google search tool.

Install once:  pip install "mcp[cli]" httpx
Run by your MCP client over stdio; the API key comes from the environment.
"""
import os

import httpx
from mcp.server.fastmcp import FastMCP

API_URL = "https://serpcrypto.com/api/v1/search"
mcp = FastMCP("serpcrypto-search")


@mcp.tool()
async def google_search(query: str, gl: str = "us", hl: str = "en", num_results: int = 5) -> str:
    """Search Google and return the top results (title, link, snippet) and the AI Overview text if any.

    gl is a two-letter country code (us, gb, de...), hl a language code (en, de, pt-BR...).
    Each call uses one SerpCrypto search credit.
    """
    headers = {"Authorization": "Bearer " + os.environ["SERPCRYPTO_API_KEY"]}
    params = {"q": query, "gl": gl, "hl": hl}
    async with httpx.AsyncClient(timeout=90) as client:
        r = await client.get(API_URL, params=params, headers=headers)
    if r.status_code != 200:
        return f"Search failed with HTTP {r.status_code}: {r.text[:300]}"
    data = r.json()
    lines = []
    overview = data.get("ai_overview") or {}
    if overview.get("text"):
        lines.append("AI Overview: " + overview["text"][:800])
    for item in data.get("organic_results", [])[: max(1, min(num_results, 10))]:
        lines.append(f"{item['position']}. {item['title']}\n{item['link']}\n{item.get('snippet', '')}")
    return "\n\n".join(lines) or "No results."


if __name__ == "__main__":
    mcp.run()  # stdio transport
```

## Why is the tool called google_search and not web_search?

Several clients already ship a tool named `web_search` that uses their own provider. A distinct name avoids a clash and tells the model what it gets: Google results for a country and language it chooses. The docstring is the description the model reads, so it states the parameters and the cost of a call.

## How do I add it to Claude Desktop?

Open the configuration file, `claude_desktop_config.json`: on macOS it is in `~/Library/Application Support/Claude/`, on Windows in `%APPDATA%\Claude\`. Add the server under `mcpServers`, with the absolute path to the script and your key in `env`, then restart Claude Desktop.

If `python` is not on the path Claude Desktop sees, use the full path to the interpreter, for example the one inside your virtual environment.

*claude_desktop_config.json*

```json
{
  "mcpServers": {
    "serpcrypto-search": {
      "command": "python",
      "args": ["/absolute/path/to/serpcrypto_mcp.py"],
      "env": {
        "SERPCRYPTO_API_KEY": "paste-your-key-here"
      }
    }
  }
}
```

## How do I add it to Claude Code and Cursor?

In Claude Code, register it from a terminal with `claude mcp add`; `-e` sets the environment variable and everything after `--` is the command to run. In Cursor, put the same `mcpServers` block as above in `~/.cursor/mcp.json` for every project, or in `.cursor/mcp.json` inside one project.

Other MCP clients that start stdio servers take the same three things: a command, its arguments and environment variables. The [OpenClaw page](https://serpcrypto.com/docs/openclaw/) shows the commands for OpenClaw.

*Claude Code*

```bash
claude mcp add serpcrypto-search \
  -e SERPCRYPTO_API_KEY=paste-your-key-here \
  -- python /absolute/path/to/serpcrypto_mcp.py
```

## How do I keep the API key safe?

Keep it in the `env` block of the client configuration or in your shell profile, never inside `serpcrypto_mcp.py`. That way the script can be shared or committed without the key. If a key leaks, revoke it in the dashboard and create a new one: API keys you can create and revoke at any time from your dashboard.

Give the MCP server its own key. Usage per key then shows how many searches the assistant makes, separate from your scripts.

## How many credits will an assistant use?

One per tool call that succeeds. A chat where the model searches three times costs three credits. On the 25,000 searches pack at $18.75, that is thousands of assisted questions, and Prepaid search credits never expire: unused searches stay on your account until you use them.

To cap usage, lower `num_results` (it does not change the price, but it shortens answers) and tell the model in your instructions to search only when it needs fresh facts.

## MCP questions

### Does the server work with remote MCP clients?

This version uses stdio, so the client must run it on the same machine. FastMCP can also serve over HTTP; if you expose it on a network, put authentication in front of it, because anyone who reaches it spends your credits.

### Can the tool search Bing or Google News instead?

Yes. Add an `engine` argument or a second tool that sends `engine=bing` or `engine=google_news` in `params`. Every engine costs the same 1 credit per search.

### Why does the client say the tool failed?

Run the script by hand with the same Python to see errors. The usual causes are a missing `mcp` or `httpx` package, a wrong path in the config, or an empty `SERPCRYPTO_API_KEY`, which makes the API answer `401`.

### Do I need a credit card or KYC for the API key?

No. SerpCrypto sells prepaid credits paid in BTC, USDT, USDC, ETH, SOL, LTC, with no ID, no selfie and no documents. Account-number login; email is optional.

---

SerpCrypto: SerpCrypto is a SERP API for developers and AI agents that returns Google and Bing results as JSON, paid in crypto with no ID upload. Prepaid search credits from $0.30/1K searches never expire. No KYC — no ID, no selfie, no documents. Pay in crypto.
