Mcp Google 服务器 A Mcp 服务器用于 Google 自定义搜索和网页阅读
概览
什么是 mcp-google-search?
mcp-google-search 是由用户 ### adenot 在 GitHub 上创建的公共代码库。该项目专注于增强 Google 的搜索功能,可能为用户提供更好的搜索结果和功能。它被设计为一个开源解决方案,允许开发者贡献并增强其功能。
mcp-google-search 的特点
- 开源:该代码库是公开可访问的,任何人都可以查看、使用和贡献代码。
- 增强的搜索功能:该项目旨在改善用户与 Google 搜索的互动方式,可能提供简化搜索过程的功能。
- 社区驱动:作为一个开源项目,它鼓励开发者之间的合作,促进一个可以为其成长和改进做出贡献的社区。
- 文档:提供全面的文档,以帮助用户有效理解如何实现和利用代码库的功能。
如何使用 mcp-google-search
-
克隆代码库:首先使用以下命令将代码库克隆到本地机器:
git clone https://github.com/adenot/mcp-google-search.git
-
安装依赖:导航到项目目录并安装任何必要的依赖。这通常可以使用 npm 或 yarn 等包管理器完成,具体取决于项目的设置。
-
运行应用程序:按照文档中的说明运行应用程序。这可能涉及启动本地服务器或执行特定脚本。
-
贡献:如果您希望为项目做出贡献,请查看代码库中提供的贡献指南。您可以提交问题、功能请求,甚至提交带有您增强功能的拉取请求。
常见问题解答
mcp-google-search 使用了哪些编程语言?
该项目主要使用 JavaScript,但也可能包括用于前端开发的 HTML 和 CSS。
我该如何报告问题或错误?
您可以通过导航到代码库中的“问题”标签,提交一个新问题,并详细说明问题来报告问题。
mcp-google-search 有许可证吗?
是的,该代码库根据 MIT 许可证进行许可,允许自由使用、修改和分发软件。
我该如何保持对代码库变更的更新?
您可以在 GitHub 上关注该代码库,以接收有关更新的通知,或者如果可用,可以在社交媒体平台上关注该项目。
我可以为该项目做贡献吗?
当然可以!欢迎贡献。请参考代码库中的贡献指南,以获取有关如何参与的更多信息。
详情
mcp-google-server A MCP Server for Google Custom Search and Webpage Reading
A Model Context Protocol server that provides web search capabilities using Google Custom Search API and webpage content extraction functionality.
Setup
Getting Google API Key and Search Engine ID
-
Create a Google Cloud Project:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable billing for your project
-
Enable Custom Search API:
- Go to API Library
- Search for "Custom Search API"
- Click "Enable"
-
Get API Key:
- Go to Credentials
- Click "Create Credentials" > "API Key"
- Copy your API key
- (Optional) Restrict the API key to only Custom Search API
-
Create Custom Search Engine:
- Go to Programmable Search Engine
- Enter the sites you want to search (use www.google.com for general web search)
- Click "Create"
- On the next page, click "Customize"
- In the settings, enable "Search the entire web"
- Copy your Search Engine ID (cx)
Development
Install dependencies:
npm install
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
Features
Search Tool
Perform web searches using Google Custom Search API:
- Search the entire web or specific sites
- Control number of results (1-10)
- Get structured results with title, link, and snippet
Webpage Reader Tool
Extract content from any webpage:
- Fetch and parse webpage content
- Extract page title and main text
- Clean content by removing scripts and styles
- Return structured data with title, text, and URL
Installation
Installing via Smithery
To install Google Custom Search Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @adenot/mcp-google-search --client claude
To use with Claude Desktop, add the server config with your Google API credentials:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"google-search": {
"command": "npx",
"args": [
"-y",
"@adenot/mcp-google-search"
],
"env": {
"GOOGLE_API_KEY": "your-api-key-here",
"GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id-here"
}
}
}
}
Usage
Search Tool
{
"name": "search",
"arguments": {
"query": "your search query",
"num": 5 // optional, default is 5, max is 10
}
}
Webpage Reader Tool
{
"name": "read_webpage",
"arguments": {
"url": "https://example.com"
}
}
Example response from webpage reader:
{
"title": "Example Domain",
"text": "Extracted and cleaned webpage content...",
"url": "https://example.com"
}
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
npm run inspector
The Inspector will provide a URL to access debugging tools in your browser.
Server配置
{
"mcpServers": {
"mcp-google-search": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--adenot--mcp-google-search--mcp-google-search",
"node ./build/index.js"
],
"env": {
"GOOGLE_API_KEY": "google-api-key",
"GOOGLE_SEARCH_ENGINE_ID": "google-search-engine-id"
}
}
}
}