Skip to content

feat(mcp-servers): resolve store icons from icon_domain via the logo.dev proxy#3585

Merged
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/mcp-store-icon-domain
Jul 21, 2026
Merged

feat(mcp-servers): resolve store icons from icon_domain via the logo.dev proxy#3585
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/mcp-store-icon-domain

Conversation

@cvolzer3

@cvolzer3 cvolzer3 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Problem

I changed the MCP store to use a catalog-as-code approach to adding MCP servers. As part of that changed, I moved us away from bundled assets to logo.dev icons. The existing MCP store componetry uses the old model structure, so it needs to be updated.

Changes

  • Resolve brand domain from server URLs for custom installations without templates.
  • Render icons through a proxy with the active theme, caching loads and retrying on theme flips
  • Migrate mobile implementation to align with these changes, removing bundled assets

How did you test this?

Tested the desktop version locally. Not sure how to test mobile, so I did not check that.

@trunk-io

trunk-io Bot commented Jul 20, 2026

Copy link
Copy Markdown

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 58ac665.

@posthog

posthog Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Visual changes approved by @cvolzer3 — baseline updated in c306df9.

View this run in PostHog

18 new, 28 removed.

@cvolzer3
cvolzer3 marked this pull request as ready for review July 21, 2026 14:36
@cvolzer3
cvolzer3 requested a review from a team July 21, 2026 14:36
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
packages/ui/src/features/mcp-servers/hooks/useServerIcon.ts:23
**Transient Failures Stay Visible**

When the proxy returns a temporary server or network error, `getMcpServerIconUrl` throws and this query performs no retry. An icon observed continuously remains on the generic fallback until another refetch trigger occurs, so a short proxy outage can hide branding for the rest of that view.

### Issue 2 of 3
apps/mobile/src/features/mcp/components/ServerIcon.tsx:56
**Failure Key Ignores Auth Context**

The request URL depends on the access token, cloud region, and project, but the failure key contains only the domain and theme. If the image fails during token refresh or before a project switch completes, the same component suppresses the later valid request and keeps showing the generic icon.

### Issue 3 of 3
packages/api-client/src/posthog-client.ts:4219
**Blob URLs Lack Cleanup**

Each distinct domain and theme creates a new object URL, but no owner revokes it when query data is replaced or removed. Browsing many servers in the long-lived desktop renderer retains the backing image blobs and causes memory use to grow throughout the session.

Reviews (1): Last reviewed commit: "chore(visual): update storybook baseline..." | Re-trigger Greptile

{
enabled: !!domain,
staleTime: Number.POSITIVE_INFINITY,
retry: false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Transient Failures Stay Visible

When the proxy returns a temporary server or network error, getMcpServerIconUrl throws and this query performs no retry. An icon observed continuously remains on the generic fallback until another refetch trigger occurs, so a short proxy outage can hide branding for the rest of that view.

Rule Used: When implementing retry logic, include comprehensi... (source)

Learned From
PostHog/posthog#32651

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/features/mcp-servers/hooks/useServerIcon.ts
Line: 23

Comment:
**Transient Failures Stay Visible**

When the proxy returns a temporary server or network error, `getMcpServerIconUrl` throws and this query performs no retry. An icon observed continuously remains on the generic fallback until another refetch trigger occurs, so a short proxy outage can hide branding for the rest of that view.

**Rule Used:** When implementing retry logic, include comprehensi... ([source](https://app.greptile.com/posthog-org-19734/-/custom-context?memory=24d1be3f-07fb-465d-b1a7-60dff301aed8))

**Learned From**
[PostHog/posthog#32651](https://github.com/PostHog/posthog/pull/32651)

How can I resolve this? If you propose a fix, please make it concise.

failedIconKey !== iconCacheKey
? `${getCloudUrlFromRegion(cloudRegion)}/api/environments/${projectId}/mcp_servers/icon/?domain=${encodeURIComponent(domain)}&theme=${theme}`
: null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Failure Key Ignores Auth Context

The request URL depends on the access token, cloud region, and project, but the failure key contains only the domain and theme. If the image fails during token refresh or before a project switch completes, the same component suppresses the later valid request and keeps showing the generic icon.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile/src/features/mcp/components/ServerIcon.tsx
Line: 56

Comment:
**Failure Key Ignores Auth Context**

The request URL depends on the access token, cloud region, and project, but the failure key contains only the domain and theme. If the image fails during token refresh or before a project switch completes, the same component suppresses the later valid request and keeps showing the generic icon.

How can I resolve this? If you propose a fix, please make it concise.

throw error;
}
const blob = await response.blob();
return URL.createObjectURL(blob);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Blob URLs Lack Cleanup

Each distinct domain and theme creates a new object URL, but no owner revokes it when query data is replaced or removed. Browsing many servers in the long-lived desktop renderer retains the backing image blobs and causes memory use to grow throughout the session.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/api-client/src/posthog-client.ts
Line: 4219

Comment:
**Blob URLs Lack Cleanup**

Each distinct domain and theme creates a new object URL, but no owner revokes it when query data is replaced or removed. Browsing many servers in the long-lived desktop renderer retains the backing image blobs and causes memory use to grow throughout the session.

How can I resolve this? If you propose a fix, please make it concise.

@cvolzer3

Copy link
Copy Markdown
Contributor Author

@tatoalo fastest stamp this side of the mississippi

cvolzer3 added 2 commits July 21, 2026 10:41
…dev proxy

The MCP store backend is replacing bundled icon assets with an icon_domain
field per template, resolved at render time through the authenticated
mcp_servers/icon/ proxy (PostHog/posthog#70159). Stop reading icon_key
everywhere so the backend can drop the field:

- api-client: add icon_domain to the generated MCP types and a
  getMcpServerIconUrl method (authenticated fetch -> object URL; the
  endpoint's 404 means "no icon", surfaced as null).
- core: iconDomainFromServerUrl derives a best-effort brand domain from a
  server URL (strips mcp./api./www.) so custom installs get icons too;
  resolveServerDetails now resolves iconDomain + serverUrl.
- ui: ServerIcon fetches through the proxy with the active theme, latching
  failures per (domain, theme); bundled assets and BRAND_ICONS removed
  (claude.svg stays, used by ContinueCliSessions).
- mobile: same migration on the hand-mirrored types and ServerIcon (RN Image
  with Authorization header); bundled assets and SERVER_LOGOS removed.

Generated-By: PostHog Code
Task-Id: 2f81c64d-a1c4-483e-affd-a9b355756737
@cvolzer3
cvolzer3 force-pushed the posthog-code/mcp-store-icon-domain branch from c306df9 to 58ac665 Compare July 21, 2026 14:41
@cvolzer3
cvolzer3 enabled auto-merge (squash) July 21, 2026 14:51

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io
trunk-io Bot merged commit fe501f3 into main Jul 21, 2026
31 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/mcp-store-icon-domain branch July 21, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants