谷歌搜索MCP服务器
一个全面的模型上下文协议(MCP)服务器,提供高级的谷歌自定义搜索功能、网络内容提取、搜索分析和专门的研究工具。该服务器将谷歌的搜索功能转化为强大的人工智能工具,可以与任何兼容MCP的人工智能客户端集成。
目录
- 环境变量 - 获取Google API凭据 - 安全最佳实践
- 1.谷歌搜索(google_search) - 2.提取内容(extract_content) - 3.搜索分析(search_analytics) - 4.多站点搜索(multi_site_search) - 5.新闻监视器(news_monitor) - 6.学术搜索(academic_search) - 7.内容摘要生成器(content_summarizer) - 8.事实核查员(fact_checker) - 9.研究助理(research_assistant) - 10.搜索趋势(search_trends)
- 开发命令 - 项目结构 - 技术细节 - 错误处理 - 性能特点
特性
- 高级谷歌搜索:使用广泛的过滤选项、文件类型限制和地理定位进行网络搜索
- 内容提取:通过自动情感分析从网页中提取主要内容
- 搜索分析:通过全面的见解和关键字提取分析多个查询的搜索趋势
- 多站点搜索:使用详细统计数据同时搜索多个网站
- 新闻监测:通过主题过滤和日期限制监控新闻来源
- 学术研究:查找学术论文和研究文件的专用工具
- 内容概述:通过情感分析和见解对多个网址进行智能摘要
- 事实核查:基于循证结果的自动事实核查
- 搜索趋势:实时搜索兴趣分析和趋势预测
- 缓存资源:8个专门的资源,提供缓存的搜索结果、分析和研究数据
- MCP兼容:与任何兼容MCP的AI客户端(Claude、Cursor等)无缝集成
- 稳健的错误处理:针对API故障、速率限制和无效参数的全面错误处理
- 智能高速缓存:基于TTL的缓存系统优化性能和API使用
- TypeScript:所有参数均已完全键入Zod模式验证
先决条件
- Node.js 18+
- Google自定义搜索API密钥
- 谷歌自定义搜索引擎ID
安装
- 克隆此存储库:
git clone https://github.com/1999AZZAR/mcp-server-google-search.git
cd mcp-server-google-search- 安装依赖项:
npm install- 构建项目:
npm run build- 验证安装:
# Test that the server starts correctly
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | GOOGLE_API_KEY=test GOOGLE_CSE_ID=test node dist/index.js配置
环境变量
创建 .env 项目根目录中的文件,包含以下变量:
GOOGLE_API_KEY=your_google_api_key_here
GOOGLE_CSE_ID=your_custom_search_engine_id_here获取Google API凭据
步骤1:谷歌云控制台设置
- 转到 谷歌云控制台
- 创建新项目或选择现有项目
- 启用API库中的“自定义搜索API”
- 转到“凭据”→ “创建凭据”→ “API密钥”
- 复制API密钥
步骤2:自定义搜索引擎设置
- 首选 自定义搜索引擎
- 点击“添加”以创建新的搜索引擎
- 输入要搜索的网站(或整个网站留空)
- 为您的搜索引擎命名
- 点击“创建”
- 转到“设置”→ “基础知识”并复制您的“搜索引擎ID”
步骤3:配置搜索引擎(可选)
- 搜索整个网络:将“要搜索的网站”留空
- 搜索特定网站:添加域,如
github.com,stackoverflow.com - 高级设置:配置语言、地区和其他首选项
安全最佳实践
- 永远不要承诺你的
.env文件到版本控制 - 在生产中使用环境变量
- 考虑将Google Cloud Secret Manager用于生产部署
- 如果可能,将API密钥限制为特定的IP地址
用法
作为MCP服务器
用于游标IDE
将此服务器添加到您的Cursor MCP配置中(~/.cursor/mcp.json):
{
"mcpServers": {
"google-search-mcp": {
"command": "node",
"args": ["/path/to/mcp-server-google-search/dist/index.js"],
"env": {
"GOOGLE_API_KEY": "your_api_key",
"GOOGLE_CSE_ID": "your_cse_id"
}
}
}
}适用于克劳德桌面
将此服务器添加到您的Claude Desktop配置中(claude_desktop_config.json):
{
"mcpServers": {
"google-search-mcp": {
"command": "node",
"args": ["/path/to/mcp-server-google-search/dist/index.js"],
"env": {
"GOOGLE_API_KEY": "your_api_key",
"GOOGLE_CSE_ID": "your_cse_id"
}
}
}
}对于其他MCP客户端
服务器遵循标准MCP协议,应与任何兼容MCP的客户端一起工作。有关配置详细信息,请参阅客户的文档。
测试服务器
您可以使用JSON-RPC命令直接测试服务器:
# List all available tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | GOOGLE_API_KEY=your_key GOOGLE_CSE_ID=your_id node dist/index.js
# Test a search
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"google_search","arguments":{"q":"test search","num":2}}}' | GOOGLE_API_KEY=your_key GOOGLE_CSE_ID=your_id node dist/index.js可用工具
此MCP服务器提供 10个强大的工具 用于全面搜索、研究、事实验证、趋势分析和高级研究协助:
1.谷歌搜索(google_search)
使用广泛的过滤选项和地理定位进行高级网络搜索。
参数:
q(必填):搜索查询字符串fileType(可选):文件类型过滤器-“pdf”、“doc”、“docx”、“ppt”、“pptx”、“xls”、“xlsx”、“rtf”siteSearch(可选):在特定网站内搜索(例如“example.com”)dateRestrict(可选):日期限制-“d1”、“w1”、“m1”、“y1”、“d7”、“w2”、“m2”、“y2”、“m6”、“y”safe(可选):安全搜索级别-“活动”、“关闭”exactTerms(可选):必须完全按照指定显示的术语excludeTerms(可选):要从搜索结果中排除的术语sort(可选):排序顺序-“日期”gl(可选):地理位置的国家代码(例如,“us”、“uk”)hl(可选):接口的语言代码(例如“en”、“es”)num(可选):要返回的结果数(1-10)start(可选):结果的起始索引(从1开始)
使用案例:
- 具有高级过滤功能的常规网络搜索
- 查找特定文件类型(PDF、文档)
- 在特定网站内搜索
- 对最近内容的限时搜索
例子:
{
"name": "google_search",
"arguments": {
"q": "artificial intelligence",
"num": 5,
"fileType": "pdf",
"dateRestrict": "m1"
}
}响应格式:
{
"searchInfo": {
"totalResults": "8420000",
"searchTime": 0.626612,
"formattedSearchTime": "0.63"
},
"items": [
{
"title": "Article Title",
"link": "https://example.com/article",
"snippet": "Article preview...",
"displayLink": "example.com",
"formattedUrl": "https://example.com/article"
}
]
}2.提取内容(extract_content)
从网页中提取主要内容,并使用高级文本处理进行自动情感分析。
参数:
url(必填):从中提取内容的网页的URL
使用案例:
- 总结文章和博客文章
- 分析新闻文章或评论的情绪
- 从网页中提取干净的文本
- 用于研究目的的内容分析
例子:
{
"name": "extract_content",
"arguments": {
"url": "https://example.com/article"
}
}响应格式:
{
"url": "https://example.com/article",
"title": "Article Title",
"content": "Extracted main content...",
"wordCount": 1250,
"sentiment": {
"score": 0.8,
"comparative": 0.15,
"positive": 0.75,
"negative": 0.25,
"neutral": 0.0
},
"summary": "Brief summary of the content..."
}3.搜索分析(search_analytics)
使用全面的见解、关键字提取和性能指标分析多个查询的搜索趋势。
参数:
queries(必填):要分析的搜索查询数组(1-5个查询)timeRange(可选):趋势分析的时间范围-“周”、“月”、“年”maxResults(可选):每次查询的最大结果数(1-5)
使用案例:
- 市场调研和趋势分析
- SEO关键词研究
- 竞品分析
- 内容战略规划
- 品牌监控
例子:
{
"name": "search_analytics",
"arguments": {
"queries": ["artificial intelligence", "machine learning", "deep learning"],
"timeRange": "month",
"maxResults": 3
}
}响应格式:
{
"queries": ["artificial intelligence", "machine learning", "deep learning"],
"timeRange": "month",
"results": [
{
"query": "artificial intelligence",
"resultCount": 1600000000,
"items": [...]
}
],
"summary": {
"totalResults": 7060000000,
"averageResults": 2353333333.33,
"topPerformingQuery": "deep learning",
"commonKeywords": ["learning", "artificial", "intelligence", "machine", "deep"]
}
}4.多站点搜索(multi_site_search)
通过详细的统计数据和全面的结果聚合同时搜索多个特定网站。
参数:
query(必填):搜索查询sites(必填):要搜索的网站数组(1-5个网站)maxResults(可选):每个站点的最大结果(1-5)fileType(可选):要搜索的文件类型
使用案例:
- 跨平台研究(GitHub、Stack Overflow、Medium)
- 跨多个站点的竞争分析
- 在特定平台上查找资源
- 从可信来源聚合信息
例子:
{
"name": "multi_site_search",
"arguments": {
"query": "react tutorial",
"sites": ["github.com", "stackoverflow.com", "dev.to"],
"maxResults": 3
}
}响应格式:
{
"query": "react tutorial",
"sites": ["github.com", "stackoverflow.com", "dev.to"],
"results": [
{
"site": "github.com",
"resultCount": 2,
"totalAvailable": 19800,
"items": [...]
}
],
"summary": {
"totalResults": 6,
"sitesSearched": 3,
"successfulSearches": 3
}
}5.新闻监视器(news_monitor)
通过高级过滤、源定位和实时新闻情报的日期限制来监控特定主题的新闻源。
参数:
topic(必填):要监控的主题sources(可选):要监视的新闻源数组(例如\[“bbc.com”、“cnn.com”、“reuters.com”\])language(可选):语言代码(例如“en”、“es”)country(可选):国家代码(例如“us”、“uk”)maxResults(可选):返回的最大结果(1-10)dateRestrict(可选):新闻的日期限制-“d1”、“d7”、“m1”、“m6”、“y1”
使用案例:
- 实时新闻监控
- 品牌和声誉管理
- 危机沟通监控
- 行业趋势追踪
- 竞争情报
例子:
{
"name": "news_monitor",
"arguments": {
"topic": "artificial intelligence breakthrough",
"sources": ["bbc.com", "cnn.com", "reuters.com"],
"dateRestrict": "d7",
"maxResults": 5
}
}响应格式:
{
"topic": "artificial intelligence breakthrough",
"sources": ["bbc.com", "cnn.com", "reuters.com"],
"language": "en",
"country": "us",
"dateRestrict": "d7",
"results": [
{
"source": "bbc.com",
"articles": [...]
}
],
"summary": {
"totalArticles": 15,
"sourcesFound": 3,
"dateRange": "d7"
}
}6.学术搜索(academic_search)
使用PDF过滤和出版日期限制从专业学术来源搜索学术论文和研究文档。
参数:
query(必填):研究查询fileType(可选):文件类型(仅限PDF)-“PDF”dateRange(可选):发布日期范围-“d1”、“d7”、“m1”、“m6”、“y1”、“y2”sites(可选):要搜索的学术网站(默认:\[“arxiv.org”,“scholar.google.com”,“researchgate.net”\])maxResults(可选):返回的最大结果(1-10)
使用案例:
- 学术研究和文献综述
- 查找最近的研究论文
- 博士和论文研究
- 科学文献分析
- 研究趋势监测
例子:
{
"name": "academic_search",
"arguments": {
"query": "machine learning algorithms neural networks",
"fileType": "pdf",
"dateRange": "y1",
"sites": ["arxiv.org", "scholar.google.com"],
"maxResults": 5
}
}响应格式:
{
"query": "machine learning algorithms neural networks",
"fileType": "pdf",
"dateRange": "y1",
"sites": ["arxiv.org", "scholar.google.com"],
"results": [
{
"site": "arxiv.org",
"paperCount": 3,
"totalAvailable": 18800,
"papers": [
{
"title": "A Digital Machine Learning Algorithm Simulating Spiking Neural Networks",
"link": "https://arxiv.org/pdf/2503.17111",
"snippet": "During last several years, our research team worked on development of a spiking neural network...",
"mime": "application/pdf",
"fileFormat": "PDF/Adobe Acrobat"
}
]
}
],
"summary": {
"totalPapers": 3,
"sitesSearched": 2,
"successfulSearches": 2,
"dateRange": "y1"
}
}7.内容摘要生成器(content_summarizer)
通过智能摘要、情感分析和全面见解从多个URL中提取和总结内容。
参数:
urls(必填):要汇总的URL数组(1-10个URL)maxLength(可选):每个URL的摘要最大长度(50-500,默认值:200)includeSentiment(可选):包括每个URL的情感分析(默认值:true)focusAreas(可选):总结中要关注的具体领域(例如,\[“关键点”、“结论”、“数据”\])generateOverallSummary(可选):生成一个包含所有URL的总体摘要(默认值:true)
使用案例:
- 跨多个来源的研究总结
- 内容分析与比较
- 新闻聚合与分析
- 学术论文综述
- 竞争情报收集
- 内容策划和见解
例子:
{
"name": "content_summarizer",
"arguments": {
"urls": [
"https://example.com/article1",
"https://example.com/article2",
"https://example.com/article3"
],
"maxLength": 150,
"includeSentiment": true,
"focusAreas": ["key insights", "conclusions", "data"],
"generateOverallSummary": true
}
}响应格式:
{
"urls": ["https://example.com/article1", "https://example.com/article2"],
"maxLength": 150,
"includeSentiment": true,
"focusAreas": ["key insights", "conclusions"],
"generateOverallSummary": true,
"summaries": [
{
"url": "https://example.com/article1",
"title": "Article Title",
"summary": "Key insights from the article...",
"wordCount": 1250,
"sentiment": {
"score": 0.8,
"comparative": 0.15,
"positive": ["excellent", "innovative"],
"negative": ["challenging"]
},
"extractionTime": "2024-01-15T10:30:00.000Z"
}
],
"overallSummary": "Combined insights from all articles...",
"statistics": {
"totalUrls": 2,
"successfulExtractions": 2,
"failedExtractions": 0,
"averageWordCount": 1250,
"sentimentDistribution": {
"positive": 1,
"negative": 0,
"neutral": 1
}
}
}8.事实核查员(fact_checker)
通过可信度分析和证据提取搜索多个权威来源来验证索赔。
参数:
claim(必填):需核实的索赔或声明(至少10个字符)sources(可选):要检查的特定权威来源(例如,\[“wikipedia.org”,“bbc.com”,“reuters.com”\])confidenceThreshold(可选):验证的最低置信水平(0.0-1.0,默认值:0.7)timeframe(可选):搜索结果的时间范围-“d1”、“d7”、“m1”、“m6”、“y1”、“y2”(默认值:“y1”)maxResults(可选):每个源的最大结果(1-5,默认值:3)includeEvidence(可选):包括提取的证据片段(默认值:true)
默认来源:
- 维基百科、bbc.com、路透社、ap.org
- factcheck.org、snopes.com、politifact.com
- scholar.coogle.com、pubmed.ncbi.nlm.nih.gov、nature.com
使用案例:
- 事实核查和揭穿错误信息
- 跨多个来源的研究验证
- 新闻验证和可信度评估
- 学术索赔核实
- 公开声明事实核查
- 科学索赔验证
例子:
{
"name": "fact_checker",
"arguments": {
"claim": "The Earth is approximately 4.5 billion years old",
"sources": ["wikipedia.org", "science.org", "nature.com"],
"confidenceThreshold": 0.8,
"timeframe": "y1",
"maxResults": 2,
"includeEvidence": true
}
}响应格式:
{
"claim": "The Earth is approximately 4.5 billion years old",
"sourcesToCheck": ["wikipedia.org", "science.org", "nature.com"],
"confidenceThreshold": 0.8,
"timeframe": "y1",
"maxResults": 2,
"includeEvidence": true,
"verification": {
"status": "verified",
"confidence": 0.85,
"evidenceCount": 4,
"supportingSources": ["wikipedia.org", "science.org"],
"disputingSources": [],
"neutralSources": ["nature.com"]
},
"sources": [
{
"source": "wikipedia.org",
"resultCount": 2,
"totalAvailable": "3700",
"results": [
{
"title": "Age of Earth - Wikipedia",
"link": "https://en.wikipedia.org/wiki/Age_of_Earth",
"snippet": "The age of Earth is estimated to be 4.54 ± 0.05 billion years...",
"displayLink": "en.wikipedia.org",
"relevanceScore": 0.8
}
],
"credibilityScore": 0.8
}
],
"evidence": [
{
"source": "wikipedia.org",
"url": "https://en.wikipedia.org/wiki/Age_of_Earth",
"title": "Age of Earth - Wikipedia",
"evidence": "The age of Earth is estimated to be 4.54 ± 0.05 billion years. This age represents the final stages of Earth's accretion and planetary differentiation.",
"relevanceScore": 0.8,
"sentiment": {
"score": 0,
"comparative": 0
}
}
],
"statistics": {
"totalSourcesChecked": 3,
"successfulSearches": 3,
"failedSearches": 0,
"totalResults": 6,
"averageRelevanceScore": 0.75
}
}验证状态:
verified:这一说法得到了具有高度信心的可靠消息来源的支持disputed:这一说法与可靠消息来源相矛盾unverified:证据不足或信息相互矛盾unknown:未找到相关信息
9.研究助理(research_assistant)
10.搜索趋势(search_trends)
通过预测性见解和新兴主题发现,跟踪和分析搜索兴趣随时间的变化趋势。该工具通过将当前搜索数据与历史模式相结合,提供全面的趋势分析,以识别新兴主题并预测未来的兴趣水平。
参数:
topics(必填):跟踪趋势的主题数组(1-5个主题)timeframe(可选):分析时间段('1M'、'3M'、'6M'、'1Y'、'2Y')-默认为'6M'region(可选):用于趋势分析的地理区域(国家代码如“US”、“GB”、“CA”)-默认为“US”category(可选):用于更有针对性的趋势分析的类别过滤器(“全部”、“商业”、“娱乐”、“健康”、“政治”、“科学”、“体育”、“技术”)-默认为“全部”includePredictions(可选):包括趋势预测和预测-默认为truerelatedTopics(可选):发现并包含相关的趋势主题-默认为true
使用案例:
- 市场调研和趋势分析
- 内容策略和主题规划
- 竞争分析和市场情报
- 新兴技术跟踪
- 品牌监测和声誉管理
- 季节趋势分析
- 预测性内容规划
例子:
{
"name": "search_trends",
"arguments": {
"topics": ["artificial intelligence", "machine learning"],
"timeframe": "6M",
"region": "US",
"category": "technology",
"includePredictions": true,
"relatedTopics": true
}
}响应格式:
{
"topics": ["artificial intelligence", "machine learning"],
"timeframe": "6M",
"region": "US",
"category": "technology",
"includePredictions": true,
"relatedTopics": true,
"trends": [
{
"topic": "artificial intelligence",
"currentInterest": 245000000,
"recentActivity": 3,
"trendDirection": "increasing",
"changePercent": 12.45,
"peakPeriod": "Month 5",
"data": [65, 68, 72, 75, 78, 80, 82, 85, 87, 89, 91, 93, 94, 95, 96, 97, 98, 98, 99, 99, 100, 99, 98, 97]
}
],
"relatedTopics": [
{
"topic": "artificial intelligence",
"relatedTopics": ["neural", "networks", "deep", "learning", "automation"]
}
],
"predictions": [
{
"topic": "artificial intelligence",
"prediction": "artificial intelligence shows increasing interest. Expected to continue growing by 18.45% in the next period.",
"confidence": 0.75,
"timeframe": "next period",
"factors": [
"Current market trends",
"Seasonal patterns",
"Related topic performance",
"Search volume patterns"
]
}
],
"timestamp": "2025-11-02T17:04:02.839Z"
}9.研究助理(research_assistant)
具有多步骤工作流程、源综合和结构化报告生成功能的综合研究助理。
参数:
researchTopic(必填):要调查的主要研究主题或问题(至少10个字符)researchType(可选):要进行的研究类型-“学术”、“新闻”、“事实”、“综合”(默认:“综合”)depth(可选):研究深度级别-“快速”、“标准”、“深度”(默认:“标准”)sources(可选):研究中包含的具体来源(最多15个来源)excludeSources(可选):从研究中排除的来源(最多10个来源)timeframe(可选):研究结果的时间范围-“d1”、“d7”、“m1”、“m6”、“y1”、“y2”(默认值:“y1”)maxSourcesPerType(可选):每种源类型的最大源(2-8,默认值:5)includeCitations(可选):包括详细的引用和来源跟踪(默认值:true)generateReport(可选):生成结构化研究报告(默认值:true)focusAreas(可选):重点研究的具体领域(例如,\[“方法论”、“研究结果”、“影响”\])
研究类型和来源类别:
- 学术的:学术期刊、教育机构、研究资料库
- 新闻:新闻来源、事实核查人员、国际媒体
- 事实的:政府来源、科学机构、参考资料
- 全面的:用于深入研究的所有源类型
使用案例:
- 学术研究和文献综述
- 市场调研和竞争分析
- 政策研究和政府分析
- 科学研究和证据综合
- 商业智能和战略规划
- 新闻分析和媒体监控
- 事实核查和验证工作流程
例子:
{
"name": "research_assistant",
"arguments": {
"researchTopic": "artificial intelligence impact on healthcare",
"researchType": "comprehensive",
"depth": "standard",
"maxSourcesPerType": 3,
"focusAreas": ["methodology", "findings", "implications"],
"includeCitations": true,
"generateReport": true,
"timeframe": "y1"
}
}响应格式:
{
"researchTopic": "artificial intelligence impact on healthcare",
"researchType": "comprehensive",
"depth": "standard",
"timeframe": "y1",
"maxSourcesPerType": 3,
"includeCitations": true,
"generateReport": true,
"focusAreas": ["methodology", "findings", "implications"],
"researchWorkflow": {
"phase": "completed",
"stepsCompleted": 5,
"totalSteps": 5,
"currentStep": "Research completed"
},
"sourceCategories": ["Academic", "News", "Government", "Reference", "Specialized"],
"findings": [
{
"source": "nature.com",
"category": "Academic",
"url": "https://example.com/article",
"title": "AI in Healthcare Research",
"content": "Full extracted content...",
"wordCount": 1250,
"sentiment": {
"score": 0.8,
"comparative": 0.15
},
"relevanceScore": 0.9,
"keyInsights": ["AI shows promise in diagnostic accuracy", "Implementation challenges remain"],
"focusAnalysis": {
"methodology": ["Randomized controlled trials", "Machine learning algorithms"],
"findings": ["Improved diagnostic accuracy by 15%", "Reduced false positives"],
"implications": ["Potential for widespread adoption", "Need for regulatory framework"]
},
"contentQualityScore": 0.85,
"extractionTime": "2024-01-15T10:30:00.000Z"
}
],
"sources": [
{
"source": "nature.com",
"category": "Academic",
"resultCount": 3,
"totalAvailable": "150",
"results": [
{
"title": "AI in Healthcare Research",
"link": "https://example.com/article",
"snippet": "Artificial intelligence is transforming healthcare...",
"displayLink": "nature.com",
"relevanceScore": 0.9
}
],
"credibilityScore": 0.9
}
],
"citations": [
{
"title": "AI in Healthcare Research",
"url": "https://example.com/article",
"source": "nature.com",
"category": "Academic",
"credibilityScore": 0.9,
"relevanceScore": 0.9,
"accessedDate": "2024-01-15T10:30:00.000Z"
}
],
"synthesis": {
"keyFindings": [
"AI demonstrates significant potential in healthcare diagnostics",
"Implementation faces regulatory and technical challenges",
"Patient outcomes show measurable improvement with AI assistance"
],
"conflictingInformation": [],
"consensusPoints": [
"AI technology shows promise in healthcare applications",
"Regulatory frameworks need development for safe implementation"
],
"gapsInKnowledge": [
"Long-term impact studies are limited",
"Cost-benefit analysis needs more research"
],
"confidenceLevel": 0.85
},
"report": {
"title": "Research Report: artificial intelligence impact on healthcare",
"executiveSummary": "This research analyzed 15 sources across 5 categories...",
"methodology": "Research methodology involved systematic search...",
"findings": "Key findings from the research:\n1. AI shows promise...",
"synthesis": "Synthesis of findings reveals 2 consensus points...",
"recommendations": "High confidence in findings. Recommendations can be made...",
"limitations": "Research limitations include: limited to publicly available sources...",
"citations": [...],
"metadata": {
"generatedAt": "2024-01-15T10:30:00.000Z",
"researchType": "comprehensive",
"depth": "standard",
"totalSources": 15,
"confidenceLevel": 0.85,
"qualityScore": 0.82
}
},
"statistics": {
"totalSourcesSearched": 15,
"successfulSearches": 14,
"failedSearches": 1,
"totalResults": 45,
"averageCredibilityScore": 0.87,
"researchQualityScore": 0.82
}
}研究工作流程阶段:
- 多源研究:对分类来源进行系统搜索
- 内容分析:提取、情绪分析和重点领域分析
- 合成:交叉参考分析和共识识别
- 引文管理:自动生成和跟踪引文
- 报告生成:带执行摘要的结构化研究报告
质量指标:
- 研究质量评分:基于来源多样性、可信度和调查结果质量的综合评分
- 置信水平:基于来源协议对研究结果的总体信心
- 来源多样性:包括的不同来源类别的数量
- 内容质量:评估提取内容的相关性和深度
可用资源
谷歌搜索MCP服务器提供 8专业资源 通过智能缓存提供缓存的搜索结果、趋势分析和研究数据,以实现最佳性能:
google://search/cache/{query}
返回包含元数据和时间戳的查询的缓存谷歌搜索结果。
资源详细信息:
- 目的:在不调用API的情况下访问最近缓存的搜索结果
- 好处:更快的响应时间,减少了API的使用,最近搜索的离线功能
- 缓存TTL:5分钟-平衡新鲜度和性能
- 用例:经常访问的搜索词、监控查询、开发测试
响应格式:
{
"query": "artificial intelligence",
"results": [
{
"title": "Artificial Intelligence - Wikipedia",
"link": "https://en.wikipedia.org/wiki/Artificial_intelligence",
"snippet": "Artificial intelligence (AI) is intelligence demonstrated by machines..."
}
],
"searchTime": "0.25",
"totalResults": "about 2,450,000,000",
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}google://search/trends/{topic}
提供随时间推移的主题搜索兴趣趋势和预测。
资源详细信息:
- 目的:分析搜索兴趣模式并预测趋势
- 好处:市场调研、内容策略、趋势识别
- 缓存TTL:5分钟-保持趋势数据合理更新
- 用例:SEO分析、内容策划、市场调研
响应格式:
{
"topic": "machine learning",
"trends": {
"interest": [25, 30, 45, 60, 55, 70],
"timeframe": "6M",
"region": "US",
"predictions": [75, 80, 85]
},
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}google://search/analytics/{query}
提供全面的搜索分析,包括多个结果和模式。
资源详细信息:
- 目的:对搜索结果和模式进行深入分析
- 好处:全面的搜索智能和模式识别
- 缓存TTL:5分钟-确保分析数据保持相关性
- 用例:竞争分析、关键词研究、内容优化
响应格式:
{
"query": "renewable energy",
"analytics": {
"totalResults": 1250000,
"topDomains": ["wikipedia.org", "energy.gov", "iea.org"],
"contentTypes": ["educational": 45, "commercial": 30, "news": 25],
"sentiment": {"positive": 0.6, "neutral": 0.3, "negative": 0.1}
},
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}google://content/extracted/{url}
为缓存的提取内容提供来自网页的情感分析。
资源详细信息:
- 目的:无需重新提取即可访问已处理的web内容
- 好处:更快的内容分析,减少处理开销
- 缓存TTL:5分钟-平衡内容新鲜度和性能
- 用例:内容监控、情感分析、数据提取
响应格式:
{
"url": "https://example.com/article",
"content": {
"title": "Article Title",
"text": "Full article content...",
"wordCount": 1250,
"sentiment": {
"score": 0.3,
"comparative": 0.024,
"tokens": ["article", "content", "analysis"],
"words": ["good", "excellent"],
"positive": ["good", "excellent"],
"negative": []
},
"readability": 72.5
},
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}google://news/recent/{topic}
提供最近的新闻文章,并对主题进行可信度分析。
资源详细信息:
- 目的:通过质量过滤访问最新新闻
- 好处:具有可信度评分的时间敏感信息
- 缓存TTL:2分钟-确保新闻保持最新
- 用例:新闻监测、危机管理、时事跟踪
响应格式:
{
"topic": "climate change",
"news": {
"articles": [
{
"title": "New Climate Report Released",
"source": "reuters.com",
"credibility": 0.95,
"published": "2025-11-02T15:30:00Z",
"summary": "Latest IPCC report details..."
}
],
"totalArticles": 15,
"avgCredibility": 0.87
},
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}google://academic/results/{query}
提供缓存的学术论文和研究文档。
资源详细信息:
- 目的:无需重复搜索即可访问学术研究
- 好处:加快学术研究,减少API用于研究查询的使用
- 缓存TTL:30分钟-学术内容更改频率较低
- 用例:文献综述、研究规划、学术写作
响应格式:
{
"query": "quantum computing",
"results": {
"papers": [
{
"title": "Advances in Quantum Computing",
"authors": ["Dr. Jane Smith", "Dr. John Doe"],
"journal": "Nature Physics",
"year": 2025,
"citations": 45,
"doi": "10.1038/s41567-025-01234-5"
}
],
"totalPapers": 1250,
"disciplines": ["Physics", "Computer Science", "Mathematics"]
},
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}google://research/summary/{topic}
提供全面的研究总结,包括来源和分析。
资源详细信息:
- 目的:无需再处理即可获得完整的研究综述
- 好处:深入的研究见解和全面的分析
- 缓存TTL:1小时-研究总结在较长时间内保持稳定
- 用例:执行摘要、研究报告、战略规划
响应格式:
{
"topic": "blockchain technology",
"summary": {
"executiveSummary": "Blockchain technology continues to evolve...",
"keyFindings": [
"Decentralized consensus mechanisms improving",
"Enterprise adoption accelerating",
"Regulatory frameworks emerging"
],
"sourcesAnalyzed": 25,
"confidenceLevel": 0.89,
"methodology": "Multi-source analysis with peer review"
},
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}google://fact/check/{claim}
提供事实验证结果和支持证据。
资源详细信息:
- 目的:获取索赔的事实核查结果
- 好处:通过证据追踪进行可靠的事实核查
- 缓存TTL:24小时-事实不会经常改变
- 用例:内容验证、新闻报道、教育事实核查
响应格式:
{
"claim": "The Earth is flat",
"verification": {
"verdict": "False",
"confidence": 1.0,
"evidence": [
{
"source": "NASA Scientific Consensus",
"type": "Scientific Evidence",
"strength": "Overwhelming",
"summary": "Multiple independent measurements confirm spherical Earth"
}
],
"lastUpdated": "2025-11-01T10:00:00Z"
},
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}发展
开发命令
# Install dependencies
npm install
# Run in development mode with hot reload
npm run dev
# Build the project
npm run build
# Run tests
npm test
# Run linting
npm run lint
# Start production server
npm start项目结构
mcp-server-google-search/
├── dist/ # Compiled JavaScript output
├── __tests__/ # Test files
│ └── mcp-server.test.ts # MCP server tests
├── config.ts # Configuration and environment variables
├── index.ts # Main entry point
├── mcp-server.ts # MCP server implementation with all 6 tools
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── jest.config.js # Jest testing configuration
├── global.d.ts # TypeScript declarations
├── .env.example # Environment variables template
├── example-config.json # MCP configuration example
├── README.md # This comprehensive documentation
└── LICENSE # MIT License技术细节
- 语言:带有ES模块的TypeScript
- 运行时:Node.js 18+
- 协议:模型上下文协议(MCP)
- 验证:所有参数的Zod模式
- HTTP客户端:适用于API请求的Axios
- HTML解析:Cheerio用于内容提取
- 情感分析:情感库
- 测试:支持TypeScript的Jest
错误处理
该服务器包括全面的错误处理功能,用于:
- API身份验证:无效的Google API凭据
- 网络问题:超时、连接失败、速率限制
- 参数验证:无效的搜索参数和格式错误的请求
- 内容提取:网页解析和提取失败
- 速率限制:超过Google API配额
- 格式错误的URL:内容提取的URL无效
性能特点
- 并发请求:多站点搜索的并行处理
- 错误恢复:当单个源发生故障时,性能会下降
- 响应缓存:高效的结果汇总和统计
- 内存管理:针对长时间运行的MCP服务器进程进行了优化
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
贡献
我们欢迎捐款!以下是您可以提供帮助的方式:
- 分叉存储库 上
- 创建要素分支:
git checkout -b feature/amazing-feature - 进行更改 并在适用的情况下添加测试
- 运行测试套件:
npm test - 提交您的更改:
git commit -m 'Add amazing feature' - 推到分支:
git push origin feature/amazing-feature - 打开拉取请求 在GitHub上
贡献领域
- 新工具:为特定域添加专门的搜索工具
- 增强分析:改进搜索分析和趋势分析
- 演出:优化API调用和响应时间
- 文档:改进示例和用例
- 测试:增加更全面的测试覆盖率
- 错误处理:增强错误消息和恢复
支持
获取帮助
- GitHub问题: 打开一个问题 对于bug或功能请求
- 讨论:使用GitHub讨论来回答问题和社区支持
- 文档:查看此README以获取全面的使用示例
常见问题
- API关键问题:确保您的Google API密钥有效并且启用了自定义搜索API
- CSE ID问题:验证您的自定义搜索引擎ID是否正确
- 速率限制:Google API有每日配额-在Google云控制台中检查您的使用情况
- MCP客户端问题:配置更改后重新启动MCP客户端
实用链接
______________________________________________________________________
关于
这款MCP服务器将谷歌强大的搜索功能转化为智能人工智能工具,实现了与现代人工智能助手的无缝集成。它基于TypeScript构建,遵循MCP标准,为搜索驱动的AI应用程序提供了坚实的基础。
仓库:
由...创建: 1999AZZAR
许可证:MIT
______________________________________________________________________
*致力于AI社区*

