Skip to main content
Glama

SerpMCP

PyPI version PyPI downloads Python 3.10+ License: MIT MCP

一个用于 Google 搜索的 模型上下文协议 (MCP) 服务器,通过 AceDataCloud API 使用 SERP API

直接从 Claude、VS Code 或任何兼容 MCP 的客户端执行 Google 搜索并获取结构化结果。

功能

  • 网页搜索 - 带有结构化结果的常规 Google 网页搜索

  • 图片搜索 - 搜索带有 URL 和缩略图的图片

  • 新闻搜索 - 获取关于任何主题的最新新闻文章

  • 视频搜索 - 查找来自 YouTube 和其他来源的视频

  • 地点搜索 - 搜索本地企业和地点

  • 地图搜索 - 查找位置和地理信息

  • 知识图谱 - 获取结构化的实体信息

  • 本地化 - 支持多个国家和语言

  • 时间过滤 - 按时间范围过滤结果

工具参考

工具

描述

serp_google_search

搜索 Google 并使用 SERP API 获取结构化结果。

serp_google_images

搜索 Google 图片并获取图片结果。

serp_google_news

搜索 Google 新闻并获取新闻文章结果。

serp_google_videos

搜索 Google 视频并获取视频结果。

serp_google_places

在 Google 上搜索本地地点和企业。

serp_google_maps

在 Google 地图上搜索位置。

serp_list_search_types

列出所有可用的 Google 搜索类型。

serp_list_countries

列出 Google 搜索常用的国家代码。

serp_list_languages

列出 Google 搜索常用的语言代码。

serp_list_time_ranges

列出 Google 搜索可用的时间范围过滤器。

serp_get_usage_guide

获取使用 Google SERP 工具的综合指南。

快速入门

1. 获取您的 API 令牌

  1. AceDataCloud 平台 注册

  2. 前往 API 文档页面

  3. 点击 “Acquire” 获取您的 API 令牌

  4. 复制令牌以供下方使用

2. 使用托管服务器(推荐)

AceDataCloud 托管了一个受管理的 MCP 服务器 —— 无需本地安装

端点: https://serp.mcp.acedata.cloud/mcp

所有请求都需要 Bearer 令牌。请使用第 1 步中的 API 令牌。

Claude.ai

通过 OAuth 直接在 Claude.ai 上连接 —— 无需 API 令牌

  1. 前往 Claude.ai 设置 → 集成 → 添加更多

  2. 输入服务器 URL:https://serp.mcp.acedata.cloud/mcp

  3. 完成 OAuth 登录流程

  4. 开始在对话中使用这些工具

Claude Desktop

