gbp-mcp

gbp-mcp

An MCP server for Google Business Profile that enables managing accounts, locations, reviews, posts, media, Q&A, and insights through simple JSON tools.

Category
访问服务器

README

gbp-mcp

Standalone MCP server for Google Business Profile. It exposes accounts, locations, reviews, posts, media, Q&A, insights, and a few write actions as JSON tools for Cursor, Claude Desktop, and Claude Code.

This repository is not the Streamlit GMB-Management-System app. There is no web UI, PDF export, Plotly charts, i18n dashboard, or Gemini reply drafting. Google API calls live in this repo (data_fetcher.py, drive_helper.py). You do not need to clone or run the Streamlit project.

Tools

Read:

  • list_accounts
  • list_locations
  • get_daily_metrics
  • get_search_keywords
  • list_reviews
  • list_posts
  • list_media
  • list_questions
  • profile_health_check

Write:

  • create_local_post
  • upload_image_to_drive
  • reply_to_review

Auth helpers:

  • start_oauth
  • complete_oauth

Every tool returns JSON only (no DataFrame, PDF, or chart objects).

Location IDs accept accounts/{accountId}/locations/{locationId}, locations/{locationId}, or a bare id. v4 calls (reviews, posts, media) go through resolve_location_parent. Dates are YYYY-MM-DD. Drive uploads take base64 image bytes (file_base64) and can return a public URL for GBP posts.

Requirements

  • Python 3.10+
  • A Google Cloud OAuth user client (Desktop or Web). Service accounts are not supported.
  • These OAuth scopes:
    • https://www.googleapis.com/auth/business.manage
    • https://www.googleapis.com/auth/drive.file
    • https://www.googleapis.com/auth/drive.metadata.readonly

Enable the Google APIs your tools will call, typically:

  • My Business Account Management API
  • My Business Business Information API
  • My Business Q&A API
  • Business Profile Performance API
  • Google Drive API
  • Google My Business API (v4 discovery, used for reviews / posts / media)

Install

git clone https://github.com/marcusbtc/gbp-mcp.git
cd gbp-mcp
python3 -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt

Copy .env.example and export the values, or put them in your MCP client env block. Do not commit .env, client_secret.json, or token files.

cp .env.example .env

Authenticate (user OAuth only)

Never put tokens, refresh tokens, or client_secret.json in git.

You need a Google Cloud OAuth client ID and secret (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET). Optional: place a local client_secret.json in the repo root (gitignored).

Add this redirect URI on the OAuth client (unless you override it):

http://localhost:8753/

Then pick one of:

  1. Per-call token — pass access_token on any tool.
  2. Environment token — set GOOGLE_ACCESS_TOKEN. Optional refresh: GOOGLE_REFRESH_TOKEN plus client id/secret.
  3. Local helper (opens a browser, writes a gitignored token file, default .gmb-mcp-token.json):
python mcp_server.py --oauth
  1. MCP tools — call start_oauth, approve access, then complete_oauth with the code query parameter from the redirect URL.

complete_oauth and --oauth never print tokens. Override the token path with GMB_MCP_TOKEN_PATH. Override the redirect with GOOGLE_REDIRECT_URI.

Run

stdio (default — Cursor, Claude Desktop, Claude Code):

python mcp_server.py
# or: python -m src.gmb_mcp

Optional Streamable HTTP:

python mcp_server.py --http --host 127.0.0.1 --port 8765

Endpoint: http://127.0.0.1:8765/mcp

Connect from Cursor

Add to MCP settings (project .cursor/mcp.json or user MCP config). Use an absolute path. Do not put tokens in a committed file.

{
  "mcpServers": {
    "google-business-profile": {
      "command": "python",
      "args": ["mcp_server.py"],
      "cwd": "/absolute/path/to/gbp-mcp",
      "env": {
        "GOOGLE_CLIENT_ID": "<your-oauth-client-id>",
        "GOOGLE_CLIENT_SECRET": "<your-oauth-client-secret>"
      }
    }
  }
}

If you already have a user access token and prefer not to run --oauth:

{
  "mcpServers": {
    "google-business-profile": {
      "command": "python",
      "args": ["mcp_server.py"],
      "cwd": "/absolute/path/to/gbp-mcp",
      "env": {
        "GOOGLE_ACCESS_TOKEN": "<your-oauth-access-token>"
      }
    }
  }
}

Point command at the venv interpreter if you do not want to activate it first, for example /absolute/path/to/gbp-mcp/.venv/bin/python.

HTTP instead of stdio (start the server yourself first):

{
  "mcpServers": {
    "google-business-profile": {
      "url": "http://127.0.0.1:8765/mcp"
    }
  }
}

Connect from Claude Desktop / Claude Code

Claude Desktop (claude_desktop_config.json) and Claude Code use the same stdio shape:

{
  "mcpServers": {
    "google-business-profile": {
      "command": "/absolute/path/to/gbp-mcp/.venv/bin/python",
      "args": ["/absolute/path/to/gbp-mcp/mcp_server.py"],
      "env": {
        "GOOGLE_CLIENT_ID": "<your-oauth-client-id>",
        "GOOGLE_CLIENT_SECRET": "<your-oauth-client-secret>"
      }
    }
  }
}

Run python mcp_server.py --oauth once in that working directory so .gmb-mcp-token.json exists, or set GOOGLE_ACCESS_TOKEN.

Security

  • Never commit client_secret.json, .env, or .gmb-mcp-token.json.
  • Never paste access tokens into chat, issues, or screenshots.
  • Tools and OAuth helpers do not return tokens.
  • Drive uploads with make_public=true create a world-readable file URL. Use that only when you intend to attach the image to a public GBP post.

Development

pip install -r requirements-dev.txt
ruff check src tests mcp_server.py
pytest
python -m py_compile mcp_server.py data_fetcher.py drive_helper.py health_check.py
python mcp_server.py --help

License

MIT (see LICENSE).

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选