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.
Integrations
Enables web search capabilities through Google's Custom Search API, allowing users to retrieve search results with titles, URLs, and descriptions.
Uses Google Cloud's Custom Search API to perform web searches with configurable results (up to 10 per query).
MCP Google 自定义搜索服务器
一个模型上下文协议 (MCP) 服务器,通过 Google 的自定义搜索 API 提供网页搜索功能。该服务器支持语言学习模型 (LLM) 使用标准化接口执行网页搜索。
🌟 功能
- 与 Google 自定义搜索 API 无缝集成
- 符合模型上下文协议 (MCP) 的服务器实现
- 使用 TypeScript 的类型安全实现
- 环境变量配置
- 使用 Zod 进行输入验证
- 可配置的搜索结果(每个查询最多 10 个)
- 格式化的搜索结果,包括标题、URL 和描述
- 错误处理和验证
- 与 Claude Desktop 和其他 MCP 客户端兼容
📋 先决条件
在开始之前,请确保您已:
- 启用了自定义搜索 API 的 Google Cloud 项目
- 访问Google Cloud Console
- 启用自定义搜索 API
- 创建 API 凭证
- 自定义搜索引擎 ID
- 访问可编程搜索引擎
- 创建新的搜索引擎
- 获取您的搜索引擎 ID
- 当地发展要求:
- Node.js(v18 或更高版本)
- npm(Node.js 附带)
🚀 快速入门
- 克隆存储库:Copy
- 安装依赖项:Copy
- 创建 .env 文件:Copy
- 构建服务器:Copy
- 启动服务器:Copy
🔧 配置
环境变量
多变的 | 描述 | 必需的 |
---|---|---|
GOOGLE_API_KEY | 您的 Google 自定义搜索 API 密钥 | 是的 |
GOOGLE_SEARCH_ENGINE_ID | 您的自定义搜索引擎 ID | 是的 |
Claude 桌面集成
将此配置添加到您的 Claude Desktop 配置文件(通常位于~/Library/Application Support/Claude/claude_desktop_config.json
):
📖 API 参考
可用工具
搜索
使用 Google 自定义搜索 API 执行网络搜索。
参数:
query
(字符串,必需):要执行的搜索查询numResults
(数字,可选):要返回的结果数- 默认值:5
- 最大:10
响应示例:
🛠️ 开发
项目结构
可用脚本
npm run build
:将 TypeScript 编译为 JavaScriptnpm start
:启动 MCP 服务器npm run dev
:用于开发的监视模式
测试
- 使用 MCP 检查器:Copy
- 使用示例查询进行手动测试:Copy
📝 许可证
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
🙏 致谢
- 使用模型上下文协议(MCP)构建
- 使用 Google 的自定义搜索 API
- 受到 LLM 应用程序中对更好的搜索功能的需求的启发
You must be authenticated.
Tools
模型上下文协议服务器使 LLM 能够通过标准化界面使用 Google 的自定义搜索 API 执行网络搜索。
- 🌟 Features
- 📋 Prerequisites
- 🚀 Quick Start
- 🔧 Configuration
- 📖 API Reference
- 🛠️ Development
- 📝 License
- 🙏 Acknowledgments