Skip to content

Open-source SEO, GEO, and marketing skills for AI agents.

Drop default-account hint from MCP account pickers

Yuting Zhongd551297649be
diff --git a/notfair/src/components/mcp-account-picker-dialog.test.tsx b/notfair/src/components/mcp-account-picker-dialog.test.tsx
index d6f75eb4..295e83d1 100644
--- a/notfair/src/components/mcp-account-picker-dialog.test.tsx
+++ b/notfair/src/components/mcp-account-picker-dialog.test.tsx
@@ -48,15 +48,15 @@ describe("McpAccountPickerDialog", () => {
prefetch: {
ok: true,
items: [
- { id: "sc-domain:a.com", name: "a.com", is_default: false },
- { id: "sc-domain:b.com", name: "b.com", is_default: true },
+ { id: "sc-domain:a.com", name: "a.com" },
+ { id: "sc-domain:b.com", name: "b.com" },
],
},
});
expect(
await screen.findByRole("button", { name: /Use a\.com/ }),
).toBeInTheDocument();
- expect(screen.getByText("default")).toBeInTheDocument();
+ expect(screen.queryByText("default")).not.toBeInTheDocument();
expect(listGscProperties).not.toHaveBeenCalled();
});
@@ -66,8 +66,8 @@ describe("McpAccountPickerDialog", () => {
prefetch: {
ok: true,
items: [
- { id: "sc-domain:a.com", name: "a.com", is_default: false },
- { id: "sc-domain:b.com", name: "b.com", is_default: false },
+ { id: "sc-domain:a.com", name: "a.com" },
+ { id: "sc-domain:b.com", name: "b.com" },
],
},
});
@@ -84,7 +84,6 @@ describe("McpAccountPickerDialog", () => {
vi.mocked(listGscProperties).mockResolvedValue({
ok: true,
properties: [{ id: "sc-domain:a.com", name: "a.com" }],
- default_property_id: null,
});
renderDialog();
expect(
@@ -97,7 +96,6 @@ describe("McpAccountPickerDialog", () => {
vi.mocked(listGscProperties).mockResolvedValue({
ok: true,
properties: [],
- default_property_id: null,
});
renderDialog();
expect(
@@ -113,7 +111,7 @@ describe("McpAccountPickerDialog", () => {
const { onOpenChange, onPicked } = renderDialog({
prefetch: {
ok: true,
- items: [{ id: "sc-domain:a.com", name: "a.com", is_default: false }],
+ items: [{ id: "sc-domain:a.com", name: "a.com" }],
},
});
fireEvent.click(await screen.findByRole("button", { name: /Use a\.com/ }));
@@ -135,7 +133,7 @@ describe("McpAccountPickerDialog", () => {
const { onOpenChange, onPicked } = renderDialog({
prefetch: {
ok: true,
- items: [{ id: "sc-domain:a.com", name: "a.com", is_default: false }],
+ items: [{ id: "sc-domain:a.com", name: "a.com" }],
},
});
fireEvent.click(await screen.findByRole("button", { name: /Use a\.com/ }));
diff --git a/notfair/src/components/mcp-account-picker-dialog.tsx b/notfair/src/components/mcp-account-picker-dialog.tsx
index 8dc7dfd4..974d4080 100644
--- a/notfair/src/components/mcp-account-picker-dialog.tsx
+++ b/notfair/src/components/mcp-account-picker-dialog.tsx
@@ -199,11 +199,6 @@ export function McpAccountPickerDialog({
current
</span>
)}
- {item.is_default && !isSelected && (
- <span className="rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground">
- default
- </span>
- )}
</div>
<p className="truncate text-xs text-muted-foreground tabular-nums">
{picker.id_label} {item.id}
diff --git a/notfair/src/lib/mcp-account-pickers.test.ts b/notfair/src/lib/mcp-account-pickers.test.ts
index f6a528ac..963fc59a 100644
--- a/notfair/src/lib/mcp-account-pickers.test.ts
+++ b/notfair/src/lib/mcp-account-pickers.test.ts
@@ -60,21 +60,20 @@ describe("accountPickerFor", () => {
});
describe("list normalization", () => {
- it("maps Google Ads accounts and flags the MCP default", async () => {
+ it("maps Google Ads accounts without a default flag", async () => {
vi.mocked(listGoogleAdsAccounts).mockResolvedValue({
ok: true,
accounts: [
{ id: "111", name: "Acme" },
{ id: "222", name: "Beta" },
],
- default_account_id: "222",
});
const r = await accountPickerFor("notfair-googleads")!.list("proj");
expect(r).toEqual({
ok: true,
items: [
- { id: "111", name: "Acme", is_default: false },
- { id: "222", name: "Beta", is_default: true },
+ { id: "111", name: "Acme" },
+ { id: "222", name: "Beta" },
],
});
expect(listGoogleAdsAccounts).toHaveBeenCalledWith("proj");
@@ -86,12 +85,11 @@ describe("list normalization", () => {
properties: [
{ id: "sc-domain:a.com", name: "a.com", permission: "siteOwner" },
],
- default_property_id: null,
});
const r = await accountPickerFor("notfair-googlesearchconsole")!.list("p");
expect(r).toEqual({
ok: true,
- items: [{ id: "sc-domain:a.com", name: "a.com", is_default: false }],
+ items: [{ id: "sc-domain:a.com", name: "a.com" }],
});
});
diff --git a/notfair/src/lib/mcp-account-pickers.ts b/notfair/src/lib/mcp-account-pickers.ts
index fe56f0fe..f3e8cf30 100644
--- a/notfair/src/lib/mcp-account-pickers.ts
+++ b/notfair/src/lib/mcp-account-pickers.ts
@@ -27,8 +27,6 @@ import type { Project } from "@/types";
export type AccountPickerItem = {
id: string;
name: string;
- /** True when the MCP flagged this entry as the bearer's default. */
- is_default: boolean;
};
export type AccountPickerListResult =
@@ -66,7 +64,6 @@ const PICKERS: Record<string, AccountPickerSpec> = {
items: r.accounts.map((a) => ({
id: a.id,
name: a.name,
- is_default: a.id === r.default_account_id,
})),
};
},
@@ -88,7 +85,6 @@ const PICKERS: Record<string, AccountPickerSpec> = {
items: r.accounts.map((a) => ({
id: a.id,
name: a.name,
- is_default: a.id === r.default_account_id,
})),
};
},
@@ -110,7 +106,6 @@ const PICKERS: Record<string, AccountPickerSpec> = {
items: r.properties.map((p) => ({
id: p.id,
name: p.name,
- is_default: p.id === r.default_property_id,
})),
};
},
diff --git a/notfair/src/server/mcp/account-selection.test.ts b/notfair/src/server/mcp/account-selection.test.ts
index 1ec6de0e..e888ca54 100644
--- a/notfair/src/server/mcp/account-selection.test.ts
+++ b/notfair/src/server/mcp/account-selection.test.ts
@@ -44,7 +44,6 @@ function gscList(ids: string[]) {
vi.mocked(listGscProperties).mockResolvedValue({
ok: true,
properties: ids.map((id) => ({ id, name: id })),
- default_property_id: null,
});
}
@@ -126,7 +125,6 @@ describe("resolvePostConnectSelection", () => {
vi.mocked(listGoogleAdsAccounts).mockResolvedValue({
ok: true,
accounts: [{ id: "123", name: "Only" }],
- default_account_id: null,
});
await resolvePostConnectSelection("proj", "notfair-googleads");
expect(setProjectGoogleAdsAccount).toHaveBeenCalledWith("proj", "123");
@@ -159,8 +157,8 @@ describe("prefetchAccountChoice", () => {
prefetch: {
ok: true,
items: [
- { id: "sc-domain:a.com", name: "sc-domain:a.com", is_default: false },
- { id: "sc-domain:b.com", name: "sc-domain:b.com", is_default: false },
+ { id: "sc-domain:a.com", name: "sc-domain:a.com" },
+ { id: "sc-domain:b.com", name: "sc-domain:b.com" },
],
},
selected_id: "sc-domain:gone.com",
diff --git a/notfair/src/server/onboarding/accounts.test.ts b/notfair/src/server/onboarding/accounts.test.ts
index 95d151e5..d07664cc 100644
--- a/notfair/src/server/onboarding/accounts.test.ts
+++ b/notfair/src/server/onboarding/accounts.test.ts
@@ -75,7 +75,7 @@ describe("listGoogleAdsAccounts", () => {
expect(mocks.mcpRpcAutoRefresh).not.toHaveBeenCalled();
});
- it("normalizes accounts, names, ids, and the default hint", async () => {
+ it("normalizes accounts, names, and ids", async () => {
mocks.mcpRpcAutoRefresh.mockResolvedValue(
toolResult({
accounts: [
@@ -93,7 +93,6 @@ describe("listGoogleAdsAccounts", () => {
{ id: "123", name: "Main" },
{ id: "fallback", name: "fallback" },
],
- default_account_id: "123",
});
expect(mocks.mcpRpcAutoRefresh).toHaveBeenCalledWith(
"acme",
@@ -198,8 +197,9 @@ describe("Meta Ads account onboarding", () => {
);
await expect(listMetaAdsAccounts("acme")).resolves.toMatchObject({
ok: true,
- default_account_id: "act_3",
+ accounts: [{ id: "act_3", name: "Third" }],
});
+ expect(await listMetaAdsAccounts("acme")).not.toHaveProperty("default_account_id");
});
it("handles missing config, RPC failure, and malformed payloads", async () => {
@@ -256,12 +256,15 @@ describe("Search Console property onboarding", () => {
{ id: "https://example.com/blog/", name: "example.com/blog/" },
{ id: "not a url", name: "Custom" },
],
- default_property_id: null,
});
mocks.mcpRpcAutoRefresh.mockResolvedValue(
toolResult({ siteEntry: [{ siteUrl: "https://one.example/" }], defaultPropertyId: "one" }),
);
- await expect(listGscProperties("acme")).resolves.toMatchObject({ default_property_id: "one" });
+ await expect(listGscProperties("acme")).resolves.toMatchObject({
+ ok: true,
+ properties: [{ id: "https://one.example/", name: "one.example" }],
+ });
+ expect(await listGscProperties("acme")).not.toHaveProperty("default_property_id");
mocks.mcpRpcAutoRefresh.mockResolvedValue(toolResult({ sites: [] }));
await expect(listGscProperties("acme")).resolves.toMatchObject({ ok: true, properties: [] });
});
diff --git a/notfair/src/server/onboarding/accounts.ts b/notfair/src/server/onboarding/accounts.ts
index 08a8cf92..59ec4e0b 100644
--- a/notfair/src/server/onboarding/accounts.ts
+++ b/notfair/src/server/onboarding/accounts.ts
@@ -19,14 +19,14 @@ import type { Project } from "@/types";
* user to pick one and we persist the choice on `projects.google_ads_account_id`
* so the audit + later automation target the right account.
*
- * Single source of truth for the account ID is the DB column. MCP returns
- * a `defaultAccountId` we surface only as a hint; we never silently use it.
+ * Single source of truth for the account ID is the DB column. MCP listings
+ * return accounts equally; we never treat one as the default.
*/
export type GoogleAdsAccount = { id: string; name: string };
export type ListAccountsResult =
- | { ok: true; accounts: GoogleAdsAccount[]; default_account_id: string | null }
+ | { ok: true; accounts: GoogleAdsAccount[] }
| { ok: false; error: string; kind: "mcp_not_configured" | "rpc" | "shape" };
type ListAccountsToolResult = {
@@ -36,7 +36,6 @@ type ListAccountsToolResult = {
type AccountsPayload = {
accounts?: Array<{ id?: unknown; name?: unknown }>;
- defaultAccountId?: unknown;
totalAccounts?: unknown;
};
@@ -45,7 +44,7 @@ const LIST_TIMEOUT_MS = 8_000;
/**
* Call the MCP's listConnectedAccounts tool with the project's stored bearer.
- * Returns the account list (id + name) + the MCP's default-account hint.
+ * Returns the account list (id + name).
*/
export async function listGoogleAdsAccounts(
project_slug: string,
@@ -96,7 +95,7 @@ export async function listGoogleAdsAccounts(
function parseAccountsPayload(
result: ListAccountsToolResult,
-): { accounts: GoogleAdsAccount[]; default_account_id: string | null } | null {
+): { accounts: GoogleAdsAccount[] } | null {
if (!result || typeof result !== "object") return null;
if (result.isError) return null;
const text = result.content?.[0]?.text;
@@ -117,11 +116,7 @@ function parseAccountsPayload(
const name = String(a.name ?? "").trim() || id;
if (id) accounts.push({ id, name });
}
- const default_account_id =
- typeof body.defaultAccountId === "string" || typeof body.defaultAccountId === "number"
- ? String(body.defaultAccountId)
- : null;
- return { accounts, default_account_id };
+ return { accounts };
}
export type SetAccountResult =
@@ -178,7 +173,7 @@ export type MetaAdsAccount = {
};
export type ListMetaAdsAccountsResult =
- | { ok: true; accounts: MetaAdsAccount[]; default_account_id: string | null }
+ | { ok: true; accounts: MetaAdsAccount[] }
| { ok: false; error: string; kind: "mcp_not_configured" | "rpc" | "shape" };
export async function listMetaAdsAccounts(
@@ -221,12 +216,11 @@ type MetaAccountsPayload = {
// defensively in case the MCP normalizes the shape upstream.
data?: Array<{ id?: unknown; name?: unknown; account_id?: unknown }>;
accounts?: Array<{ id?: unknown; name?: unknown }>;
- defaultAccountId?: unknown;
};
function parseMetaAccountsPayload(
result: ListAccountsToolResult,
-): { accounts: MetaAdsAccount[]; default_account_id: string | null } | null {
+): { accounts: MetaAdsAccount[] } | null {
if (!result || typeof result !== "object") return null;
if (result.isError) return null;
const text = result.content?.[0]?.text;
@@ -250,11 +244,7 @@ function parseMetaAccountsPayload(
const name = String(a.name ?? "").trim() || id;
if (id) accounts.push({ id, name });
}
- const default_account_id =
- typeof body.defaultAccountId === "string" || typeof body.defaultAccountId === "number"
- ? String(body.defaultAccountId)
- : null;
- return { accounts, default_account_id };
+ return { accounts };
}
export type SetMetaAdsAccountResult =
@@ -316,7 +306,7 @@ export type GscProperty = {
};
export type ListGscPropertiesResult =
- | { ok: true; properties: GscProperty[]; default_property_id: string | null }
+ | { ok: true; properties: GscProperty[] }
| { ok: false; error: string; kind: "mcp_not_configured" | "rpc" | "shape" };
export async function listGscProperties(
@@ -364,11 +354,11 @@ type GscPropertiesPayload =
// The actual notfair-googlesearchconsole MCP returns a bare array.
| GscSiteRow[]
// Spec shape per the Search Console REST API.
- | { siteEntry?: GscSiteRow[]; sites?: GscSiteRow[]; defaultPropertyId?: unknown };
+ | { siteEntry?: GscSiteRow[]; sites?: GscSiteRow[] };
function parseGscPropertiesPayload(
result: ListAccountsToolResult,
-): { properties: GscProperty[]; default_property_id: string | null } | null {
+): { properties: GscProperty[] } | null {
if (!result || typeof result !== "object") return null;
if (result.isError) return null;
const text = result.content?.[0]?.text;
@@ -405,11 +395,7 @@ function parseGscPropertiesPayload(
typeof s.permissionLevel === "string" ? s.permissionLevel : undefined,
});
}
- const default_property_id =
- !Array.isArray(body) && typeof body.defaultPropertyId === "string"
- ? body.defaultPropertyId
- : null;
- return { properties, default_property_id };
+ return { properties };
}
function prettyGscName(siteUrl: string): string {