Back to MCP directory
publicPublicdnsLocal runtime

google-pse-mcp

该项目是一个为Google可编程搜索引擎(PSE)API设计的MCP服务器,通过MCP协议向兼容客户端(如VSCode、Copilot等)提供网页搜索工具。

article

README

🚀 谷歌可编程搜索引擎(PSE)MCP服务器

这是一个用于谷歌可编程搜索引擎(PSE)API的模型上下文协议(MCP)服务器。该服务器提供了使用谷歌自定义搜索引擎进行网络搜索的工具,这些工具可被与MCP兼容的客户端(如VSCode、Copilot和Claude Desktop)访问。

🚀 快速开始

你无需手动克隆此仓库或自行运行任何安装命令。只需将以下配置添加到相应的MCP客户端,客户端将根据需要自动安装并启动服务器。

📦 安装指南

VS Code Copilot配置

打开命令面板 → 首选项:打开设置(JSON),然后添加以下内容:

settings.json

{
  // 其他设置...
  "mcp": {
    "servers": {
      "google-pse-mcp": {
        "command": "npx",
        "args": [
          "-y",
          "google-pse-mcp",
          "https://www.googleapis.com/customsearch",
          "<api_key>",
          "<cx>"
        ]
      }
    }
  }
}

Cline MCP配置示例

如果你使用的是 Cline,请将以下内容添加到 cline_mcp_settings.json(通常位于VSCode全局存储或Cline配置目录中):

  • macOS:~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  • Windows:%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",
        "<api_key>",
        "<cx>"
      ],
      "transportType": "stdio"
    }
  }
}

⚠️ 重要提示

别忘了在上述配置中用你的凭证替换 <api_key><cx>

✨ 主要特性

此MCP服务器提供以下工具:

  1. 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
    }
)

📚 详细文档

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client