gconnect-mcp-all-v1
gconnect-mcp-all-v1
适用于 Claude.ai 自定义连接器的 True Model B Google Marketing MCP。
这不是一个仅支持 GA4 的连接器,也不是一个仅支持 Google Ads 的连接器。它是一个共享平台,目前提供两个产品适配器,并为以后扩展 DV360 预留了扩展点:
Operator
+-- Google Connection A
| +-- GA4 properties
| +-- Google Ads customers / MCC hierarchy
+-- Google Connection BMCP JWT 的 sub 始终是内部的 operatorId。Google OpenID 的 sub 只存在于 google_connections.googleSubjectId 中。
Architecture
flowchart TB
Claude["Claude.ai"]
McpAuth["MCP OAuth 2.1"]
Operator["operators operatorId"]
Resolver["ConnectionResolver"]
Ga4["GA4 adapter"]
Ads["Google Ads adapter"]
Dv360["DV360 future"]
Ga4Api["GA4 APIs"]
AdsApi["Ads REST v25"]
Claude --> McpAuth
McpAuth --> Operator
Operator --> Resolver
Resolver --> Ga4
Resolver --> Ads
Resolver -.-> Dv360
Ga4 --> Ga4Api
Ads --> AdsApiRelated MCP server: GA4 MCP Server
Identity
MCP 身份验证回答:谁是操作者?
Google OAuth 回答:连接的是哪个 Google 账户?
唯一性由
(operatorId, googleSubjectId)决定,绝不使用电子邮件,也绝不使用全局 Google subject。
Persistence
仅使用 Firestore 命名数据库 gconnect-mcp-all-v1。
不要使用 (default)(V1)或 ga4-mcp-v3(V3)。启动时会拒绝这些 ID。
参见 docs/google-connections.md。
本地开发
将
.env.example复制为.env并填入占位符。不要从 V3 复制密钥。npm installnpm testnpm run typechecknpm run dev
Claude 自定义连接器 URL 为 http://localhost:3000/mcp。健康检查地址为 GET /health。
Google Ads
使用官方 Google Ads REST v25。只读。应用开发者令牌是应用级密钥(GOOGLE_ADS_DEVELOPER_TOKEN),绝不是用户的 OAuth 凭据。
服务器会根据发现的 MCC 层级关系解析 login-customer-id。带连字符的客户 ID 会在 API 使用前进行规范化。
参见 docs/google-ads.md 和 docs/ga4.md。
部署
Cloud Run,未认证入口,Firestore 命名数据库 gconnect-mcp-all-v1。
.\scripts\cloud-run-setup.ps1 -ProjectId YOUR_PROJECT
.\scripts\cloud-run-deploy.ps1 -ProjectId YOUR_PROJECT
.\scripts\cloud-run-set-env.ps1 -ProjectId YOUR_PROJECT -AppBaseUrl https://... -GoogleClientId ... -GoogleClientSecret ... -McpTokenSecret ... -OauthStateSecret ... -TokenEncryptionKey ... -GoogleAdsDeveloperToken ...This server cannot be deployed
Maintenance
Related MCP Connectors
GA4, Google Ads and Search Console in Claude. Read-only OAuth, multi-account for agencies.
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Read-only Google Analytics 4 MCP server for AI assistants.
1
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceUnified MCP server for managing Meta Ads, LinkedIn Ads, Google Ads, GA4, and Search Console with 89 read/write tools, multi-account support, OAuth setup, and safe dry-run mutations.MIT
- AlicenseAqualityBmaintenanceConnects MCP clients like Claude Desktop to Google Analytics 4 Data API, enabling natural language queries for reports, top pages, traffic sources, conversions, realtime users, and period comparisons.720 PyPIMIT
- AlicenseNot gradedqualityDmaintenanceA unified MCP server that gives AI assistants direct access to Google Analytics 4, Google Search Console, Google Ads and Google Merchant Center data using OAuth2 user credentials.MIT
- AlicenseBqualityCmaintenanceEnables Claude and other MCP-capable assistants to monitor and manage Google Ads accounts by pulling performance reports, running GAQL queries, adjusting budgets, pausing or enabling campaigns, adding keywords and negative keywords, and creating campaigns and ads, with preview and read-only safety controls.31Apache 2.0