这是一个用于谷歌可编程搜索引擎(PSE)API的模型上下文协议(MCP)服务器。该服务器提供了使用谷歌自定义搜索引擎进行网络搜索的工具,这些工具可被与MCP兼容的客户端(如VSCode、Copilot和Claude Desktop)访问。
你无需手动克隆此仓库或自行运行任何安装命令。只需将以下配置添加到相应的MCP客户端,客户端将根据需要自动安装并启动服务器。
打开命令面板 → 首选项:打开设置(JSON),然后添加以下内容:
settings.json
{
// 其他设置...
"mcp": {
"servers": {
"google-pse-mcp": {
"command": "npx",
"args": [
"-y",
"google-pse-mcp",
"https://www.googleapis.com/customsearch",
"" ,
""
]
}
}
}
}
如果你使用的是 Cline,请将以下内容添加到 cline_mcp_settings.json
(通常位于VSCode全局存储或Cline配置目录中):
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
{
"mcpServers": {
"google-pse-mcp": {
"disabled": false,
"timeout": 60,
"command": "npx",
"args": [
"-y",
"google-pse-mcp",
"https://www.googleapis.com/customsearch",
"" ,
""
],
"transportType": "stdio"
}
}
}
⚠️ 重要提示
别忘了在上述配置中用你的凭证替换
和
。
此MCP服务器提供以下工具:
search
:使用谷歌可编程搜索引擎进行网络搜索
q
(字符串,必需):搜索查询page
(整数,可选):页码size
(整数,可选):每页返回的搜索结果数量(1 - 10)sort
(字符串,可选):排序表达式(仅支持 'date')safe
(布尔值,可选):启用安全搜索过滤lr
(字符串,可选):将搜索限制在特定语言(例如,lang_en)siteRestricted
(布尔值,可选):使用站点限制API端点# 搜索 "人工智能"
result = await use_mcp_tool(
server_name="google-pse-mcp",
tool_name="search",
arguments={
"q": "artificial intelligence",
"size": 5,
"safe": True
}
)