Google Analytics 4, Google Ads and Search Console: optional default property / customer ID / site per connector
Problem
One Google login often reaches many GA4 properties, Google Ads accounts and Search Console sites, for example at an agency with many clients. The connectors always expose all of them. Every GA4 tool needs property_id, most Google Ads tools need customer_id, and the Search Console tools need site_url. So every prompt has to name the right ID, or the model first calls ga4_get_account_summaries / gads_list_accessible_customers / gsc_list_sites and picks one from a long list.
That causes two problems:
- Wrong client: it is easy for the model to query the wrong property.
- No scoping: I can't hand a connector (or an MCP server built from it) to a colleague or a client and have it see only that client's data. The only limit is what the Google account can see.
Other GA4 / Google Ads / Search Console integrations let you choose the properties when you connect.
Proposed Solution
Add one optional, non-secret variable per connector that holds a comma-separated list of the properties, accounts or sites the connector may use:
| Connector | Variable | Example |
|---|---|---|
| google-analytics-4 | GA4_PROPERTY_IDS |
385356434 or 385356434,412345678 |
| google-ads | GOOGLE_ADS_CUSTOMER_IDS |
1234567890,9876543210 (10 digits, no dashes) |
| google-search-console | GSC_SITE_URLS |
https://www.example.com/,sc-domain:example.org |
How the value would work:
- Empty (default): same as today. All properties, accounts or sites the Google user can see.
- One ID: it is the default. Tools that take the ID make it optional and fill it in when the caller leaves it out (like the existing
endpointMapping.envDefaults). A call with any other ID is refused with a clear error. - Several IDs: only these are allowed. The caller has to pass one of them, and a call outside the list is refused. The list tools (
ga4_get_account_summaries,gads_list_accessible_customers,gads_list_client_accounts,gsc_list_sites) return only the allowed entries, so the model only ever picks from the user's selection.
Important: the check should run in the engine, before the call to Google, not only as a sentence in the instructions. Then the limit holds regardless of what the model does. An instructionFacts sentence ("This connector is limited to GA4 properties {{GA4_PROPERTY_IDS}}") would also tell the model up front which IDs it can use.
For Search Console I would keep the write tools (gsc_submit_sitemap, gsc_delete_sitemap, gsc_add_site, gsc_remove_site) requiring an explicit site_url even when a single site is set, so a write never goes to a site just because it is the default. They should still respect the allowlist.
Nice to have: after "Authorize with Provider", a multi-select on the connector page filled from accountSummaries / listAccessibleCustomers / sites.list, so the IDs don't have to be typed. Since the setting is a plain variable, the same OAuth grant could then be installed several times, once per client, each limited to that client's IDs.
Alternatives Considered
- Connector instructions: put "always use property X" at the top. This works most of the time, but it is only a request to the model and doesn't limit anything.
- A Claude project per client with the IDs in its instructions. This depends on the client, and Copilot and ChatGPT don't share it.
- One install and MCP server per client: this needs a separate OAuth authorization for each install, and the connector still reaches every property.
Area
Connectors (REST, SOAP, GraphQL, Database, MCP Bridge)
Additional Context
Self-hosted v0.55.18 (Docker / Coolify). GA4, Google Ads and Search Console use the same OAuth client in one Google Cloud project, with Explorer access for the Ads API. The Google Ads login customer (GOOGLE_ADS_LOGIN_CUSTOMER_ID, the manager account) is a separate setting and stays as it is
Hi, after reading the description I'd like to work on this. I suggest a generic envAllowlist next to the existing envDefaults, checked in the engine before the call to Google. I'd also suggest splitting it into three separate PRs: GA4 first, then Ads and Search Console, then list filtering.
@helpcodeai is a PR welcome for this, or are you planning to do it yourself? And does envAllowlist sound like the right approach?
Thanks for the detailed proposal, the agency case makes sense and a check in the engine before the call is the right place for it.
@AYUshJaiswal454 thanks for offering. This changes the REST engine, so I want to look at the design first (a generic envAllowlist next to envDefaults, how the list tools get filtered, and how it behaves on Cloud and self-hosted). Please wait with the PR until I confirm the approach here. I'll come back in this issue.