Repository navigation
Description
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
Activity
[-]Google Analytics 4 and Google Ads: optional default property / customer ID per connector[/-][+]Google Analytics 4, Google Ads and Search Console: optional default property / customer ID / site per connector[/+]AYUshJaiswal454 commentedon Dec 1, 2026
Hi, after reading the description I'd like to work on this. I suggest a generic
envAllowlistnext to the existingenvDefaults, 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
envAllowlistsound like the right approach?helpcodeai commentedon Dec 2, 2026
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
envAllowlistnext toenvDefaults, 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.helpcodeai commentedon Dec 2, 2026
@AYUshJaiswal454 the approach is fine, go ahead. A few points so the PRs stay small and easy to review:
envAllowlistinendpointMapping, next toenvDefaults: maps a parameter to a connector variable holding a comma-separated list. Empty or unset means today's behaviour.site_url, as proposed above, and still respect the list.Please start with the engine part and GA4 in the first PR, then Ads and Search Console, then filtering of the list tools. Thanks for picking this up.
AXILTIADIGITAL commentedon Dec 2, 2026
@AYUshJaiswal454, @helpcodeai:
Thanks for your reply! Please also keep this in mind for Google Merchant Center and, in the future, the Google Business Profile API. ;-)
AYUshJaiswal454 commentedon Dec 2, 2026
Thanks @helpcodeai, that's clear. I'll start with the first PR: the generic
envAllowlistin the REST engine plus GA4, with tests next to the engine spec and static checks in the adapter spec.@AXILTIADIGITAL since
envAllowlistis generic (any parameter mapped to a connector variable), Google Merchant Center and later the Business Profile API can use it too in a follow-up.feat(engine): envAllowlist limits a parameter to a variable's list; G…
feat(adapters): limit Google Ads and Search Console with envAllowlist (…
AYUshJaiswal454 commentedon Dec 6, 2026
#1972 and #1977 are merged, thanks for the quick reviews! Before the last PR (filtering the list tools), here is the design, since it touches the engine again:
Rule:
endpointMapping.envAllowlistResponse, next toenvAllowlist:gsc_list_sites{ "variable": "GSC_SITE_URLS", "items": "siteEntry", "key": "siteUrl" }gads_list_accessible_customers{ "variable": "GOOGLE_ADS_CUSTOMER_IDS", "items": "resourceNames", "normalize": "digits" }(nokey: the item itself,customers/1234567890→1234567890)gads_list_client_accounts{ "variable": "GOOGLE_ADS_CUSTOMER_IDS", "items": "results", "key": "customerClient.id", "normalize": "digits" }ga4_get_account_summaries{ "variable": "GA4_PROPERTY_IDS", "items": "accountSummaries[*].propertySummaries", "key": "property", "normalize": "digits", "dropEmptyParents": true }Behaviour
digitsnormalisation asenvAllowlist.dropEmptyParents: for GA4, an account left with no allowed property is removed too, so other clients' account names don't leak.responseMapping, on fresh answers and cache hits (the cache holds the raw body, so a changed list applies at once), and in the "Run test" path.normalizeis known and thatitems/keyare non-empty paths.Questions
responseMappingdoes) or the filtered one?endpointMappingthe right place, rather thanresponseMapping? I'd keep it inendpointMappingbecauseresponseMappingcan be customised per workspace and preserved on resync, and this is a limit, not shaping.If this looks right I'll open the PR with tests, and it will close the issue.