Google 搜索 MCP 服务器
该项目是一个模型上下文协议 (MCP) 服务器,为 AI 助手提供 Google 搜索 API 功能。
概述
Google Search MCP Server 是一种工具,可让您的 AI 助手使用 Google Search API 执行网络搜索。我们使用 Gradio 和 MCP 来提供 AI 助手和 Google 搜索 API 之间的接口。
功能
使用 Google 搜索 API 搜索网页
以 JSON 格式返回搜索结果
获取最多 20 个搜索结果
先决条件
Python 3.12 或更高版本
Google 自定义搜索引擎 ID
Google API 密钥
安装
克隆存储库:
git clone https://github.com/yourusername/google-search-mcp-server.git
cd google-search-mcp-server
安装依赖项:
pip install -e .
设置环境变量:
将.env.sample文件复制到.env并添加必要的 API 密钥:
cp .env.sample .env
编辑.env文件并设置以下值:
GOOGLE_CSE_ID=あなたのGoogleカスタム検索エンジンID
GOOGLE_API_KEY=あなたのGoogleAPIキー
如何使用
要启动服务器:
python app.py
这将启动 Gradio 界面并充当 MCP 服务器。
与 MCP 集成
该服务器使用模型上下文协议(MCP)与AI助手集成。 AI助手可以通过该服务器访问谷歌搜索功能。
API 参考
执行网络搜索
perform_web_search(query: str, num_results: int = 10)
参数:
query(str):搜索查询(最多 400 个字符,50 个单词)num_results(int):结果数(1-20,默认10)。
返回:
str:JSON格式的搜索结果
This server cannot be installed
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server implementation that enables AI assistants like Claude to perform Google searches and retrieve web data directly through natural language requests.Last updated -13757MIT License
- AsecurityFlicenseAqualityA Model Context Protocol server that provides web search capabilities using Google Custom Search API and webpage content extraction functionality.Last updated -232
- AsecurityFlicenseAqualityA 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.Last updated -21
- AsecurityAlicenseAqualityModel Context Protocol server that enables AI assistants like Claude to access searchapi.io API for searching Google Maps, flights, hotels, and other web information.Last updated -91MIT License