问 克劳德 关于您的GA4帐户, 用通俗易懂的英语
Connect claude.ai, Claude Desktop, ChatGPT, Cursor or any MCP client to Query Streams once. Your AI client asks; the Agent that already sits with your GA4 account, its partner inside your network, does the heavy lifting: it runs the SQL read-only, and on paid plans it also sizes, profiles and holds results so follow-ups need no second query. No database password ever reaches the AI. About ten minutes, and the Free plan covers it.
你最终会得到什么
Claude 能够通过实时只读查询回答有关您 GA4 帐户的问题,解释各列的含义,并在您提出更多要求时进行跟进——无需数据库登录,也无需更改防火墙设置:网络内部的代理程序会运行 SQL 语句,并仅返回查询结果行。代理程序部署到位后,如果您熟悉设置界面,连接 Claude 大约需要 90 秒。例如:
里面有什么 ga4.交通概览 我的 GA4 账户里有什么?请给我显示几行数据,并告诉我每一列的含义。
我首先查看了表结构,然后通过您的代理运行了只读查询。以下是 ga4.traffic_overview 表中的三行数据:
| 日期 | 会话 | 总用户数 |
|---|---|---|
| 1042 | 北风贸易公司 | 西雅图 |
| 1057 | 阿尔卑斯户外用品店 | 丹佛 |
| 1063 | 港湾食品 | 哈利法克斯 |
日期 标识行。 会话 和 总用户数 这些内容在您的语义智能模型中有描述,因此我可以按名称进行筛选。
哪三个 总用户数 本季度价值类产品带来的收入最多,与上季度相比如何?我应该重点关注哪些方面?
我加入了 ga4.交通概览 至 命令 基于语义智能发现的关系,分别对每个季度运行一次聚合查询。这两个查询均为只读查询,且均返回 3 行数据:
| 总用户数 | 本季度 | 上个季度 | 改变 |
|---|---|---|---|
| 丹佛 | 184,200 | 133,900 | +38% |
| 西雅图 | 171,650 | 168,400 | +2% |
| 哈利法克斯 | 96,300 | 129,700 | -26% |
丹佛 故事是这样的:在客户数量几乎不变的情况下,收入增长了 38%,因此平均订单价值也提高了。 哈利法克斯 下降了26%,其中有两位客户上季度每月都下单,而本季度却完全没有下单——月底前值得联系一下。西雅图的业绩持平。想知道哈利法克斯那两位客户的具体姓名吗?
完全不想搭建人工智能客户端? 关于商业计划书, 诺瓦 is the assistant built into Query Streams itself. It uses the same Agent toolset your AI client gets here, plus what an outside client does not: it drafts and validates the SQL against your Semantic Intelligence model, turns the answer into a chart, and saves the result as a query your team can run from Excel, Google Sheets or the REST API — no key, no connector, nothing to install. Use MCP when your people already live in Claude, Cursor or ChatGPT; use Nova when you want the answers inside the Portal.
Google Analytics 4 将您的数据存储在其 API 之后。而 Claude 则运行在浏览器或终端中,对数据一无所知。通常的做法是将模式粘贴到聊天窗口中并祈祷,或者将您的 GA4 密码提供给开源的 MCP 服务器。Query Streams 的实现方式有所不同:已存在于您的 GA4 帐户中的代理以只读方式运行 Claude 编写的 SQL,而 MCP 服务器则负责检查是谁在查询、他们可能执行的操作以及查询频率。Claude 只获取答案,而不会获取凭据。
你需要准备什么
MCP 已为您开启
创建者、所有者和管理员从一开始就拥有权限。其他所有人则需要管理员来切换权限。 MCP 他们名字旁边的开关 账户 → 访问控制在此之前,MCP 页面会显示“您的帐户已禁用 MCP”。
人工智能客户
Chat apps such as claude.ai, Claude Desktop and ChatGPT connect with no key. Claude Code, Cursor, VS Code and about ten other tools use a key; the Portal’s Connect an AI client guide sets up each one.
工作在哪里进行? On the computer that runs the Agent. It receives the SQL your AI client wrote, checks it is a SELECT, runs it and returns the rows. So that computer needs to be on when you ask; your own laptop only needs the AI client.
分四步完成设置
-
在门户网站中打开 MCP。
登录 my.querystreams.com 并开放 流媒体 → 直播 → MCP该页面共有四个标签页: 连接, Context, 工具 对于管理员而言, 活动. Check the Semantic Intelligence panel on 连接 while you are here: it lists your GA4 connector and whether Semantic Intelligence has run on it. Complete coverage is what lets Claude write correct GA4 SQL on the first try.
看到“您的帐户已禁用 MCP”提示? 您的组织拥有 MCP,但您的用户已被禁用。管理员使用以下命令将其启用: MCP 你的名字旁边有个开关。 账户 → 访问控制创建者、所有者和管理员从一开始就在线。
-
选择您的连接方式
有两条路可以进去,但它们通向同一个地方:
聊天应用 · 无密钥claude.ai、Claude Desktop、ChatGPT
In claude.ai and Claude Desktop, open the Query Streams listing in Anthropic’s Connectors Directory, click 连接 and approve. Adding it by URL,
https://mcp.querystreams.com/mcp, is the fallback. In ChatGPT you add Query Streams from the app (developer mode for now) and sign in with Query Streams. Either way a Query Streams page opens: pick the organization and the permissions and click 批准连接. Nothing to copy. The connection appears on the 连接 tab and can be revoked there.开发者工具 · 关键Claude Code、光标、VS Code 和朋友们
On the MCP page click Connect an AI client. The guide asks How will your AI client connect?: choose Use a key in a config file, pick your tool, then Generate a key for it: a 键名, 读 和 Run queries ticked, an 到期日 (Never, 30 days, 90 days or 1 year). Set it up shows the snippet with the key filled in, and Check the connection waits for the first call.
两种方式都使用相同的三个权限,您可以在同意屏幕或密钥上选择这些权限:
- 读
- 列出连接器,浏览表和列,读取已保存的查询和警报规则。从不返回行数据。
- Run queries
- Run read-only SQL and saved queries through your Agent and return the rows. Without it your AI client can describe your data but not answer from it.
- 分析
- 它会分析表结构、发现关联关系并安排语义智能运行。此操作会消耗 Nova AI 积分和数据流量,因此不会在同意界面预先勾选。
钥匙丢了? It is listed on the 连接 tab: Reveal full key shows it again and 复制完整密钥 复制它。如果笔记本电脑丢失,则撤销该权限;所有使用该权限的客户端都会在大约五分钟内导致下次调用失败。
-
联系克劳德
选择你使用的克劳德配方。服务器地址在所有地方都相同:
https://mcp.querystreams.com/mcp.网页版 Claude、桌面版 Claude 和移动版 Claude 没有钥匙
- 打开 Query Streams listing in Anthropic’s Connectors Directory and click 连接. In Desktop it then sits under + → 连接器.
- Fallback, if your organization hides directory connectors: Settings → Connectors → Add custom connector, name 查询流, URL
https://mcp.querystreams.com/mcp, OAuth fields empty, 添加; then in a chat + → 查询流 → 连接. - “查询流”选项卡随即打开。如果系统提示,请登录,选择组织,然后进行审核。 读 和 Run queries(可选) 仅限特定连接器然后点击 批准连接.
- 回到 Claude 界面,你会看到“已连接到查询流”。Claude 首次使用某个工具时会询问:请选择 始终允许.
如果您在 Claude Desktop 中手动添加,请使用 设置 → 连接器 → 添加不是聊天记录 添加市场 此选项需要一个 Git 仓库。连接器会同步到您的 Claude 帐户,因此移动应用和桌面应用会自动识别。菜单名称为 Anthropologie 的,可能会更改。
克劳德·科德 钥匙
One command, with your key from the Connections tab:
终端claude mcp add --transport http querystreams https://mcp.querystreams.com/mcp \ --header "X-MCP-Key: qsmcp_PASTE_YOUR_KEY_HERE"
这会写出当前项目的……
.mcp.json。 添加--scope 用户在每个项目中都包含查询流。运行/mcp在 Claude Code 中查看连接情况。光标 钥匙
打开 光标设置 → MCP → 添加新的 MCP 服务器或编辑
.cursor/mcp.json在工作区的根目录下:.cursor/mcp.json{ "mcpServers": { "querystreams": { "url": "https://mcp.querystreams.com/mcp", "headers": { "X-MCP-Key": "qsmcp_PASTE_YOUR_KEY_HERE" } } } }重启 Cursor 或运行 MCP:重启服务器;一个
查询流徽章会显示在 MCP 状态栏中。用别的办法吗? The Portal’s Connect an AI client guide 它提供了适用于 ChatGPT、VS Code、Visual Studio、OpenAI Codex CLI、Gemini CLI、Windsurf、Zed、Cline、Continue.dev 和 JetBrains AI 的现成代码模板,此外还有 粘贴并合并 放下工具
查询流将条目添加到您已有的配置文件中。任何支持通过 HTTP 协议使用 MCP 的客户端都可以:服务器https://mcp.querystreams.com/mcp标题X-MCP-Key(一个授权方式:持有者使用相同键的标头也有效)。 -
问你的第一个问题
先从你已经知道答案的问题入手,这样你就能看到克劳德如何选择合适的工具。以下三个工具与你的 GA4 账户配合使用效果很好:
- “我的 GA4 账户里有哪些数据?”
- Claude 会列出它可以看到的表格,告诉你哪些表格具有语义智能,并询问你想查看什么。
- “请从 ga4.traffic_overview 表中选取十行数据,并解释每一列的含义。”
- Claude reads the table structure first (Read), then runs one SELECT through your Agent (Run queries) and describes what sessions and total_users mean.
- “ga4.traffic_overview 表中每个 total_users 有多少行数据?哪个 total_users 表中的数据最多?”
- Claude 用 GA4 的方言编写了 GROUP BY 语句,运行后用一句话和一个小型表格回复。在同一个聊天窗口中继续讨论,这样可以保留上下文。
要确认接线情况,请询问 我有哪些 Query Streams 连接器?克劳德打电话
qs_list_connectors, the Portal guide’s Check the connection step says 已连接, and the key or app on the 连接 tab shows its 上次使用 time within a few seconds.
就是这样。 现在,无论你通过哪个 Claude 客户端提问,Claude 都会通过你的 GA4 账户进行回答。除了问题所需的数据行之外,没有任何数据离开你的网络,也没有人需要向 AI 输入密码。
克劳德连接后能做什么
Your AI client sees the Query Streams tools; it picks the right one for your question. The Portal’s 工具 标签 lists all 38 tools and modes with what your plan includes. On every plan, Free included:
Map your data
Connectors, databases and Agents; the tables and columns of your GA4 account with descriptions, sample values and joins once Semantic Intelligence has run.
个人资料和探索
Profile a column before filtering on it; discover joins nobody declared. (Analyze)
运行只读 SQL
A SELECT in the right dialect for GA4, 60 seconds by default and five minutes at most. Your plan sets the most rows one query returns. (Run queries)
Saved queries, federated and alerts
Run the saved queries your team trusts with new values; federated ones come back already joined. Read alert rules and draft one as a dry run.
The Analytic toolset. On paid plans the Agent does the groundwork where your GA4 account lives, so your AI client spends its attention on the thinking. Free works as it always has.
Context management
Personal Core and upSize a result before reading it (shape), walk a large database area by area (levels), and keep answers inside a token budget with only the 列 and cell lengths it needs.
Result analysis
Personal Core and upA 个人资料 of the whole result instead of rows. Held results with labels answer follow-ups and group-by totals with no second query. 数据新鲜度 和 changed-since read only what is new.
The defaults live on the Context 标签: text cell limit, schema view, result size, analysis defaults and held results.
The tool names, if you want to recognise them in your AI client’s replies
| 允许 | 工具 |
|---|---|
| 读 | qs_list_organizations qs_list_agents qs_list_connectors qs_get_si_status qs_get_connector_schema qs_get_table_schema qs_get_relationships qs_list_saved_queries qs_get_task_status qs_list_alert_rules qs_get_alert_state qs_list_recent_alerts qs_result_windows |
| 分析 | qs_profile_table qs_discover_relationships qs_request_si_analysis qs_setup_si |
| Run queries | qs_run_query qs_run_saved_query qs_data_freshness qs_result_query qs_result_page qs_result_sample qs_result_release qs_result_anomalies qs_result_segments qs_result_compare qs_result_diff qs_create_alert_rule (proposes only) |
为什么语义智能在这里很重要
Claude 收到的每个答案都会被标记出该结构来自哪里,Claude 会根据标记调整它对所看到内容的信任程度。
| 层级 | 克劳德所看到的 | 结果 |
|---|---|---|
| 语义智能 | 每个表和列的描述、示例值、枚举含义、已声明和已发现的连接。 | Claude 第一次就编写出了正确的 GA4 SQL,并用您的业务术语解释了数据。 |
| 捕获的模式 | 表名和列名、类型、键。 | 克劳德会工作,但他会从名字中推断含义,并可能会提出后续问题。 |
| 实时架构 | The database is outside the connector’s capture selection, so structure is read live on each request (needs the Run queries permission; SQL Server, MySQL and PostgreSQL). | 查询仍在运行。当需要更多信息时,Claude 会使用较小的 SELECT 语句进行探索。 |
如果数据库很重要,请对其运行一次语义智能分析。 新星 → 智能。 这 连接 该选项卡显示每个连接器的覆盖范围面板。 语义智能的工作原理.
这些计划允许什么?
MCP is on every plan, including Free, with no separate fee. What each plan sets is how many keys or connected apps you can hold and how many calls a minute your AI client may make:
| 计划 | 每个用户的密钥 | 每个组织的密钥 | 每分钟通话次数 |
|---|---|---|---|
| 免费 | 1 | 1 | 30 |
| 个人核心 | 1 | 1 | 60 |
| 个人加强版 | 1 | 1 | 90 |
| 核心业务 | 2 | 3 | 120 |
| 商务+ | 3 | 5 | 150 |
| 商业最大 | 5 | 10 | 240 |
| 企业核心 | 5 | 25 | 300 |
| 企业增强版 | 8 | 50 | 450 |
| 企业版 Max | 10 | 100 | 600 |
A connected app counts as a key. On top of the per-minute figure, any one key may run at most 10 queries a minute. A query runs for up to 60 seconds unless your AI client asks for more, up to five minutes. Your plan also sets how many rows one query returns and, with the Analytic toolset, how long and how large a held result may be; the full MCP guide lists every plan. The rows your AI client receives count against your Data Realm allowance, the same pool your Excel and Sheets queries use, and MCP is measured the same way as your spreadsheet queries. Semantic Intelligence runs started from Claude spend Nova AI credits, exactly as they do from the Portal. 请查看定价页面 津贴。
确保安全
只读,由代理人检查
Only SELECT statements run. The check happens on the computer that runs the Agent, before your GA4 account sees the SQL, so nothing your AI client writes can change data.
没有人工智能方面的资质
GA4 登录信息保留在代理上。Claude 持有查询流密钥或连接,您可以从 MCP 页面撤销该密钥或连接;更改将在大约五分钟内生效。
所有信息均已记录
每次工具调用都会显示在 MCP 上。 活动 选项卡和查询历史记录中的每个查询都会以客户端类型 MCP 的形式记录,并归属于发出该查询的密钥或连接的用户。SQL 文本和密钥本身永远不会写入活动日志。
人工智能提供商收到的内容
Table and column names, the Semantic Intelligence descriptions including sample values, and the rows of the queries you ask for. With the Analytic toolset it often gets a size estimate, a profile or a held-result answer instead, and the full result stays with the Agent. What it gets goes to the AI provider you connected, under its terms. Query Streams never sees your chat.
下一步行动不错。
- 保存您认为规范的查询 在查询构建器中,Claude 会优先选择已保存的查询,因此“活跃客户”的含义取决于你们团队的定义。
- 使用 Claude 项目 附加查询流,并在其说明中放入您的规则:默认使用哪个 GA4 数据库,哪些已保存的查询是官方定义。
- 当您需要更深入的答案时,请使用 Grant Analyze。 在筛选之前先对该列进行分析,这相当于从猜测状态码到使用正确状态码之间的区别。此操作会消耗 Nova AI 积分,因此默认情况下处于关闭状态,直到您手动启用为止。
- 索取一张图表。 claude.ai 根据 Claude 返回的行绘制图表。
当某些事情不起作用时
| 你所看到的 | 它的含义 | 使固定 |
|---|---|---|
| Your AI client shows no Query Streams tools | The connector was added but never connected, or the key was pasted into the wrong place. | 在克劳德身上: + → Query Streams → 连接. In a developer tool: restart it, then use Check the connection in the Portal guide. |
MCP_KEY_REQUIRED 或 401 | 服务器未收到密钥,通常是由于复制粘贴时多出的换行符,或者密钥位于错误的标头中。 | Copy the key again from the Connections tab and send it in the X-MCP-Key 标题。 |
MCP_USER_DISABLED | 管理员已为您用户关闭了 MCP 功能。 | 请他们转身 MCP 重新打开 账户 → 访问控制. |
MCP_SCOPE_REQUIRED 或 MCP_SCOPE_DENIED | The key or connection lacks the permission for that action, usually Run queries. | Edit the key on the Connections tab and tick Run queries或者重新连接应用程序并批准它。 |
MCP_KEY_ORG_LIMIT_EXCEEDED | 您的套餐密钥数量已用完。免费套餐的密钥数量上限为一个密钥或一个已连接的应用。 | 取消不再使用的套餐,或者升级到更高级别的套餐。 |
MCP_AGENT_NOT_CONNECTED 或 MCP_AGENT_NOT_REGISTERED | 拥有您 GA4 帐户的代理目前未连接。 | 打开 数据 → 数据代理 并在其计算机上启动代理。 |
MCP_DATABASE_NOT_CAPTURED | 数据库位于连接器捕获选择范围之外,因此没有为其存储任何模式或语义智能。查询仍然有效。 | 将其添加到连接器上的捕获选择中,然后运行语义智能(如果您想要更丰富的答案)。 |
MCP_RATE_LIMITED | 您的套餐每分钟调用次数过多,或者对一个键每分钟执行超过 10 次查询。 | 稍等片刻。语义智能可以让克劳德用更少的电话就能接听电话。 |
MCP_QUERY_TIMEOUT 或 MCP_OUTPUT_TOO_LARGE | The query ran past its timeout or returned more than your AI client can take in one reply. | Ask for fewer rows or columns, or a date filter. On plans with Context management, ask it to size the result first. |
MCP_DATA_REALM_EXHAUSTED | 您所在组织在该期间的数据流量已用完。 | 等待余额重置或通过门户网站充值。 |
MCP_FEATURE_NOT_INCLUDED | Your plan does not include Context management, Result analysis or Deeper analysis, or that tool is switched off for this key or organization. | Ask your AI client to carry on without it, move up a plan, or ask an admin to switch the tool on. |
MCP_RESULT_EXPIRED | The held result is no longer held: it expired, was released (sometimes early, to make room for a newer one) or the Agent restarted. | Ask your AI client to run the query again with hold. |
MCP_WINDOW_BUDGET | The Agent cannot keep a result that size right now, or a follow-up needs more memory than it allows. | Release a held result, or narrow the query with a filter or fewer columns. |
MCP_AGENT_ANALYSIS_DISABLED | Held results and analysis are switched off on that Agent or connector. | Ask an admin to turn on Local analysis on the Data Agents page, or allow analysis on the connector. |
MCP_WINDOW_SQL_REJECTED | A follow-up was not one read-only SELECT over the held result, or named a column the result does not have. | Ask for one SELECT over that result, using its column names. |
MCP_AGENT_VERSION_TOO_OLD | The Agent needs an update before it can shape, profile, hold or analyze results. | Update the Agent from 数据 → 数据代理; plain queries keep working meanwhile. |
| 只读违规 | 这条 SQL 语句不是 SELECT 语句。 | 这是设计使然。没有任何数据会通过 MCP 写入。 |
人们提出的问题
Claude可以修改我的GA4数据吗?
不。代理程序只接受 SELECT 语句,并在 SQL 运行前进行检查。Claude 可以将语义智能运行或警报规则草拟作为试运行;这两项操作都会写入查询流元数据,绝不会写入您的 GA4 帐户。
我需要开放端口还是运行 VPN?
不。代理程序在 443 端口上建立一个出站连接,所有请求和数据行都通过该连接传输。如果出站 HTTPS 连接正常,则 MCP 功能也正常。
免费套餐真的包含这些吗?
是的。“免费”套餐是永久有效的,不是会过期的试用期。所有套餐都包含 MCP;“免费”套餐允许使用一个密钥或一个已连接的应用程序,通话时长为每分钟 30 次。请查看“免费”套餐的具体包含内容。 定价页面.
Which plans include the Analytic toolset?
Context management and Result analysis come with Personal Core and up; Deeper analysis with Business Core and up. The Free plan works as it always has, with standard results. Held results grow with the plan, up to eight hours and 4,096 MB on Enterprise.
除了 Claude 之外,还有哪些 AI 工具可用?
Anything that speaks MCP over HTTP: ChatGPT, Cursor, VS Code with Copilot, Visual Studio, OpenAI Codex CLI, Gemini CLI, Windsurf, Zed, Cline, Continue.dev and JetBrains AI all have a ready-made recipe in the Portal’s Connect an AI client guide.
克劳德是否了解整个组织的情况?
一个密钥即可连接到您组织的所有连接器。您可以批准将已连接的应用限制为仅连接到特定连接器。每个密钥或连接都属于一个组织;每个组织只需连接一次即可。
它和Nova有什么区别?
Nova 是 Query Streams Portal 中的助手,它与 Query Streams Portal 采用相同的语义智能模型。如果您想在 Query Streams 中获取答案,请使用 Nova;如果您想将数据导入 Claude,并与其他操作一起显示在 Claude 中,请使用 MCP。
Claude 是否了解 GA4 的 SQL 方言?
是的。每个模式响应都会告诉 Claude 它正在查看哪种连接器类型,然后 Claude 会为该引擎编写 SQL。借助语义智能,它还能看到列描述和示例值,因此无需再猜测状态码或缩写的含义。
我的 GA4 账户必须和 Claude 的账户在同一台电脑上吗?
不。只有代理程序需要位于您的 GA4 帐户所在位置,或者任何始终在线且可访问互联网的计算机上。Claude 可以位于您的笔记本电脑、手机或其他服务器上;它只会与查询流通信。
相关指南
每份指南 GA4
这不是你想要的配置?
- 想要提升 Google 搜索排名,为您的网站带来点击量和展示量吗?Google Search Console 可以帮您实现 → Search Console
Setup trouble?
- Agent shows Offline, or Test connection and Browse are greyed out? Check that the Agent is online → Is the Agent online?

