Google MCP Server

by rtbui2012

255 downloads
Not rated
GitHub

About

# Google MCP Server This project implements a Model Context Protocol (MCP) server for Google APIs enabling integration with AI assistants and other MCP-compatible clients. --- ## Prerequisites - Node.js 18+ - npm --- ## Installation ### 1. Clone the repository ```sh git clone…

Details

Author
rtbui2012
Downloads
255
Categories
Other

- Provides web search via googleSearchContent tool.
- Provides image search via googleSearchImages tool.
- Returns structured results (titles, links, snippets).
- Returns Markdown image link for first image result.
- Works with any MCP‑compatible client.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Google MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, install dependencies (npm install), and set up a .env file with your GOOGLE_API_KEY and GOOGLE_CX_ID. Then run a test search with npx ts-node src/test.ts or add the server to your MCP client’s configuration (e.g., claude_desktop_config.json) specifying the command, arguments, and environment variables.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "google mcp server": {
            "google-mcp-server": {
                "command": "npx",
                "args": [
                    "ts-node",
                    "src/test.ts"
                ]
            }
        }
    }
}

McpServers

{
    "google-mcp-server": {
        "command": "npx",
        "args": [
            "ts-node",
            "src/test.ts"
        ]
    }
}

Google MCP Server

This project implements a Model Context Protocol (MCP) server for Google APIs enabling integration with AI assistants and other MCP-compatible clients.

---

Prerequisites

- Node.js 18+
- npm

---

Installation

1. Clone the repository

git clone https://github.com/your-username/mcp-google-search.git
cd google-mcp-server

2. Install dependencies

npm install

3. Set up your Google Custom Search API credentials

Create a .env file in the project root with the following content:

GOOGLE_API_KEY=your_google_api_key_here
GOOGLE_CX_ID=your_custom_search_engine_id_here

- GOOGLE_API_KEY: Your Google Custom Search API key.
- GOOGLE_CX_ID: Your Google Custom Search Engine ID.

You can obtain these from the Google Custom Search JSON API documentation.

---

Usage

1. Run a test search

npx ts-node src/test.ts

This will execute a sample search and print the results to the console.

2. Integrate with MCP-compatible clients

To use this server as part of an MCP configuration, add an entry to your MCP settings file (e.g., claude_desktop_config.json):

{
  "mcpServers": {
    "google-api": {
      "command": "npx",
      "args": ["ts-node", "src/index.ts"],
      "env": {
        "GOOGLE_API_KEY": "your_google_api_key_here",
        "GOOGLE_CX_ID": "your_custom_search_engine_id_here"
      }
    }
  }
}

Replace the API key and CX ID with your actual credentials.

---

Available Tools

The server provides the following tools:

1. googleSearchContent: Performs a web search using the Google Custom Search API and returns structured results (titles, links, and snippets).
2. googleSearchImages: Performs an image search using the Google Custom Search API and returns a Markdown image link for the first result.

Refer to the source code in src/tools.ts for detailed usage information.

---

Development

To make changes to the project:

1. Modify the code in the src directory as needed.
2. If you add or remove dependencies, update package.json accordingly.
3. Restart your MCP client or test script to apply changes.

---

Troubleshooting

- Ensure your Google API key and CX ID are correctly set in the .env file or your environment.
- Check that all dependencies are installed (npm install).
- Verify that you are using Node.js 18 or newer.
- If you make changes to the code, restart your server or test script.

---

License

This project is licensed under the MIT License.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.