How to Add Google Search to Claude Code with MCP

When you are debugging from a terminal, the slowest part is often not reading code or running commands. It is the context switch: copy an unfamiliar error, open a browser, search, compare results, then return to Claude Code and explain what you found.
Google Search MCP for Claude Code solves that narrow but common problem. It lets Claude Code call a managed Serp MCP Server from inside the same terminal workflow, so search becomes part of the debugging or research loop rather than a separate tab-hopping exercise.
What you can do
After connecting the MCP server, Claude Code can use natural language requests to search from the command line. The documented tool set includes:
serp_google_searchfor Google web search, with support for country, language, and time range.serp_google_imagesfor Google image search.serp_google_newsfor Google news search.serp_google_videosfor Google video search.serp_google_mapsandserp_google_placesfor map and local business search.
The most practical starting point is web search. For example, while connected to a production box over SSH, you can ask Claude Code:
Search how to resolve nginx 502 bad gateway response header too large
That is useful because Claude Code already has the surrounding terminal context: logs, config snippets, stack traces, and the files you are editing.
How it works
The integration is configured as an HTTP MCP server named serp. Claude Code talks to this server at:
https://serp.mcp.acedata.cloud/mcp
Authentication is passed through an uppercase -H header in the claude mcp add command:
-H "Authorization: Bearer YOUR_ACEDATACLOUD_API_KEY"
The uppercase -H detail matters: the documentation notes that lowercase -h is interpreted as --help. Keep the real token out of public repositories, issues, screenshots, and chat logs. Use the placeholder in examples and store the actual value only in your local configuration or private environment.
Choose the right configuration scope
Claude Code supports three documented scopes for this MCP setup: local, user, and project. They are small flags, but they change where the configuration lives and who can see it.
Use local for a quick trial
The local scope is bound to the project directory where you run the command. Claude Code writes the record into your local ~/.claude.json, along with the current project path.
claude mcp add serp --transport http https://serp.mcp.acedata.cloud/mcp -H "Authorization: Bearer YOUR_ACEDATACLOUD_API_KEY" -s local
Use user if you search across many projects
If you want the same Google Search MCP server available whenever you open Claude Code, configure it at the user level:
claude mcp add serp --transport http https://serp.mcp.acedata.cloud/mcp -H "Authorization: Bearer YOUR_ACEDATACLOUD_API_KEY" -s user
Use project for team projects
The project scope writes configuration into .mcp.json in the current project root. This can be useful for a private repository shared by a team, but do not commit a real token. Use an environment placeholder or have each developer add credentials locally.
claude mcp add serp --transport http https://serp.mcp.acedata.cloud/mcp -H "Authorization: Bearer YOUR_ACEDATACLOUD_API_KEY" -s project
When Claude Code first reads a project-level configuration, it may show Pending approval. That is expected; approve the project configuration inside the Claude Code session if you trust it.
Verify the connection
Once the configuration is in place, run:
claude mcp list
If serp shows ✓ Connected, the handshake succeeded. If it fails, check the token, the MCP service URL, and the scope you used. Do not debug by relying on old client screenshots or assuming a fixed number of tools; verify the current connection state from the command output.
Practical workflows
The simplest workflow is debugging. Paste less, search closer to the problem, and let Claude Code connect the external result with the files or logs already in view.
Search how to resolve nginx 502 bad gateway response header too large
For technical selection research, ask for current comparisons and include the time frame in the prompt:
Search for the performance comparison of Python asynchronous ORM in 2025, SQLAlchemy 2.0 async vs Tortoise ORM
For API or infrastructure work, searching official docs is safer than relying on memory:
Search for the official documentation of Kubernetes CronJob concurrencyPolicy, the difference between Forbid and Replace
The point is not to replace judgment. It is to keep research inside the same loop where you are reading code, changing files, and validating fixes.
A small habit that pays off
I would start with -s local in one repository, verify serp with claude mcp list, and use it for a few real debugging sessions before moving the configuration to user or project. That keeps the first setup reversible while still proving whether terminal-native search helps your day-to-day workflow.
For the full source documentation and related MCP references, read Claude Code with Google Search MCP.
Comments
Post a Comment