添加到您的配置中(macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "serp": {
      "type": "streamable-http",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Cursor / Windsurf

添加到您的 MCP 配置中(.cursor/mcp.json.windsurf/mcp.json):

{
  "mcpServers": {
    "serp": {
      "type": "streamable-http",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

VS Code (Copilot)

添加到您的 VS Code MCP 配置中(.vscode/mcp.json):

{
  "servers": {
    "serp": {
      "type": "streamable-http",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

或者为 VS Code 安装 Ace Data Cloud MCP 扩展,它一键捆绑了所有 15 个 MCP 服务器。

JetBrains IDEs

  1. 前往 设置 → 工具 → AI Assistant → 模型上下文协议 (MCP)

  2. 点击 添加HTTP

  3. 粘贴:

{
  "mcpServers": {
    "serp": {
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Claude Code

Claude Code 原生支持 MCP 服务器:

claude mcp add serp --transport http https://serp.mcp.acedata.cloud/mcp \
  -h "Authorization: Bearer YOUR_API_TOKEN"

或者添加到您项目的 .mcp.json 中:

{
  "mcpServers": {
    "serp": {
      "type": "streamable-http",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Cline

添加到 Cline 的 MCP 设置中(.cline/mcp_settings.json):

{
  "mcpServers": {
    "serp": {
      "type": "streamable-http",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Amazon Q Developer

添加到您的 MCP 配置中:

{
  "mcpServers": {
    "serp": {
      "type": "streamable-http",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Roo Code

添加到 Roo Code MCP 设置中:

{
  "mcpServers": {
    "serp": {
      "type": "streamable-http",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Continue.dev

添加到 .continue/config.yaml 中:

mcpServers:
  - name: serp
    type: streamable-http
    url: https://serp.mcp.acedata.cloud/mcp
    headers:
      Authorization: "Bearer YOUR_API_TOKEN"

Zed

添加到 Zed 的设置中(~/.config/zed/settings.json):

{
  "language_models": {
    "mcp_servers": {
      "serp": {
        "url": "https://serp.mcp.acedata.cloud/mcp",
        "headers": {
          "Authorization": "Bearer YOUR_API_TOKEN"
        }
      }
    }
  }
}

cURL 测试

# Health check (no auth required)
curl https://serp.mcp.acedata.cloud/health

# MCP initialize
curl -X POST https://serp.mcp.acedata.cloud/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'

3. 或者本地运行(替代方案)

如果您更喜欢在自己的机器上运行服务器:

# Install from PyPI
pip install mcp-serp
# or
uvx mcp-serp

# Set your API token
export ACEDATACLOUD_API_TOKEN="your_token_here"

# Run (stdio mode for Claude Desktop / local clients)
mcp-serp

# Run (HTTP mode for remote access)
mcp-serp --transport http --port 8000

Claude Desktop (本地)

{
  "mcpServers": {
    "serp": {
      "command": "uvx",
      "args": ["mcp-serp"],
      "env": {
        "ACEDATACLOUD_API_TOKEN": "your_token_here"
      }
    }
  }
}

Docker (自托管)

docker pull ghcr.io/acedatacloud/mcp-serp:latest
docker run -p 8000:8000 ghcr.io/acedatacloud/mcp-serp:latest

客户端使用自己的 Bearer 令牌进行连接 —— 服务器会从每个请求的 Authorization 标头中提取令牌。

可用工具

搜索工具

工具

描述

serp_google_search

带有所有选项的灵活 Google 搜索

serp_google_images

搜索图片

serp_google_news

搜索新闻文章

serp_google_videos

搜索视频

serp_google_places

搜索本地地点/企业

serp_google_maps

搜索地图位置

信息工具

工具

描述

serp_list_search_types

列出可用的搜索类型

serp_list_countries

列出用于本地化的国家代码

serp_list_languages

列出用于本地化的语言代码

serp_list_time_ranges

列出时间范围过滤选项

serp_get_usage_guide

获取综合使用指南

使用示例

基础网页搜索

User: Search for information about artificial intelligence

Claude: I'll search for information about AI.
[Calls serp_google_search with query="artificial intelligence"]

带时间过滤器的新闻搜索

User: What's the latest news about technology?

Claude: I'll search for recent tech news.
[Calls serp_google_news with query="technology", time_range="qdr:d"]

本地化搜索

User: Find popular restaurants in Tokyo

Claude: I'll search for restaurants in Tokyo.
[Calls serp_google_places with query="popular restaurants Tokyo", country="jp"]

图片搜索

User: Find images of the Northern Lights

Claude: I'll search for aurora borealis images.
[Calls serp_google_images with query="Northern Lights aurora borealis"]

搜索参数

搜索类型

类型

描述

search

常规网页搜索(默认)

images

图片搜索

news

新闻文章

maps

地图结果

places

本地企业

videos

视频结果

时间范围过滤器

代码

时间范围

qdr:h

过去一小时

qdr:d

过去一天

qdr:w

过去一周

qdr:m

过去一月

常用国家代码

代码

国家

us

美国

uk

英国

cn

中国

jp

日本

de

德国

fr

法国

常用语言代码

代码

语言

en

英语

zh-cn

中文(简体)

ja

日语

es

西班牙语

fr

法语

de

德语

响应结构

常规搜索结果

  • knowledge_graph: 实体信息(公司、人物等)

  • answer_box: 直接答案

  • organic: 带有标题、链接、摘要的常规搜索结果

  • people_also_ask: 相关问题

  • related_searches: 相关查询

图片搜索结果

  • images: 带有 URL 和缩略图的图片结果

新闻搜索结果

  • news: 带有来源和日期的新闻文章

配置

环境变量

变量

描述

默认值

ACEDATACLOUD_API_TOKEN

来自 AceDataCloud 的 API 令牌

必需

ACEDATACLOUD_API_BASE_URL

API 基础 URL

https://api.acedata.cloud

ACEDATACLOUD_OAUTH_CLIENT_ID

OAuth 客户端 ID(托管模式)

ACEDATACLOUD_PLATFORM_BASE_URL

平台基础 URL

https://platform.acedata.cloud

SERP_REQUEST_TIMEOUT

请求超时(秒)

30

LOG_LEVEL

日志级别

INFO

命令行选项

mcp-serp --help

Options:
  --version          Show version
  --transport        Transport mode: stdio (default) or http
  --port             Port for HTTP transport (default: 8000)

开发

设置开发环境

# Clone repository
git clone https://github.com/AceDataCloud/SerpMCP.git
cd SerpMCP

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # or `.venv\Scripts\activate` on Windows

# Install with dev dependencies
pip install -e ".[dev,test]"

运行测试

# Run unit tests
pytest

# Run with coverage
pytest --cov=core --cov=tools

# Run integration tests (requires API token)
pytest tests/test_integration.py -m integration

代码质量

# Format code
ruff format .

# Lint code
ruff check .

# Type check
mypy core tools

构建与发布

# Install build dependencies
pip install -e ".[release]"

# Build package
python -m build

# Upload to PyPI
twine upload dist/*

项目结构

SerpMCP/
├── core/                   # Core modules
│   ├── __init__.py
│   ├── client.py          # HTTP client for SERP API
│   ├── config.py          # Configuration management
│   ├── exceptions.py      # Custom exceptions
│   └── server.py          # MCP server initialization
├── tools/                  # MCP tool definitions
│   ├── __init__.py
│   ├── search_tools.py    # Search tools
│   └── info_tools.py      # Information tools
├── prompts/                # MCP prompt templates
│   └── __init__.py
├── tests/                  # Test suite
│   ├── conftest.py
│   ├── test_client.py
│   └── test_config.py
├── deploy/                 # Deployment configs
│   └── production/
│       ├── deployment.yaml
│       ├── ingress.yaml
│       └── service.yaml
├── .env.example           # Environment template
├── .gitignore
├── CHANGELOG.md
├── Dockerfile             # Docker image for HTTP mode
├── docker-compose.yaml    # Docker Compose config
├── LICENSE
├── main.py                # Entry point
├── pyproject.toml         # Project configuration
└── README.md

API 参考

此服务器封装了 AceDataCloud Google SERP API

贡献

欢迎贡献!请:

  1. Fork 本仓库

  2. 创建功能分支 (git checkout -b feature/amazing)

  3. 提交您的更改 (git commit -m 'Add amazing feature')

  4. 推送到分支 (git push origin feature/amazing)

  5. 开启 Pull Request

许可证

MIT 许可证 - 详情请参阅 LICENSE

链接


AceDataCloud 用心制作

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
2dRelease cycle
45Releases (12mo)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AceDataCloud/SerpMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server