Giving Claude Google results from any city with an MCP server
Google doesn't show everyone the same results. If you search for "emergency plumber" in Leeds, you get Leeds plumbers and a map with Leeds businesses. If you search the same words in Manchester, you see other plumbers an
Google doesn't show everyone the same results. If you search for "emergency plumber" in Leeds, you get Leeds plumbers and a map with Leeds businesses. If you search the same words in Manchester, you see other plumbers and another map. Even a search without a local intent, like "accounting software for freelancers", can look different from one country to the next.
That matters as soon as you work on a site for someone who isn't sitting where you are. A client asks why they can't find themselves on Google. You search from your own laptop and see the results for your own city, which tells you nothing about theirs.
Why your own search doesn't help
Google uses your location and your search history to decide what to show you. A VPN changes your IP address, but Google also looks at your browser language and the settings of your Google account. You end up with a mix that doesn't match what a person in that city sees.
There are cleaner ways to do it by hand:
- Google's URL parameters.
glsets the country andhlthe language. For a city there is theuuleparameter, which takes an encoded location name. It works, but it's fiddly, and you should be logged out while you use it. - The Ad Preview and Diagnosis tool in Google Ads. You pick a location and see the results page for it. You need a Google Ads account, and you check one search at a time.
- A rank tracker like BrightLocal or the position tracking in Semrush. Both track keywords for a city over time. That is the right tool when you want the same report every week.
What a SERP API gives you
A SERP API runs the search for you from a location you choose and returns the results as JSON. SerpApi and DataForSEO are two well-known ones, and both take a location parameter. If you write code, this is the cleanest route. You send the query and the city, and you get the organic results with their positions.
With SerpApi, the Leeds search is one request, with the location as a place name:
curl "https://serpapi.com/search.json?engine=google&q=emergency+plumber&location=Leeds,England,United+Kingdom&gl=uk&hl=en&api_key=$SERPAPI_KEY"
If you'd rather ask "which plumbers rank in Leeds but not in Manchester?" and get an answer, an MCP server is easier.
What the MCP server does
MCP (Model Context Protocol) is the standard AI apps use to connect to outside services. Claude supports it, and so do ChatGPT and most coding agents. A server offers a list of tools. When you ask for something, Claude picks the right tool and reads what comes back.
For local search, the tool is a Google search with a location. Claude runs it once for Leeds and once for Manchester, and then compares the two lists. You never see the JSON unless you ask for it.
Setting it up with Chab
I built Chab, which gives AI agents like ChatGPT and Claude 151 tools they don't have on their own. One of them returns Google results the way people in a given country or city see them, with up to 100 results per search. The examples below use Chab, but the idea is the same with any MCP server that wraps a SERP API.
In Claude Code, add the hosted server:
claude mcp add --transport http --scope user chab https://www.chab.ai/mcp
Then type /mcp in Claude Code, pick chab and choose Authenticate. Your browser opens a Chab page where you approve the connection. You can start without an account. The trial has about 50 credits for seven days, and you get 100 more when you sign up.
In claude.ai, press Plugins in the sidebar, then Add and Add custom connector. Name it Chab and use https://www.chab.ai/mcp as the server URL. This works on the free Claude plan too, which allows one custom connector.
If you'd rather not type any of this, paste this line into your agent. A coding agent sets Chab up by itself, and ChatGPT or Claude tell you where to click:
Set up Chab for me: fetch https://www.chab.ai/agent-setup.md and follow it.
Asking for local results
Name the tool in your first request, so Claude doesn't fall back to its own web search:
Use Chab to show me the top 20 Google results for "emergency plumber"
as people in Leeds, UK see them. Then do the same for Manchester.
Make a table of the domains that rank in both cities, with their
position in each city.
The first time, Claude asks before it uses the tool. After that you can ask follow-up questions in the same chat, like "which of the Leeds results are directories and which are plumbers?", and Claude works from the results it already has.
Getting better answers
Give the language when it isn't obvious. A search for "fietsenmaker" in Amsterdam should run in Dutch, and Claude sends that to the tool when you say so.
Watch out for cities that share a name. Portland in Oregon and Portland in Maine are different places. Chab takes a region next to the city for that. When a name is ambiguous, it searches the biggest place and says which one it picked.
Ask for mobile results when the business gets its customers from phone searches. The device is a separate setting in the search, and the mobile page can look different.
Ask for a screenshot when you want to show a client. The results page tool can save a picture of the page as people in that city see it. A screenshot of their competitor in position one is easier to discuss than a table.
What it costs
A Google search with up to 20 results costs 2 credits, and the results page with a screenshot costs 7. Paid plans start at $29 a month for 1,000 credits.
The same search from a script
When you want the search in a cron job instead of a chat, the REST API takes the same fields:
curl -X POST https://www.chab.ai/v1/search/web \
-H "Authorization: Bearer $CHAB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: leeds-plumber-001" \
-d '{
"query": "emergency plumber",
"engine": "google",
"location": { "country": "GB", "city": "Leeds" },
"language": "en-GB",
"device": "mobile",
"limit": 20
}'
The response is an operation with a status URL. You poll it, and when the status is succeeded you fetch the results from the result URL. If you add ?wait=20 to the request URL, you get the result in the same reply when the search finishes within 20 seconds. A free guest key returns at most 10 results. Local and English city names both work, so Lisboa and Lisbon give the same search.
One search is a snapshot
Results move during the day, and Google tests different layouts all the time. A site in position 6 this morning can be in position 8 this afternoon without anything changing on the site. One search from each city tells you who competes there. It doesn't tell you whether a site is going up or down. For that, run the same searches on a schedule and compare them over a few weeks, with a rank tracker or with a small script against the API.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.