bigquery-google-trends-mcp

bigquery-google-trends-mcp

MCP server that exposes Google Trends data via BigQuery, enabling LLMs to query top search terms, rising terms, and compare term interest over time for different countries.

Category
访问服务器

README

mcp-google-trends

<p align="center"> <a href="#english"><kbd>🇺🇸 English</kbd></a> <a href="#português"><kbd>🇧🇷 Português</kbd></a> </p>

<p align="center"> <i>MCP server que expõe dados do Google Trends via BigQuery</i> </p>

<p align="center"> <a href="https://github.com/jp-caldas/bigquery-google-trends-mcp/actions"><img src="https://img.shields.io/github/actions/workflow/status/jp-caldas/bigquery-google-trends-mcp/ci.yml?branch=main&label=CI" alt="CI"></a> <a href="https://codecov.io/gh/jp-caldas/bigquery-google-trends-mcp"><img src="https://img.shields.io/codecov/c/github/jp-caldas/bigquery-google-trends-mcp" alt="Coverage"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License"></a> <a href="https://www.python.org"><img src="https://img.shields.io/badge/python-3.12+-blue" alt="Python"></a> </p>


English

Features

  • Top terms — daily most searched terms by country
  • Rising terms — fastest-growing search terms with percentage gain
  • Term comparison — track a term's interest score over time

Prerequisites

  • Python 3.12+
  • uv
  • A Google Cloud project with BigQuery API enabled
  • gcloud CLI installed and authenticated

Setup

# 1. Clone the repo
git clone https://github.com/jp-caldas/bigquery-google-trends-mcp.git
cd bigquery-google-trends-mcp

# 2. Copy env vars and edit with your GCP project ID
cp .env.example .env
# Edit .env: set GOOGLE_CLOUD_PROJECT=your-gcp-project-id

# 3. Install dependencies
uv sync

# 4. Authenticate with Google Cloud
gcloud auth application-default login

# 5. Verify BigQuery access
uv run mcp-google-trends

Usage

Run the MCP server

uv run mcp-google-trends

Starts a stdio-based MCP server listening for tool calls from an LLM client.

Connect with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "google-trends": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/bigquery-google-trends-mcp", "mcp-google-trends"],
      "env": {
        "GOOGLE_CLOUD_PROJECT": "your-gcp-project-id"
      }
    }
  }
}

Available tools

Tool Description Parameters
buscar_termos_em_alta_tool Top search terms for a country since a date pais (str), data_limite (str YYYY-MM-DD)
buscar_termos_emergentes_tool Fastest-rising terms with % gain pais (str), data_limite (str YYYY-MM-DD)
comparar_termo_tool Track a term's score over time termo, pais, data_inicio, data_fim

Example prompts for Claude

"What are the top trending terms in Brazil this week?"

"Show me the fastest rising terms in the US since last month."

"Compare the interest for 'Python' in Brazil between 2024-01 and 2024-06."

Interactive debugging

npx @modelcontextprotocol/inspector uv run mcp-google-trends

Português

Funcionalidades

  • Termos em alta — termos mais buscados por país
  • Termos emergentes — termos com maior crescimento percentual
  • Comparação de termos — acompanhe o score de um termo ao longo do tempo

Pré-requisitos

  • Python 3.12+
  • uv
  • Um projeto Google Cloud com BigQuery API ativada
  • gcloud CLI instalado e autenticado

Configuração

# 1. Clone o repositório
git clone https://github.com/jp-caldas/bigquery-google-trends-mcp.git
cd bigquery-google-trends-mcp

# 2. Copie as variáveis de ambiente e edite com seu GCP project ID
cp .env.example .env
# Edite .env: defina GOOGLE_CLOUD_PROJECT=seu-projeto-gcp

# 3. Instale as dependências
uv sync

# 4. Autentique no Google Cloud
gcloud auth application-default login

# 5. Verifique o acesso ao BigQuery
uv run mcp-google-trends

Uso

Iniciar o servidor MCP

uv run mcp-google-trends

Inicia um servidor MCP via stdio, ouvindo chamadas de ferramentas do cliente LLM.

Conectar com Claude Desktop

Adicione ao claude_desktop_config.json:

{
  "mcpServers": {
    "google-trends": {
      "command": "uv",
      "args": ["run", "--directory", "C:/caminho/para/bigquery-google-trends-mcp", "mcp-google-trends"],
      "env": {
        "GOOGLE_CLOUD_PROJECT": "seu-projeto-gcp"
      }
    }
  }
}

Ferramentas disponíveis

Ferramenta Descrição Parâmetros
buscar_termos_em_alta_tool Termos mais buscados em um país desde uma data pais (str), data_limite (str YYYY-MM-DD)
buscar_termos_emergentes_tool Termos com maior crescimento percentual pais (str), data_limite (str YYYY-MM-DD)
comparar_termo_tool Acompanhe o score de um termo ao longo do tempo termo, pais, data_inicio, data_fim

Exemplos de prompts para o Claude

"Quais são os termos em alta no Brasil esta semana?"

"Mostre os termos emergentes nos EUA desde o mês passado."

"Compare o interesse por 'Python' no Brasil entre janeiro e junho de 2024."

Depuração interativa

npx @modelcontextprotocol/inspector uv run mcp-google-trends

Development / Desenvolvimento

# All checks at once
make check

# Or step by step
make lint        # ruff
make typecheck   # mypy
make test        # pytest + coverage

# Build Docker image
make build-docker

# Clean cache
make clean

CI: every push to main runs ruff → mypy → pytest automatically via GitHub Actions.


Project structure / Estrutura do projeto

src/mcp_google_trends/
├── __main__.py          # Entrypoint
├── server.py            # FastMCP server + lifespan
├── tools.py             # Business logic + SQL queries
├── bigquery_client.py   # BigQuery client wrapper
├── models.py            # Pydantic models
├── config.py            # Environment config validation
└── exceptions.py        # Custom exceptions
tests/
├── conftest.py          # BigQuery mocks
├── test_tools.py        # Tool unit tests
└── test_server.py       # Server integration tests
data/
├── sample_top_terms.json
└── sample_rising_terms.json

Tech stack / Tecnologias

Library Purpose / Propósito
mcp[cli] MCP server framework (FastMCP)
google-cloud-bigquery BigQuery client
pydantic Data validation and models
pytest + pytest-cov Testing + coverage
ruff Linting
mypy Static type checking

License / Licença

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选