Skip to main content
Glama
hasinduudara

Google Search MCP Server

by hasinduudara

Node.js TypeScript MCP Google Custom Search License

๐Ÿ” An MCP server that lets any MCP-compatible AI client search the live web through Google's Custom Search JSON API โ€” over stdio, plug-and-play.


๐Ÿงญ Table of Contents


Related MCP server: Google Search MCP

โœจ Overview

This server bridges the gap between AI agents and real-time web knowledge. It speaks the Model Context Protocol (MCP) over stdio, so any compatible client can call a single tool โ€” search_google โ€” and get back clean, structured search results straight from Google.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        stdio (MCP)        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        HTTPS        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   MCP Client     โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚  Google Search MCP    โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚  Google Custom     โ”‚
โ”‚ (Claude, etc.)   โ”‚ โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚       Server           โ”‚ โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  Search JSON API   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        results            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       results        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โš™๏ธ Requirements

Requirement

Details

๐ŸŸข Node.js

v18 or newer

๐Ÿ”‘ Google API Key

With access to the Custom Search JSON API

๐Ÿ†” Search Engine ID

From a Google Programmable Search Engine (cx)


๐Ÿ”ง Google Custom Search Setup

  1. Create a project in the Google Cloud Console

  2. Enable the Custom Search API for that project

  3. Generate an API key

  4. Create a Programmable Search Engine and copy its Search Engine ID


๐Ÿ“ฆ Installation

npm install

Create a .env file in the project root:

GOOGLE_API_KEY=your_google_api_key
SEARCH_ENGINE_ID=your_search_engine_id

โš ๏ธ Never commit .env or expose your API key in source control.


โ–ถ๏ธ Run

Development (run TypeScript directly):

npm start

Production (build then run compiled output):

npm run build
node build/index.js

โ„น๏ธ The server logs status and errors to stderr, keeping stdout clean for MCP protocol messages.


๐Ÿ”Œ MCP Client Configuration

After building the project, register the server with an MCP-compatible client using the compiled entry point:

{
  "mcpServers": {
    "google-search": {
      "command": "node",
      "args": ["D:/My Learning Projects/Google-Search-MCP/build/index.js"],
      "env": {
        "GOOGLE_API_KEY": "your_google_api_key",
        "SEARCH_ENGINE_ID": "your_search_engine_id"
      }
    }
  }
}

Or keep credentials in the project's .env and launch from the project directory:

{
  "mcpServers": {
    "google-search": {
      "command": "node",
      "args": ["D:/My Learning Projects/Google-Search-MCP/build/index.js"]
    }
  }
}

๐Ÿ› ๏ธ Available Tool

search_google

Searches Google Custom Search for the supplied query and returns the top 3 results.

Input

{
  "query": "latest TypeScript release"
}

Output

Each result includes:

  • ๐Ÿ“Œ title

  • ๐Ÿ”— link

  • ๐Ÿ“ snippet

If nothing is found, the tool responds with No results found.


๐Ÿงช Test with MCP Inspector

npm run build
npx @modelcontextprotocol/inspector node build/index.js

Make sure your environment variables are set before launching the inspector.


๐Ÿ“ Project Structure

๐Ÿ“ฆ Google-Search-MCP
โ”œโ”€โ”€ ๐Ÿ“‚ src
โ”‚   โ””โ”€โ”€ index.ts     # MCP server implementation
โ”œโ”€โ”€ ๐Ÿ“‚ build          # Compiled JavaScript and type declarations
โ”œโ”€โ”€ .env              # Local environment config (not committed)
โ””โ”€โ”€ README.md

๐Ÿ“„ License

No license has been specified for this project yet.


๐Ÿ‘ค Author

M. Hasindu Udara Full-Stack Developer

LinkedIn

Available Tools

1 tool
search_googleB

Search the web using Google Custom Search API to find the latest information.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query to look for.

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the basic operation and that results are 'latest information'; it does not mention authentication needs, rate limits, read-only behavior, result format, or error conditions. For a tool with zero annotation coverage, this is a notable gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one sentence with no wasted words: it names the action, the API used, and the intended purpose. All information is front-loaded and earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with only one required parameter, which makes the description minimally viable. However, with no output schema and no annotations, the description does not convey what the agent can expect in the response or any invocation constraints, leaving it just adequate rather than complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% because the sole property 'query' is documented as 'The search query to look for.' The description adds no additional semantic detail beyond what the schema already provides, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource: 'Search the web using Google Custom Search API,' and adds the purpose of finding 'the latest information.' It is clear what the tool does, though with no sibling tools it cannot differentiate itself from alternatives, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'to find the latest information' implies the tool is appropriate for current web lookups, but there is no explicit guidance on when to use it versus alternatives, no exclusions, and no mention of prerequisites such as API configuration. This is implied usage rather than clear routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • First observedsearch_google

TDQS

A3.7/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap between tools. The single tool's purpose is clear and distinct by default.

Naming Consistency5/5

The tool name follows a clear verb_noun pattern (search_google), which is consistent and descriptive. There are no other tools to create inconsistencies.

Tool Count3/5

The server has only one tool, which feels thin for typical MCP servers. However, for a narrowly scoped Google Search service, a single focused search tool is defensible.

Completeness5/5

The tool fully covers the stated purpose of searching the web via Google Custom Search API. There are no obvious missing operations for a server dedicated solely to performing web searches.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers