Open-source SEO, GEO, and marketing skills for AI agents.
feat(notfair-cmo): add Google Analytics + X Ads MCPs, platform logos
Yuting Zhongdf901ea639c1
diff --git a/notfair-cmo/public/mcp-logos/google-ads-icon.svg b/notfair-cmo/public/mcp-logos/google-ads-icon.svgnew file mode 100644index 00000000..37cfdb0e--- /dev/null+++ b/notfair-cmo/public/mcp-logos/google-ads-icon.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><style><![CDATA[.E{clip-path:url(#A)}]]></style><defs><clipPath id="A"><use xlink:href="#B"/></clipPath><path id="B" d="M0 0h250.9v312.8H0z"/></defs><g transform="matrix(.257748 0 0 .257745 -.361416 2.515516)" class="E"><path d="M85.9 28.6c2.4-6.3 5.7-12.1 10.6-16.8 19.6-19.1 52-14.3 65.3 9.7 10 18.2 20.6 36 30.9 54l51.6 89.8c14.3 25.1-1.2 56.8-29.6 61.1-17.4 2.6-33.7-5.4-42.7-21l-45.4-78.8c-.3-.6-.7-1.1-1.1-1.6-1.6-1.3-2.3-3.2-3.3-4.9L88.8 62.2c-3.9-6.8-5.7-14.2-5.5-22 .3-4 .8-8 2.6-11.6" fill="#3c8bd9"/><path d="M85.9 28.6c-.9 3.6-1.7 7.2-1.9 11-.3 8.4 1.8 16.2 6 23.5l32.9 56.9c1 1.7 1.8 3.4 2.8 5l-18.1 31.1-25.3 43.6c-.4 0-.5-.2-.6-.5-.1-.8.2-1.5.4-2.3 4.1-15 .7-28.3-9.6-39.7-6.3-6.9-14.3-10.8-23.5-12.1-12-1.7-22.6 1.4-32.1 8.9-1.7 1.3-2.8 3.2-4.8 4.2-.4 0-.6-.2-.7-.5l14.3-24.9L85.2 29.7c.2-.4.5-.7.7-1.1" fill="#fabc04"/><path d="M11.8 158l5.7-5.1c24.3-19.2 60.8-5.3 66.1 25.1 1.3 7.3.6 14.3-1.6 21.3-.1.6-.2 1.1-.4 1.7-.9 1.6-1.7 3.3-2.7 4.9-8.9 14.7-22 22-39.2 20.9C20 225.4 4.5 210.6 1.8 191c-1.3-9.5.6-18.4 5.5-26.6 1-1.8 2.2-3.4 3.3-5.2.5-.4.3-1.2 1.2-1.2" fill="#34a852"/><path d="M11.8 158c-.4.4-.4 1.1-1.1 1.2-.1-.7.3-1.1.7-1.6l.4.4" fill="#fabc04"/><path d="M81.6 201c-.4-.7 0-1.2.4-1.7l.4.4-.8 1.3" fill="#e1c025"/></g></svg>\ No newline at end of filediff --git a/notfair-cmo/public/mcp-logos/google-analytics-icon.svg b/notfair-cmo/public/mcp-logos/google-analytics-icon.svgnew file mode 100644index 00000000..2a812c5f--- /dev/null+++ b/notfair-cmo/public/mcp-logos/google-analytics-icon.svg@@ -0,0 +1,5 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">+ <rect x="16.4" y="3" width="4.6" height="18" rx="2.3" fill="#F9AB00"/>+ <rect x="9.7" y="10.5" width="4.6" height="10.5" rx="2.3" fill="#E37400"/>+ <circle cx="5.3" cy="18.7" r="2.3" fill="#E37400"/>+</svg>diff --git a/notfair-cmo/public/mcp-logos/meta-icon.svg b/notfair-cmo/public/mcp-logos/meta-icon.svgnew file mode 100644index 00000000..a8a8d948--- /dev/null+++ b/notfair-cmo/public/mcp-logos/meta-icon.svg@@ -0,0 +1 @@+<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Meta</title><path d="M6.897 4h-.024l-.031 2.615h.022c1.715 0 3.046 1.357 5.94 6.246l.175.297.012.02 1.62-2.438-.012-.019a48.763 48.763 0 00-1.098-1.716 28.01 28.01 0 00-1.175-1.629C10.413 4.932 8.812 4 6.896 4z" fill="url(#lobe-icons-meta-0-_R_0_)"></path><path d="M6.873 4C4.95 4.01 3.247 5.258 2.02 7.17a4.352 4.352 0 00-.01.017l2.254 1.231.011-.017c.718-1.083 1.61-1.774 2.568-1.785h.021L6.896 4h-.023z" fill="url(#lobe-icons-meta-1-_R_0_)"></path><path d="M2.019 7.17l-.011.017C1.2 8.447.598 9.995.274 11.664l-.005.022 2.534.6.004-.022c.27-1.467.786-2.828 1.456-3.845l.011-.017L2.02 7.17z" fill="url(#lobe-icons-meta-2-_R_0_)"></path><path d="M2.807 12.264l-2.533-.6-.005.022c-.177.918-.267 1.851-.269 2.786v.023l2.598.233v-.023a12.591 12.591 0 01.21-2.44z" fill="url(#lobe-icons-meta-3-_R_0_)"></path><path d="M2.677 15.537a5.462 5.462 0 01-.079-.813v-.022L0 14.468v.024a8.89 8.89 0 00.146 1.652l2.535-.585a4.106 4.106 0 01-.004-.022z" fill="url(#lobe-icons-meta-4-_R_0_)"></path><path d="M3.27 16.89c-.284-.31-.484-.756-.589-1.328l-.004-.021-2.535.585.004.021c.192 1.01.568 1.85 1.106 2.487l.014.017 2.018-1.745a2.106 2.106 0 01-.015-.016z" fill="url(#lobe-icons-meta-5-_R_0_)"></path><path d="M10.78 9.654c-1.528 2.35-2.454 3.825-2.454 3.825-2.035 3.2-2.739 3.917-3.871 3.917a1.545 1.545 0 01-1.186-.508l-2.017 1.744.014.017C2.01 19.518 3.058 20 4.356 20c1.963 0 3.374-.928 5.884-5.33l1.766-3.13a41.283 41.283 0 00-1.227-1.886z" fill="#0082FB"></path><path d="M13.502 5.946l-.016.016c-.4.43-.786.908-1.16 1.416.378.483.768 1.024 1.175 1.63.48-.743.928-1.345 1.367-1.807l.016-.016-1.382-1.24z" fill="url(#lobe-icons-meta-6-_R_0_)"></path><path d="M20.918 5.713C19.853 4.633 18.583 4 17.225 4c-1.432 0-2.637.787-3.723 1.944l-.016.016 1.382 1.24.016-.017c.715-.747 1.408-1.12 2.176-1.12.826 0 1.6.39 2.27 1.075l.015.016 1.589-1.425-.016-.016z" fill="#0082FB"></path><path d="M23.998 14.125c-.06-3.467-1.27-6.566-3.064-8.396l-.016-.016-1.588 1.424.015.016c1.35 1.392 2.277 3.98 2.361 6.971v.023h2.292v-.022z" fill="url(#lobe-icons-meta-7-_R_0_)"></path><path d="M23.998 14.15v-.023h-2.292v.022c.004.14.006.282.006.424 0 .815-.121 1.474-.368 1.95l-.011.022 1.708 1.782.013-.02c.62-.96.946-2.293.946-3.91 0-.083 0-.165-.002-.247z" fill="url(#lobe-icons-meta-8-_R_0_)"></path><path d="M21.344 16.52l-.011.02c-.214.402-.519.67-.917.787l.778 2.462a3.493 3.493 0 00.438-.182 3.558 3.558 0 001.366-1.218l.044-.065.012-.02-1.71-1.784z" fill="url(#lobe-icons-meta-9-_R_0_)"></path><path d="M19.92 17.393c-.262 0-.492-.039-.718-.14l-.798 2.522c.449.153.927.222 1.46.222.492 0 .943-.073 1.352-.215l-.78-2.462c-.167.05-.341.075-.517.073z" fill="url(#lobe-icons-meta-10-_R_0_)"></path><path d="M18.323 16.534l-.014-.017-1.836 1.914.016.017c.637.682 1.246 1.105 1.937 1.337l.797-2.52c-.291-.125-.573-.353-.9-.731z" fill="url(#lobe-icons-meta-11-_R_0_)"></path><path d="M18.309 16.515c-.55-.642-1.232-1.712-2.303-3.44l-1.396-2.336-.011-.02-1.62 2.438.012.02.989 1.668c.959 1.61 1.74 2.774 2.493 3.585l.016.016 1.834-1.914a2.353 2.353 0 01-.014-.017z" fill="url(#lobe-icons-meta-12-_R_0_)"></path><defs><linearGradient id="lobe-icons-meta-0-_R_0_" x1="75.897%" x2="26.312%" y1="89.199%" y2="12.194%"><stop offset=".06%" stop-color="#0867DF"></stop><stop offset="45.39%" stop-color="#0668E1"></stop><stop offset="85.91%" stop-color="#0064E0"></stop></linearGradient><linearGradient id="lobe-icons-meta-1-_R_0_" x1="21.67%" x2="97.068%" y1="75.874%" y2="23.985%"><stop offset="13.23%" stop-color="#0064DF"></stop><stop offset="99.88%" stop-color="#0064E0"></stop></linearGradient><linearGradient id="lobe-icons-meta-2-_R_0_" x1="38.263%" x2="60.895%" y1="89.127%" y2="16.131%"><stop offset="1.47%" stop-color="#0072EC"></stop><stop offset="68.81%" stop-color="#0064DF"></stop></linearGradient><linearGradient id="lobe-icons-meta-3-_R_0_" x1="47.032%" x2="52.15%" y1="90.19%" y2="15.745%"><stop offset="7.31%" stop-color="#007CF6"></stop><stop offset="99.43%" stop-color="#0072EC"></stop></linearGradient><linearGradient id="lobe-icons-meta-4-_R_0_" x1="52.155%" x2="47.591%" y1="58.301%" y2="37.004%"><stop offset="7.31%" stop-color="#007FF9"></stop><stop offset="100%" stop-color="#007CF6"></stop></linearGradient><linearGradient id="lobe-icons-meta-5-_R_0_" x1="37.689%" x2="61.961%" y1="12.502%" y2="63.624%"><stop offset="7.31%" stop-color="#007FF9"></stop><stop offset="100%" stop-color="#0082FB"></stop></linearGradient><linearGradient id="lobe-icons-meta-6-_R_0_" x1="34.808%" x2="62.313%" y1="68.859%" y2="23.174%"><stop offset="27.99%" stop-color="#007FF8"></stop><stop offset="91.41%" stop-color="#0082FB"></stop></linearGradient><linearGradient id="lobe-icons-meta-7-_R_0_" x1="43.762%" x2="57.602%" y1="6.235%" y2="98.514%"><stop offset="0%" stop-color="#0082FB"></stop><stop offset="99.95%" stop-color="#0081FA"></stop></linearGradient><linearGradient id="lobe-icons-meta-8-_R_0_" x1="60.055%" x2="39.88%" y1="4.661%" y2="69.077%"><stop offset="6.19%" stop-color="#0081FA"></stop><stop offset="100%" stop-color="#0080F9"></stop></linearGradient><linearGradient id="lobe-icons-meta-9-_R_0_" x1="30.282%" x2="61.081%" y1="59.32%" y2="33.244%"><stop offset="0%" stop-color="#027AF3"></stop><stop offset="100%" stop-color="#0080F9"></stop></linearGradient><linearGradient id="lobe-icons-meta-10-_R_0_" x1="20.433%" x2="82.112%" y1="50.001%" y2="50.001%"><stop offset="0%" stop-color="#0377EF"></stop><stop offset="99.94%" stop-color="#0279F1"></stop></linearGradient><linearGradient id="lobe-icons-meta-11-_R_0_" x1="40.303%" x2="72.394%" y1="35.298%" y2="57.811%"><stop offset=".19%" stop-color="#0471E9"></stop><stop offset="100%" stop-color="#0377EF"></stop></linearGradient><linearGradient id="lobe-icons-meta-12-_R_0_" x1="32.254%" x2="68.003%" y1="19.719%" y2="84.908%"><stop offset="27.65%" stop-color="#0867DF"></stop><stop offset="100%" stop-color="#0471E9"></stop></linearGradient></defs></svg>\ No newline at end of filediff --git a/notfair-cmo/public/mcp-logos/search-console-icon.svg b/notfair-cmo/public/mcp-logos/search-console-icon.svgnew file mode 100644index 00000000..a2c30653--- /dev/null+++ b/notfair-cmo/public/mcp-logos/search-console-icon.svg@@ -0,0 +1 @@+<svg height="2500" viewBox="6.239 2.66350997 503.09749003 503.10849003" width="2500" xmlns="http://www.w3.org/2000/svg"><g fill="none"><path d="m113.296 424.432-75.52 75.536c-5.825 5.804-15.247 5.804-21.072 0l-4.672-4.672c-5.793-5.823-5.793-15.233 0-21.056l75.52-75.536c5.827-5.814 15.26-5.814 21.088 0l4.656 4.656a14.88 14.88 0 0 1 0 21.072z" fill="#fbbc04"/><path d="m316 456h96.672a96.64 96.64 0 0 0 96.656-96.672v-260a96.64 96.64 0 0 0 -96.656-96.656 96.64 96.64 0 0 0 -96.672 96.656z" fill="#4285f4"/><path d="m156 456a96.64 96.64 0 0 0 96.672-96.672 96.64 96.64 0 0 0 -96.672-96.656 96.64 96.64 0 0 0 -96.672 96.656 96.64 96.64 0 0 0 96.672 96.672z" fill="#fbbc04"/><path d="m383.52 456h-94.192a96.64 96.64 0 0 1 -96.656-96.672v-126.656a96.64 96.64 0 0 1 96.656-96.672 96.64 96.64 0 0 1 96.672 96.672v220.864a2.464 2.464 0 0 1 -2.464 2.464z" fill="#34a853"/><path d="m386 453.536v-220.864c-.003-43.115-28.558-81.016-70-92.912v316.24h67.52a2.464 2.464 0 0 0 2.48-2.464z" fill="#1967d2"/><path d="m252.672 361.2c.006-39.228-23.701-74.567-60-89.44v89.44c0 27.52 11.52 52.368 30 69.968a96.384 96.384 0 0 0 30-69.968z" fill="#ea4335"/></g></svg>\ No newline at end of filediff --git a/notfair-cmo/public/mcp-logos/x-ads-icon.svg b/notfair-cmo/public/mcp-logos/x-ads-icon.svgnew file mode 100644index 00000000..3e889482--- /dev/null+++ b/notfair-cmo/public/mcp-logos/x-ads-icon.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true"><rect width="24" height="24" rx="4" fill="#000000"/><path fill="#FFFFFF" transform="translate(4.8 4.8) scale(0.6)" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231 5.45-6.231Zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77Z"/></svg>diff --git a/notfair-cmo/src/components/mcp-icon.test.tsx b/notfair-cmo/src/components/mcp-icon.test.tsxnew file mode 100644index 00000000..3d1f4953--- /dev/null+++ b/notfair-cmo/src/components/mcp-icon.test.tsx@@ -0,0 +1,81 @@+// @vitest-environment jsdom+import { describe, expect, it, afterEach } from "vitest";+import { cleanup, render, screen } from "@testing-library/react";++import { McpIcon, brandDomain, platformLogoForResourceUrl } from "./mcp-icon";++afterEach(() => {+ cleanup();+});++describe("platformLogoForResourceUrl", () => {+ it("maps every NotFair-hosted platform MCP to its bundled logo", () => {+ expect(+ platformLogoForResourceUrl("https://notfair.co/api/mcp/google_ads"),+ ).toBe("/mcp-logos/google-ads-icon.svg");+ expect(+ platformLogoForResourceUrl("https://notfair.co/api/mcp/meta_ads"),+ ).toBe("/mcp-logos/meta-icon.svg");+ expect(+ platformLogoForResourceUrl(+ "https://notfair.co/api/mcp/google_search_console",+ ),+ ).toBe("/mcp-logos/search-console-icon.svg");+ expect(+ platformLogoForResourceUrl("https://notfair.co/api/mcp/google_analytics"),+ ).toBe("/mcp-logos/google-analytics-icon.svg");+ expect(platformLogoForResourceUrl("https://notfair.co/api/mcp/x_ads")).toBe(+ "/mcp-logos/x-ads-icon.svg",+ );+ });++ it("tolerates a trailing slash and www-style subdomains", () => {+ expect(+ platformLogoForResourceUrl("https://www.notfair.co/api/mcp/google_ads/"),+ ).toBe("/mcp-logos/google-ads-icon.svg");+ });++ it("returns null for third-party servers, unknown platforms, and junk", () => {+ expect(platformLogoForResourceUrl("https://mcp.stripe.com/")).toBeNull();+ expect(+ platformLogoForResourceUrl("https://notfair.co/api/mcp/unknown_platform"),+ ).toBeNull();+ expect(platformLogoForResourceUrl("https://notfair.co/")).toBeNull();+ expect(platformLogoForResourceUrl("not a url")).toBeNull();+ });++ it("does not match notfair.co paths outside /api/mcp/", () => {+ expect(+ platformLogoForResourceUrl("https://notfair.co/blog/google_ads"),+ ).toBeNull();+ });+});++describe("McpIcon", () => {+ it("renders the bundled platform logo for a NotFair platform MCP", () => {+ render(+ <McpIcon+ resourceUrl="https://notfair.co/api/mcp/x_ads"+ alt="NotFair X Ads"+ />,+ );+ expect(screen.getByAltText("NotFair X Ads")).toHaveAttribute(+ "src",+ "/mcp-logos/x-ads-icon.svg",+ );+ });++ it("falls back to the brand favicon for third-party servers", () => {+ render(<McpIcon resourceUrl="https://mcp.stripe.com/" alt="Stripe" />);+ expect(screen.getByAltText("Stripe").getAttribute("src")).toContain(+ "stripe.com",+ );+ });+});++describe("brandDomain", () => {+ it("collapses subdomains to the registrable domain", () => {+ expect(brandDomain("mcp.stripe.com")).toBe("stripe.com");+ expect(brandDomain("notfair.co")).toBe("notfair.co");+ });+});diff --git a/notfair-cmo/src/components/mcp-icon.tsx b/notfair-cmo/src/components/mcp-icon.tsxindex 852e931e..14f57e93 100644--- a/notfair-cmo/src/components/mcp-icon.tsx+++ b/notfair-cmo/src/components/mcp-icon.tsx@@ -4,10 +4,44 @@ import { useState } from "react";import { Plug } from "lucide-react";/**- * Brand favicon for an MCP server, fetched via Google's `faviconV2`- * service. Subdomain-aware: `mcp.stripe.com` resolves to `stripe.com`- * so we get the company brand mark, not the API-subdomain glyph (which- * usually isn't indexed).+ * NotFair-hosted platform MCPs all live on `notfair.co`, so the favicon+ * heuristic below would render the NotFair mark for every one of them.+ * Map each `/api/mcp/<platform>` path to the actual platform's logo+ * (bundled under `public/mcp-logos/`) so the row reads as the platform+ * the user is connecting, not the host serving it.+ */+const PLATFORM_LOGO_BY_MCP_PATH: Record<string, string> = {+ google_ads: "/mcp-logos/google-ads-icon.svg",+ meta_ads: "/mcp-logos/meta-icon.svg",+ google_search_console: "/mcp-logos/search-console-icon.svg",+ google_analytics: "/mcp-logos/google-analytics-icon.svg",+ x_ads: "/mcp-logos/x-ads-icon.svg",+};++/**+ * Local platform-logo path for a NotFair-hosted MCP resource URL, or+ * null when the URL isn't a `notfair.co/api/mcp/<platform>` resource+ * (user-added servers, third-party connectors → favicon fallback).+ */+export function platformLogoForResourceUrl(resourceUrl: string): string | null {+ try {+ const url = new URL(resourceUrl);+ if (brandDomain(url.hostname) !== "notfair.co") return null;+ const match = url.pathname.match(/^\/api\/mcp\/([a-z0-9_]+)\/?$/);+ if (!match) return null;+ return PLATFORM_LOGO_BY_MCP_PATH[match[1]!] ?? null;+ } catch {+ return null;+ }+}++/**+ * Brand icon for an MCP server. NotFair-hosted platform MCPs render the+ * bundled platform logo (Google Ads, Meta, …); everything else falls+ * back to the brand favicon fetched via Google's `faviconV2` service.+ * Subdomain-aware: `mcp.stripe.com` resolves to `stripe.com` so we get+ * the company brand mark, not the API-subdomain glyph (which usually+ * isn't indexed).** Falls back to the `Plug` lucide icon on malformed input or image* load failure.@@ -28,8 +62,9 @@ export function McpIcon({} catch {host = null;}+ const platformLogo = platformLogoForResourceUrl(resourceUrl);const brandHost = host ? brandDomain(host) : null;- const showImg = !!brandHost && !errored;+ const showImg = !!(platformLogo ?? brandHost) && !errored;const boxClass = size === "lg" ? "size-10" : "size-9";const imgClass = size === "lg" ? "size-6" : "size-5";const fallbackClass = size === "lg" ? "size-5" : "size-4";@@ -40,7 +75,10 @@ export function McpIcon({{showImg ? (// eslint-disable-next-line @next/next/no-img-element<img- src={`https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://${brandHost}&size=32`}+ src={+ platformLogo ??+ `https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://${brandHost}&size=32`+ }alt={alt}width={32}height={32}diff --git a/notfair-cmo/src/components/onboarding-flow.test.tsx b/notfair-cmo/src/components/onboarding-flow.test.tsxindex 59916b0e..b44bd09e 100644--- a/notfair-cmo/src/components/onboarding-flow.test.tsx+++ b/notfair-cmo/src/components/onboarding-flow.test.tsx@@ -129,6 +129,8 @@ beforeEach(() => {googleads: { connected: false, account_selected: false },metaads: { connected: false, account_selected: false },gsc: { connected: false, account_selected: false },+ googleanalytics: { connected: false, account_selected: false },+ xads: { connected: false, account_selected: false },extras: [],extra_connected_count: 0,website_url: null,@@ -231,7 +233,7 @@ describe("OnboardingFlow — MissingSlug", () => {});describe("OnboardingFlow — ConnectStep", () => {- it("renders the three recommended-MCP tiles + Skip when nothing is connected", async () => {+ it("renders the five recommended-MCP tiles + Skip when nothing is connected", async () => {setStep("connect", "acme");render(<OnboardingFlow />);expect(@@ -246,6 +248,12 @@ describe("OnboardingFlow — ConnectStep", () => {expect(screen.getByRole("button", { name: /Google Search Console/i }),).toBeInTheDocument();+ expect(+ screen.getByRole("button", { name: /^Google Analytics/i }),+ ).toBeInTheDocument();+ expect(+ screen.getByRole("button", { name: /^X Ads/i }),+ ).toBeInTheDocument();expect(screen.getByRole("button", { name: /More tools/i }),).toBeInTheDocument();@@ -254,6 +262,26 @@ describe("OnboardingFlow — ConnectStep", () => {).toBeInTheDocument();});+ it("starts OAuth for a no-picker MCP (Google Analytics) with a connect-step return_to", async () => {+ const loc = setLocationHref();+ startMcpConnect.mockResolvedValue({+ ok: true,+ authorize_url: "https://issuer.example/oauth",+ });+ setStep("connect", "acme");+ render(<OnboardingFlow />);+ fireEvent.click(+ await screen.findByRole("button", { name: /^Google Analytics/i }),+ );+ await waitFor(() =>+ expect(startMcpConnect).toHaveBeenCalledWith({+ mcp_key: "notfair-googleanalytics",+ return_to: "/onboarding?step=connect&slug=acme",+ }),+ );+ await waitFor(() => expect(loc.href).toBe("https://issuer.example/oauth"));+ });+it("starts OAuth for Google Ads with a connect-step return_to", async () => {const loc = setLocationHref();startMcpConnect.mockResolvedValue({@@ -312,6 +340,8 @@ describe("OnboardingFlow — ConnectStep", () => {googleads: { connected: true, account_selected: true },metaads: { connected: false, account_selected: false },gsc: { connected: false, account_selected: false },+ googleanalytics: { connected: false, account_selected: false },+ xads: { connected: false, account_selected: false },extras: [],extra_connected_count: 0,website_url: null,@@ -337,6 +367,8 @@ describe("OnboardingFlow — ConnectStep", () => {googleads: { connected: false, account_selected: false },metaads: { connected: false, account_selected: false },gsc: { connected: false, account_selected: false },+ googleanalytics: { connected: false, account_selected: false },+ xads: { connected: false, account_selected: false },extras: [{key: "stripe",@@ -373,6 +405,8 @@ describe("OnboardingFlow — ConnectStep", () => {googleads: { connected: true, account_selected: false },metaads: { connected: false, account_selected: false },gsc: { connected: false, account_selected: false },+ googleanalytics: { connected: false, account_selected: false },+ xads: { connected: false, account_selected: false },extras: [],extra_connected_count: 0,website_url: null,diff --git a/notfair-cmo/src/components/onboarding-flow.tsx b/notfair-cmo/src/components/onboarding-flow.tsxindex 08f31342..8dd3bde3 100644--- a/notfair-cmo/src/components/onboarding-flow.tsx+++ b/notfair-cmo/src/components/onboarding-flow.tsx@@ -385,10 +385,11 @@ function HarnessPicker({ disabled }: { disabled: boolean }) {// ── Step 2: Connect ────────────────────────────────────────────────/**- * Spec for one of the recommended-MCP tiles in the connect step. The three- * recommended MCPs (Google Ads, Meta Ads, Google Search Console) each get- * their own first-class tile because connecting them triggers the- * provisioning of a matching specialist agent.+ * Spec for one of the recommended-MCP tiles in the connect step. The core+ * MCPs (Google Ads, Meta Ads, Google Search Console) each get their own+ * first-class tile because connecting them triggers the provisioning of a+ * matching specialist agent; Google Analytics and X Ads get tiles too but+ * provision no specialist (their data flows to the CMO + existing agents).*/type RecommendedTile = {mcp_key: string;@@ -398,20 +399,22 @@ type RecommendedTile = {mcp_display_name: string;/** Short agent label rendered as a pill badge next to the title,* e.g. "Google Ads agent". The badge makes the MCP↔agent dependency- * explicit so users understand connecting this MCP enables that agent. */- agent_badge: string;+ * explicit so users understand connecting this MCP enables that agent.+ * Absent for MCPs that don't provision a specialist. */+ agent_badge?: string;/** What the user gets — phrased as the agent's capabilities (verbs),* not the MCP's data surfaces (nouns). Concrete benefit over abstract* feature listing. */description: string;- /** Resource URL the OAuth flow targets — also feeds <McpIcon>'s favicon+ /** Resource URL the OAuth flow targets — also feeds <McpIcon>'s icon* lookup so each tile shows the brand mark the connections page uses. */resource_url: string;/** Sub-step the OAuth callback should land on so the user can pick an- * account/property when their token covers more than one. */- account_step: "account" | "meta-account" | "gsc-property";+ * account/property when their token covers more than one. Absent when+ * the MCP has no picker — OAuth returns straight to the connect step. */+ account_step?: "account" | "meta-account" | "gsc-property";/** Label for the "Select X" sub-action when connected but not selected. */- account_action_label: string;+ account_action_label?: string;};const RECOMMENDED_TILES: RecommendedTile[] = [@@ -447,6 +450,20 @@ const RECOMMENDED_TILES: RecommendedTile[] = [account_step: "gsc-property",account_action_label: "Select GSC property",},+ {+ mcp_key: "notfair-googleanalytics",+ mcp_display_name: "Google Analytics MCP",+ description:+ "Analyzes GA4 traffic, channels, and conversions; explains what moved and why.",+ resource_url: "https://notfair.co/api/mcp/google_analytics",+ },+ {+ mcp_key: "notfair-xads",+ mcp_display_name: "X Ads MCP",+ description:+ "Audits X (Twitter) campaigns and line items, tracks spend and engagement.",+ resource_url: "https://notfair.co/api/mcp/x_ads",+ },];type ConnectStepStateView =@@ -486,8 +503,9 @@ function ConnectStep({ slug }: { slug: string }) {// step. That step auto-skips if the bearer covers a single// account/property; otherwise it shows a picker. Both paths// ultimately redirect back to /onboarding?step=connect so the- // user can continue adding tools.- return_to: `/onboarding?step=${tile.account_step}&slug=${encodeURIComponent(slug)}`,+ // user can continue adding tools. MCPs without a picker return+ // straight to the connect step.+ return_to: `/onboarding?step=${tile.account_step ?? "connect"}&slug=${encodeURIComponent(slug)}`,});if (!result.ok) {toast.error(result.error);@@ -502,6 +520,7 @@ function ConnectStep({ slug }: { slug: string }) {}function onPickAccount(tile: RecommendedTile) {+ if (!tile.account_step) return;router.push(`/onboarding?step=${tile.account_step}&slug=${encodeURIComponent(slug)}`,);@@ -556,11 +575,15 @@ function ConnectStep({ slug }: { slug: string }) {"notfair-googleads": state.googleads,"notfair-metaads": state.metaads,"notfair-googlesearchconsole": state.gsc,+ "notfair-googleanalytics": state.googleanalytics,+ "notfair-xads": state.xads,} as const;const anyConnected =state.googleads.connected ||state.metaads.connected ||state.gsc.connected ||+ state.googleanalytics.connected ||+ state.xads.connected ||state.extra_connected_count > 0;return (@@ -609,6 +632,10 @@ function ConnectStep({ slug }: { slug: string }) {...(state.googleads.connected ? ["notfair-googleads"] : []),...(state.metaads.connected ? ["notfair-metaads"] : []),...(state.gsc.connected ? ["notfair-googlesearchconsole"] : []),+ ...(state.googleanalytics.connected+ ? ["notfair-googleanalytics"]+ : []),+ ...(state.xads.connected ? ["notfair-xads"] : []),...state.extras.map((e) => e.key),]}trigger={@@ -695,7 +722,11 @@ function RecommendedConnectorTile({type="button"onClick={state.connected ? undefined : onConnect}disabled={busy || disabled}- aria-label={`${tile.mcp_display_name} — required for ${tile.agent_badge}`}+ aria-label={+ tile.agent_badge+ ? `${tile.mcp_display_name} — required for ${tile.agent_badge}`+ : tile.mcp_display_name+ }className={`ns-tile w-full ${state.connected ? "is-connected" : ""}`}// When already connected, the row itself is non-actionable; the// sub-action below handles "pick account" and the row would@@ -708,12 +739,14 @@ function RecommendedConnectorTile({<span className="ns-tile-body"><span className="ns-tile-name-row"><span className="ns-tile-name">{tile.mcp_display_name}</span>- <span className="ns-tile-badge">- Required for {tile.agent_badge}- </span>+ {tile.agent_badge && (+ <span className="ns-tile-badge">+ Required for {tile.agent_badge}+ </span>+ )}</span><span className="ns-tile-desc block">{tile.description}</span>- {state.connected && !state.account_selected && (+ {tile.account_step && state.connected && !state.account_selected && (<buttontype="button"onClick={(e) => {diff --git a/notfair-cmo/src/server/mcp-catalog.test.ts b/notfair-cmo/src/server/mcp-catalog.test.tsindex ffb06ca3..ded80fe1 100644--- a/notfair-cmo/src/server/mcp-catalog.test.ts+++ b/notfair-cmo/src/server/mcp-catalog.test.ts@@ -72,6 +72,16 @@ describe("MCP_CATALOG_PRESETS", () => {const keys = MCP_CATALOG_PRESETS.map((m) => m.key);expect(new Set(keys).size).toBe(keys.length);});++ it("ships the five NotFair platform presets", () => {+ expect(MCP_CATALOG_PRESETS.map((m) => m.key)).toEqual([+ "notfair-googleads",+ "notfair-metaads",+ "notfair-googlesearchconsole",+ "notfair-googleanalytics",+ "notfair-xads",+ ]);+ });});describe("isPresetKey", () => {diff --git a/notfair-cmo/src/server/mcp-catalog.ts b/notfair-cmo/src/server/mcp-catalog.tsindex 9ef67445..6398d9d7 100644--- a/notfair-cmo/src/server/mcp-catalog.ts+++ b/notfair-cmo/src/server/mcp-catalog.ts@@ -64,6 +64,26 @@ export const MCP_CATALOG_PRESETS: McpSpec[] = ["https://notfair.co/.well-known/oauth-protected-resource/api/mcp/google_search_console",source: "preset",},+ {+ key: "notfair-googleanalytics",+ display_name: "NotFair Google Analytics",+ description:+ "GA4 traffic and conversion analytics: sessions, channels, pages, events, audiences.",+ resource_url: "https://notfair.co/api/mcp/google_analytics",+ discovery_url:+ "https://notfair.co/.well-known/oauth-protected-resource/api/mcp/google_analytics",+ source: "preset",+ },+ {+ key: "notfair-xads",+ display_name: "NotFair X Ads",+ description:+ "Live X (Twitter) Ads operations: campaigns, line items, promoted posts, analytics.",+ resource_url: "https://notfair.co/api/mcp/x_ads",+ discovery_url:+ "https://notfair.co/.well-known/oauth-protected-resource/api/mcp/x_ads",+ source: "preset",+ },];/** True if any preset reserves this key. Presets win over user rows. */diff --git a/notfair-cmo/src/server/onboarding/accounts.ts b/notfair-cmo/src/server/onboarding/accounts.tsindex ba874789..ae78d40e 100644--- a/notfair-cmo/src/server/onboarding/accounts.ts+++ b/notfair-cmo/src/server/onboarding/accounts.ts@@ -706,7 +706,8 @@ export async function setOnboardingGscPropertyAction(// ── Onboarding connect-step state ──────────────────────────────────//// The multi-MCP onboarding step renders one tile per recommended MCP-// (Google Ads, Meta Ads, GSC) plus a "More" tile. Each tile needs:+// (Google Ads, Meta Ads, GSC, Google Analytics, X Ads) plus a "More"+// tile. Each tile needs://// - is the MCP connected? (token row exists)// - is an account/property selected on the project row?@@ -742,6 +743,13 @@ export type ConnectStepState = {googleads: ConnectedMcpState;metaads: ConnectedMcpState;gsc: ConnectedMcpState;+ /**+ * Google Analytics + X Ads have first-class connect tiles like the trio+ * above, but no account/property picker sub-flow — `account_selected`+ * simply mirrors `connected` so the tile shape stays uniform.+ */+ googleanalytics: ConnectedMcpState;+ xads: ConnectedMcpState;/*** MCPs the user has connected via the "More tools" overflow dialog —* anything outside the recommended trio (Stripe, Supabase, PostHog,@@ -783,6 +791,8 @@ export async function getConnectStepStateAction("notfair-googleads","notfair-metaads","notfair-googlesearchconsole",+ "notfair-googleanalytics",+ "notfair-xads",]);const allTokens = listProjectMcpTokens(project_slug);const catalog = getMcpCatalog(project_slug);@@ -820,6 +830,14 @@ export async function getConnectStepStateAction(connected: !!findMcpToken(project_slug, "notfair-googlesearchconsole"),account_selected: !!project.gsc_property_id,},+ googleanalytics: (() => {+ const connected = !!findMcpToken(project_slug, "notfair-googleanalytics");+ return { connected, account_selected: connected };+ })(),+ xads: (() => {+ const connected = !!findMcpToken(project_slug, "notfair-xads");+ return { connected, account_selected: connected };+ })(),extras,extra_connected_count: extras.length,website_url: project.website_url,