SerpMCP
SerpMCP
一个用于 Google 搜索的 模型上下文协议 (MCP) 服务器,通过 AceDataCloud API 使用 SERP API。
直接从 Claude、VS Code 或任何兼容 MCP 的客户端执行 Google 搜索并获取结构化结果。
功能
网页搜索 - 带有结构化结果的常规 Google 网页搜索
图片搜索 - 搜索带有 URL 和缩略图的图片
新闻搜索 - 获取关于任何主题的最新新闻文章
视频搜索 - 查找来自 YouTube 和其他来源的视频
地点搜索 - 搜索本地企业和地点
地图搜索 - 查找位置和地理信息
知识图谱 - 获取结构化的实体信息
本地化 - 支持多个国家和语言
时间过滤 - 按时间范围过滤结果
工具参考
工具 | 描述 |
| 搜索 Google 并使用 SERP API 获取结构化结果。 |
| 搜索 Google 图片并获取图片结果。 |
| 搜索 Google 新闻并获取新闻文章结果。 |
| 搜索 Google 视频并获取视频结果。 |
| 在 Google 上搜索本地地点和企业。 |
| 在 Google 地图上搜索位置。 |
| 列出所有可用的 Google 搜索类型。 |
| 列出 Google 搜索常用的国家代码。 |
| 列出 Google 搜索常用的语言代码。 |
| 列出 Google 搜索可用的时间范围过滤器。 |
| 获取使用 Google SERP 工具的综合指南。 |
快速入门
1. 获取您的 API 令牌
在 AceDataCloud 平台 注册
前往 API 文档页面
点击 “Acquire” 获取您的 API 令牌
复制令牌以供下方使用
2. 使用托管服务器(推荐)
AceDataCloud 托管了一个受管理的 MCP 服务器 —— 无需本地安装。
端点: https://serp.mcp.acedata.cloud/mcp
所有请求都需要 Bearer 令牌。请使用第 1 步中的 API 令牌。
Claude.ai
通过 OAuth 直接在 Claude.ai 上连接 —— 无需 API 令牌:
前往 Claude.ai 设置 → 集成 → 添加更多
输入服务器 URL:
https://serp.mcp.acedata.cloud/mcp完成 OAuth 登录流程
开始在对话中使用这些工具
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
前往 设置 → 工具 → AI Assistant → 模型上下文协议 (MCP)
点击 添加 → HTTP
粘贴:
{
"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 8000Claude 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 标头中提取令牌。
可用工具
搜索工具
工具 | 描述 |
| 带有所有选项的灵活 Google 搜索 |
| 搜索图片 |
| 搜索新闻文章 |
| 搜索视频 |
| 搜索本地地点/企业 |
| 搜索地图位置 |
信息工具
工具 | 描述 |
| 列出可用的搜索类型 |
| 列出用于本地化的国家代码 |
| 列出用于本地化的语言代码 |
| 列出时间范围过滤选项 |
| 获取综合使用指南 |
使用示例
基础网页搜索
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"]搜索参数
搜索类型
类型 | 描述 |
| 常规网页搜索(默认) |
| 图片搜索 |
| 新闻文章 |
| 地图结果 |
| 本地企业 |
| 视频结果 |
时间范围过滤器
代码 | 时间范围 |
| 过去一小时 |
| 过去一天 |
| 过去一周 |
| 过去一月 |
常用国家代码
代码 | 国家 |
| 美国 |
| 英国 |
| 中国 |
| 日本 |
| 德国 |
| 法国 |
常用语言代码
代码 | 语言 |
| 英语 |
| 中文(简体) |
| 日语 |
| 西班牙语 |
| 法语 |
| 德语 |
响应结构
常规搜索结果
knowledge_graph: 实体信息(公司、人物等)
answer_box: 直接答案
organic: 带有标题、链接、摘要的常规搜索结果
people_also_ask: 相关问题
related_searches: 相关查询
图片搜索结果
images: 带有 URL 和缩略图的图片结果
新闻搜索结果
news: 带有来源和日期的新闻文章
配置
环境变量
变量 | 描述 | 默认值 |
| 来自 AceDataCloud 的 API 令牌 | 必需 |
| API 基础 URL |
|
| OAuth 客户端 ID(托管模式) | — |
| 平台基础 URL |
|
| 请求超时(秒) |
|
| 日志级别 |
|
命令行选项
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.mdAPI 参考
此服务器封装了 AceDataCloud Google SERP API:
贡献
欢迎贡献!请:
Fork 本仓库
创建功能分支 (
git checkout -b feature/amazing)提交您的更改 (
git commit -m 'Add amazing feature')推送到分支 (
git push origin feature/amazing)开启 Pull Request
许可证
MIT 许可证 - 详情请参阅 LICENSE。
链接
由 AceDataCloud 用心制作
Maintenance
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