Integrations
Enables web searches using Google's Custom Search API, allowing retrieval of current information from the internet.
Utilizes Google Cloud Platform's Custom Search API to perform web and image searches, returning structured results with metadata.
Google Search MCP Server
A Model Context Protocol (MCP) server that provides web and image search capabilities through Google's Custom Search API. This server follows the MCP specification to integrate with Claude and other AI assistants.
What We're Building
Many AI assistants don't have up-to-date information or the ability to search the web. This MCP server solves that problem by providing two tools:
google_web_search
: Search the web for current informationgoogle_image_search
: Find images related to queries
Once connected to an MCP-compatible client (like Claude in Cursor, VSCode, or Claude Desktop), your AI assistant can perform searches and access current information.
Core MCP Concepts
MCP servers provide capabilities to AI assistants. This server implements:
- Tools: Functions that can be called by the AI (with user approval)
- Structured Communication: Standardized messaging format via the MCP protocol
- Transport Layer: Communication via standard input/output
Prerequisites
- Node.js (v18 or higher) and npm
- Google Cloud Platform account
- Google Custom Search API key and Search Engine ID
- An MCP-compatible client (Claude for Desktop, Cursor, VSCode with Claude, etc.)
Quick Start (Clone this Repository)
If you want to use this server without building it from scratch, follow these steps:
After building, follow the Connecting to MCP Clients section to connect the server to your preferred client.
Set Up Your Environment (Build from Scratch)
If you prefer to build the server yourself from scratch, follow these instructions:
Create Project Structure
macOS/Linux
Windows
Configure TypeScript
Create a tsconfig.json
in the root directory:
Update package.json
Ensure your package.json
includes:
Google API Setup
You'll need to set up Google Cloud Platform and get API credentials:
Google Cloud Platform Setup
- Go to Google Cloud Console
- Create a new project
- Enable the Custom Search API:Copy
- Create API credentials:Copy
Custom Search Engine Setup
- Go to Programmable Search Engine
- Click "Add" to create a new search engine
- Select "Search the entire web" and name your search engine
- Get your Search Engine ID (cx value) from the Control Panel
Environment Configuration
Create a .env
file in the root directory:
Add .env
to your .gitignore
file to protect your credentials:
Building Your Server
Create the Server Implementation
Create your server implementation in src/index.ts
:
For the complete implementation details, see the repository files.
Building the Server
After completing your implementation, build the server:
This will compile the TypeScript code to JavaScript in the dist
directory.
Connecting to MCP Clients
MCP servers can be connected to various clients. Here are setup instructions for popular ones:
Claude for Desktop
macOS/Linux
- Open your configuration file:
- Add the server configuration:
Windows
- Open your configuration file:
- Add the server configuration:
- Restart Claude for Desktop
- Verify the tools appear by clicking the tool icon in the interface
VSCode with Claude
macOS/Linux & Windows
- Install the MCP Extension for VSCode
- Create or edit
.vscode/settings.json
in your workspace:
For macOS/Linux:
For Windows:
- Restart VSCode
- The tools will be available to Claude in VSCode
Cursor
- Open Cursor settings (gear icon)
- Search for "MCP" and open MCP settings
- Click "Add new MCP server"
- Configure with similar settings to above:
For macOS/Linux:
For Windows:
- Restart Cursor
Testing Your Server
Using with Claude
Once connected, you can test the tools by asking Claude questions like:
- "Search for the latest news about renewable energy"
- "Find images of electric vehicles"
- "What are the top tourist destinations in Japan?"
Claude will automatically use the appropriate search tool when needed.
Manual Testing
You can also test your server directly:
What's Happening Under the Hood
When you ask a question:
- The client sends your question to Claude
- Claude analyzes the available tools and decides which to use
- The client executes the chosen tool through your MCP server
- The results are sent back to Claude
- Claude formulates a natural language response based on the search results
- The response is displayed to you
Troubleshooting
Common Issues
Environment Variables
If you see Error: GOOGLE_API_KEY environment variable is required
:
API Errors
If you encounter API errors:
Connection Issues
If your client can't connect to the server:
API Reference
google_web_search
Performs a web search using Google's Custom Search API.
Parameters:
query
(string, required): The search querycount
(number, optional): Number of results (1-10, default 5)start
(number, optional): Pagination start index (default 1)site
(string, optional): Limit search to specific site (e.g., 'example.com')
google_image_search
Searches for images using Google's Custom Search API.
Parameters:
query
(string, required): The image search querycount
(number, optional): Number of results (1-10, default 5)start
(number, optional): Pagination start index (default 1)
Limitations
- Free tier of Google Custom Search API: 100 queries per day
- Server-enforced rate limit: 5 requests per second
- Maximum 10 results per query (Google API limitation)
License
This project is licensed under the MIT License - see the LICENSE file for details.
You must be authenticated.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A Model Context Protocol server that provides web and image search capabilities through Google's Custom Search API, allowing AI assistants like Claude to access current information from the internet.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that integrates with Microsoft Bing Search API, allowing AI assistants to perform web, news, and image searches.Last updated -319PythonMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables Claude to perform Google Custom Search operations by connecting to Google's search API.Last updated -Python
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI assistants to perform real-time web searches, retrieving up-to-date information from the internet via a Crawler API.Last updated -1448JavaScript
- -securityAlicense-qualityA Model Context Protocol server that provides real-time web search capabilities to AI assistants through pluggable search providers, currently integrated with the Brave Search API.Last updated -3TypeScriptMIT License