返回市场
谷歌搜索引擎服务

谷歌搜索引擎服务

作者:Richard-Weiss28 星标更新:2025-01-27

项目介绍

Google 自定义搜索引擎 MCP 服务器

这是一个使用 CSE(自定义搜索引擎)提供搜索功能的 Model Context Protocol 服务器。该服务器使 LLM 能够提供常规的 Google 搜索词,并返回找到的搜索结果。

该工具仅返回搜索结果本身,而不包含内容。为了从搜索结果中提取内容,应将其与其它服务器如 mcp-server-fetch 结合使用。您也可以结合其他工具以实现某种“深度搜索”或一般意义上的工具链。

免费配额为每天 100 次搜索(1 次工具调用 == 1 次搜索),如果您不想设置计费且此配额不足以满足您的需求,请考虑使用其他服务器。

<a href="https://glama.ai/mcp/servers/mieczol4lv"><img width="380" height="200" src="https://gips2.baidu.com/it/u=1396818741,3988446591&fm=3081&app=3181&f=PNG?w=760&h=400" alt="Google 自定义搜索引擎 MCP 服务器" /></a> smithery 徽章

可用工具

  • google_search - 使用搜索词搜索自定义搜索引擎,并返回一个包含每个结果标题、链接和摘要的结果列表。
    • search_term (字符串,必需):要搜索的搜索词,等同于通常的 Google 搜索中的 查询参数 q

环境变量

  • API_KEY (必需):自定义搜索引擎的 API 密钥。
  • ENGINE_ID (必需):自定义搜索引擎的引擎 ID。
  • SERVICE_NAME (可选):服务名称,如果未更改名称(默认为 customsearch),则留空。
  • COUNTRY_REGION (可选):限制搜索结果到特定国家的文档。参见 国家参数值 获取有效值。
  • GEOLOCATION (可选,默认为 "us"):执行搜索的最终用户的地理位置。参见 地理位置参数值 获取有效值。
  • RESULT_LANGUAGE (可选,默认为 "lang_en"):搜索结果的语言。参见 CSE 查询参数,lr 获取有效值。
  • RESULT_NUM (可选,默认为 10):要返回的搜索结果数量。范围从 1 到 10。

CSE 设置

创建自定义搜索引擎相对简单,完全免费,可以在不到 5 分钟内完成。

  1. 访问 https://console.cloud.google.com/ 并创建一个新的项目。例如,可以命名为 "Claude CSE"。
  2. 选择项目并在搜索栏中搜索 "Custom Search API"。
  3. 点击搜索结果并点击 "启用"。
  4. 点击凭证标签并创建一个新的 API 密钥。
  5. 访问 https://programmablesearchengine.google.com 创建一个新的自定义搜索引擎。
  6. 创建一个新的搜索引擎并为其命名,名称与 SERVICE_NAME 无关。
  7. 如果想要正常的 Google 搜索体验,可以选择 "搜索整个网络"。
  8. 点击 "创建" 并从 js 代码中复制引擎 ID,或者点击自定义并从概览中获取。
  9. 可以根据需要自定义搜索引擎。

使用默认配额,您每天将获得 100 次免费搜索。一次工具调用仅消耗 1 次搜索,即使您获得了 10 个结果也是如此。

安装

使用 uv(推荐)

当使用 uv 时不需要特定安装。我们将使用 uvx 直接运行 mcp-google-cse

使用 PIP

或者,您可以通过 pip 安装 mcp-google-cse

pip install mcp-google-cse

安装后,可以使用以下命令作为脚本运行:

python -m mcp-google-cse

通过 Smithery 安装

要通过 Smithery 自动安装 Google 自定义搜索引擎:

npx -y @smithery/cli install @Richard-Weiss/mcp-google-cse --client claude

配置

针对 Claude 应用配置

在您的 claude_desktop_config.json 中添加:

使用 uvx(如果您不确定选择哪个,请使用此方法)

"mcp-google-cse": {
    "command": "uvx",
    "args": ["mcp-google-cse"],
    "env": {
        "API_KEY": "",
        "ENGINE_ID": ""
    }
}

使用 pip 安装

"mcp-google-cse": {
    "command": "python",
    "args": ["-m", "mcp-google-cse"],
    "env": {
        "API_KEY": "",
        "ENGINE_ID": ""
    }
}

