Why
Several high-value ad-platform capabilities are gated behind program approvals or limited OAuth scopes that take days–weeks to obtain — and a self-hosted YieldAgent user may never get them. Concrete examples already in the codebase:
- LinkedIn Lead Sync (
r_marketing_leadgen_automation) — separate program approval; required for pull_lead_responses / subscribe_lead_webhook.
- LinkedIn Matched Audiences (
rw_dmp_segments) — separate Audiences-program approval; required for create_dmp_segment, upload_audience_csv, add_dmp_users.
- LinkedIn Advertising API itself is a Vetted Product — even creating campaigns requires partner-tier access.
- Google Ads Developer Token — starts at Test access (test accounts only); Basic/Standard needs application.
- Meta Marketing API App Review — dev-mode apps can only authenticate Admins/Devs/Testers.
When scope is missing, the agent should not silently fail. It should fall back to driving the platform's web UI through a browser — Playwright session via the existing mcp-browser-control tool registry entry (browser.run_playwright_flow, risk: credential_sensitive, approval: required).
Proposed pattern
Every MCP tool that wraps a gated API surface gets a paired `*_via_browser` fallback, OR the existing tool detects 403 / scope errors and emits a structured `needs_browser_fallback` response the agent can route on. The agent's tool-selection logic should:
- Try the official MCP tool first (cheaper, reversible, no UI breakage risk).
- On 403 `USER_NOT_AUTHORIZED` / unmapped-scope error, surface the option to retry via browser.
- Browser path always goes through the approval gate (`credential_sensitive` risk) — never auto-triggered.
Where this matters next
- LinkedIn Lead Sync pull → if the org hasn't been approved for `r_marketing_leadgen_automation`, scrape Campaign Manager's Lead Center.
- LinkedIn Matched Audiences upload → if `rw_dmp_segments` is missing, drive the Audiences UI to attach the CSV.
- Google Ads Developer Token at Test level → fall back to driving Google Ads UI for any production-account action.
- Meta App Review pending → drive Meta Ads Manager UI for any non-allowlisted advertiser.
Acceptance
Why
Several high-value ad-platform capabilities are gated behind program approvals or limited OAuth scopes that take days–weeks to obtain — and a self-hosted YieldAgent user may never get them. Concrete examples already in the codebase:
r_marketing_leadgen_automation) — separate program approval; required forpull_lead_responses/subscribe_lead_webhook.rw_dmp_segments) — separate Audiences-program approval; required forcreate_dmp_segment,upload_audience_csv,add_dmp_users.When scope is missing, the agent should not silently fail. It should fall back to driving the platform's web UI through a browser — Playwright session via the existing
mcp-browser-controltool registry entry (browser.run_playwright_flow, risk:credential_sensitive, approval: required).Proposed pattern
Every MCP tool that wraps a gated API surface gets a paired `*_via_browser` fallback, OR the existing tool detects 403 / scope errors and emits a structured `needs_browser_fallback` response the agent can route on. The agent's tool-selection logic should:
Where this matters next
Acceptance