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.
伺服器配置
{
"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"
}
}
}
}