本地运行

    "mcp-google-cse": {
      "command": "uv",
      "args": [
        "--directory",
        "{{克隆仓库的路径}}",
        "run",
        "mcp-google-cse"
      ],
      "env": {
        "API_KEY": "",
        "ENGINE_ID": ""
      }
    }

示例结果

google_search("What is MCP after:2024-11-01") 结果:

[
    {
        "title": "Can someone explain MCP to me? How are you using it? And what ...",
        "link": "https://www.reddit.com/r/ClaudeAI/comments/1h55zxd/can_someone_explain_mcp_to_me_how_are_you_using/",
        "snippet": "Dec 2, 2024 ... Comments Section ... MCP essentially allows you to give Claude access to various external systems. This can be files on your computer, an API, a browser, a ..."
    },
    {
        "title": "Introducing the Model Context Protocol \\ Anthropic",
        "link": "https://www.anthropic.com/news/model-context-protocol",
        "snippet": "Nov 25, 2024 ... The Model Context Protocol (MCP) is an open standard for connecting AI assistants to the systems where data lives, including content repositories, ..."
    },
    {
        "title": "3.5 Sonnet + MCP + Aider = Complete Game Changer : r ...",
        "link": "https://www.reddit.com/r/ChatGPTCoding/comments/1hwn6qd/35_sonnet_mcp_aider_complete_game_changer/",
        "snippet": "Jan 8, 2025 ... Really cool stuff. For those out of the loop here are some MCP servers. You can give your Claude chat (in the desktop version, or in a tool like Cline) ..."
    },
    {
        "title": "Announcing Spring AI MCP: A Java SDK for the Model Context ...",
        "link": "https://spring.io/blog/2024/12/11/spring-ai-mcp-announcement",
        "snippet": "Dec 11, 2024 ... This SDK will enable Java developers to easily connect with an expanding array of AI models and tools while maintaining consistent, reliable integration ..."
    },
    {
        "title": "Implementing a MCP server in Quarkus - Quarkus",
        "link": "https://quarkus.io/blog/mcp-server/",
        "snippet": "6 days ago ... The Model Context Protocol (MCP) is an emerging standard that enables AI models to safely interact with external tools and resources. In this tutorial, I'll ..."
    },
    {
        "title": "mark3labs/mcp-go: A Go implementation of the Model ... - GitHub",
        "link": "https://github.com/mark3labs/mcp-go",
        "snippet": "Dec 18, 2024 ... A Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools."
    },
    {
        "title": "MCP enables Claude to Build, Run and Test Web Apps by Looking ...",
        "link": "https://wonderwhy-er.medium.com/mcp-enable-claude-to-build-run-and-test-web-apps-using-screenshots-3ae06aea6c4a",
        "snippet": "Dec 18, 2024 ... How to Replicate My Experiment on Your Machine. If you're ready to dive into setting up MCP for Claude, follow these steps: ... 2. Download the Project: ... 3."
    },
    {
        "title": "MCP definition and meaning | Collins English Dictionary",
        "link": "https://www.collinsdictionary.com/dictionary/english/mcp",
        "snippet": "2 days ago ... 2 meanings: male chauvinist pig → informal, derogatory a man who exhibits male chauvinism Abbreviation: MCP.... Click for more definitions."
    },
    {
        "title": "What is Anthropic's New MCP Standard and How Can It Improve ...",
        "link": "https://dappier.medium.com/what-is-anthropics-new-mcp-standard-and-how-can-it-improve-your-ai-agent-be6f6c72eb6a",
        "snippet": "Nov 26, 2024 ... Anthropic has released a new protocol, MCP, for connecting AI agents to data sets. This blog explores when and why developers might use MCP to improve their ..."
    },
    {
        "title": "Mostafa Gharib on LinkedIn: What is MCP and how it works",
        "link": "https://www.linkedin.com/posts/mostafa-gharib_what-is-mcp-and-how-it-works-activity-7274301560594026497-p_yq",
        "snippet": "Dec 15, 2024 ... ... MCP Host can use. (Bonus: SDKs in Python and TypeScript make it easy to build these servers!) 2️⃣ MCP Clients These interact with MCP Servers via the protocol."
    }
]