:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(mcp): split internal API URL from public link URL (#60604)
Joshua Snyder046af8d8996e
diff --git a/services/mcp/.dev.vars.example b/services/mcp/.dev.vars.exampleindex dbf3ac8b9791..4a1731148f98 100644--- a/services/mcp/.dev.vars.example+++ b/services/mcp/.dev.vars.example@@ -3,6 +3,11 @@# See getAuthorizationServerUrl() in src/lib/constants.ts for details.POSTHOG_API_BASE_URL=http://localhost:8010+# Public-facing PostHog URL used when rendering the clickable links in tool responses+# (the `_posthogUrl` field). Set this when POSTHOG_API_BASE_URL points at a non-clickable+# hostname (e.g. cluster-internal Hono routing). Falls back to POSTHOG_API_BASE_URL when unset.+# POSTHOG_PUBLIC_URL=http://localhost:8010+# Base URL for serving MCP UI app static assets (Worker's own URL)MCP_APPS_BASE_URL=http://localhost:8787diff --git a/services/mcp/src/api/client.ts b/services/mcp/src/api/client.tsindex 827244b9d4c2..97b85ceb319b 100644--- a/services/mcp/src/api/client.ts+++ b/services/mcp/src/api/client.ts@@ -89,6 +89,13 @@ export interface QueryEndpointResponse {export interface ApiConfig {apiToken: stringbaseUrl: string+ /**+ * Public-facing base URL used when building links the user clicks (e.g. `_posthogUrl`).+ * Defaults to `baseUrl` when unset or empty. Distinct from `baseUrl` so deployments can route+ * API traffic over a cluster-internal hostname while still rendering public links+ * (e.g. https://us.posthog.com) in tool responses.+ */+ publicBaseUrl?: string | undefinedclientUserAgent?: string | undefinedmcpClientName?: string | undefinedmcpClientVersion?: string | undefined@@ -104,18 +111,22 @@ type Endpoint = Record<string, any>export class ApiClient {public config: ApiConfigpublic baseUrl: string+ public publicBaseUrl: stringconstructor(config: ApiConfig) {this.config = configthis.baseUrl = config.baseUrl+ // `||` (not `??`) so an empty string — e.g. the Workers vitest config sets+ // env vars to '' — falls back to baseUrl instead of yielding relative links.+ this.publicBaseUrl = config.publicBaseUrl || config.baseUrl}getProjectBaseUrl(projectId: string): string {if (projectId === '@current') {- return this.baseUrl+ return this.publicBaseUrl}- return `${this.baseUrl}/project/${projectId}`+ return `${this.publicBaseUrl}/project/${projectId}`}private async fetch(url: string, options?: RequestInit): Promise<Response> {diff --git a/services/mcp/src/hono/constants.ts b/services/mcp/src/hono/constants.tsindex a38b4dbaabf0..067e9f5c8699 100644--- a/services/mcp/src/hono/constants.ts+++ b/services/mcp/src/hono/constants.ts@@ -9,6 +9,7 @@ export {toCloudRegion,getBaseUrlForRegion,getCustomApiBaseUrl,+ getPublicBaseUrl,getAuthorizationServerUrl,MCP_DOCS_URL,OAUTH_PROXY_URL,@@ -22,6 +23,7 @@ export function getEnv(): Env {}return {POSTHOG_API_BASE_URL: process.env.POSTHOG_API_BASE_URL || undefined,+ POSTHOG_PUBLIC_URL: process.env.POSTHOG_PUBLIC_URL || undefined,MCP_APPS_BASE_URL: process.env.MCP_APPS_BASE_URL || undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: process.env.POSTHOG_MCP_APPS_ANALYTICS_BASE_URL || undefined,POSTHOG_UI_APPS_TOKEN: process.env.POSTHOG_UI_APPS_TOKEN || undefined,diff --git a/services/mcp/src/hono/request-context.ts b/services/mcp/src/hono/request-context.tsindex ae3dc52be8b2..24fe56eeb6d1 100644--- a/services/mcp/src/hono/request-context.ts+++ b/services/mcp/src/hono/request-context.ts@@ -15,7 +15,7 @@ import { hash } from '@/lib/utils'import type { Context, Env, State } from '@/tools/types'import { RedisCache, type RedisLike } from './cache/RedisCache'-import { getCustomApiBaseUrl } from './constants'+import { getCustomApiBaseUrl, getPublicBaseUrl } from './constants'import {buildMCPRequestContext,buildMCPSessionAnalyticsProperties,@@ -95,6 +95,7 @@ export class RequestContext {this.apiInstance = new ApiClient({apiToken: this.props.apiToken,baseUrl,+ publicBaseUrl: getPublicBaseUrl(),clientUserAgent: this.props.clientUserAgent,mcpClientName: this.props.mcpClientName,mcpClientVersion: this.props.mcpClientVersion,diff --git a/services/mcp/src/lib/constants.ts b/services/mcp/src/lib/constants.tsindex d59cbc7501a1..587873529a48 100644--- a/services/mcp/src/lib/constants.ts+++ b/services/mcp/src/lib/constants.ts@@ -7,6 +7,7 @@ export {toCloudRegion,getBaseUrlForRegion,getCustomApiBaseUrl,+ getPublicBaseUrl,isCloudApi,isLocalApi,MCP_DOCS_URL,diff --git a/services/mcp/src/lib/oauth-constants.ts b/services/mcp/src/lib/oauth-constants.tsindex 2a861e725206..fba3a557070c 100644--- a/services/mcp/src/lib/oauth-constants.ts+++ b/services/mcp/src/lib/oauth-constants.ts@@ -62,6 +62,13 @@ export const OAUTH_PROXY_URL = 'https://oauth.posthog.com'export const getCustomApiBaseUrl = (): string | undefined => env.POSTHOG_API_BASE_URL+/**+ * Public-facing base URL for rendered links. Set when `POSTHOG_API_BASE_URL` points+ * at a non-clickable hostname (e.g. cluster-internal Hono routing). Falls back to+ * `POSTHOG_API_BASE_URL` when unset.+ */+export const getPublicBaseUrl = (): string | undefined => env.POSTHOG_PUBLIC_URL || env.POSTHOG_API_BASE_URL+const CLOUD_HOSTS = new Set(['us.posthog.com', 'eu.posthog.com'])export const isCloudApi = (): boolean => {diff --git a/services/mcp/src/mcp.ts b/services/mcp/src/mcp.tsindex 80df86d08943..1a70e5b40fad 100644--- a/services/mcp/src/mcp.ts+++ b/services/mcp/src/mcp.ts@@ -11,6 +11,7 @@ import { DurableObjectCache } from '@/lib/cache/DurableObjectCache'import { MCPClientProfile } from '@/lib/client-detection'import {getCustomApiBaseUrl,+ getPublicBaseUrl,MCP_SERVER_NAME,MCP_SERVER_VERSION,POSTHOG_EU_BASE_URL,@@ -250,6 +251,7 @@ export class MCP extends McpAgent<Env> {this._api = new ApiClient({apiToken: this.requestProperties.apiToken,baseUrl,+ publicBaseUrl: getPublicBaseUrl(),clientUserAgent: this.requestProperties.clientUserAgent,mcpClientName: this.mcpClientName,mcpClientVersion: this.mcpClientVersion,diff --git a/services/mcp/src/tools/types.ts b/services/mcp/src/tools/types.tsindex a2f9c0fcfea0..01167d0bdd36 100644--- a/services/mcp/src/tools/types.ts+++ b/services/mcp/src/tools/types.ts@@ -50,6 +50,16 @@ export type Env = {* Only set this for self-hosted PostHog deployments.*/POSTHOG_API_BASE_URL: string | undefined+ /**+ * Public-facing PostHog URL used when rendering links the user clicks+ * (e.g. `_posthogUrl` in tool responses).+ *+ * When `POSTHOG_API_BASE_URL` is set to a cluster-internal hostname for outbound+ * API traffic (the Hono deployment in PostHog Production), this should be set to+ * the corresponding public URL (e.g. https://us.posthog.com) so rendered links+ * remain clickable. Falls back to `POSTHOG_API_BASE_URL` when unset.+ */+ POSTHOG_PUBLIC_URL: string | undefined/*** Base URL for serving MCP UI app static assets.* When using Workers Static Assets, this is the Worker's own public URL.diff --git a/services/mcp/tests/hono/constants.test.ts b/services/mcp/tests/hono/constants.test.tsindex 14d3030fb1bf..a608d469a6b7 100644--- a/services/mcp/tests/hono/constants.test.ts+++ b/services/mcp/tests/hono/constants.test.ts@@ -8,6 +8,7 @@ import {getBaseUrlForRegion,getCustomApiBaseUrl,getEnv,+ getPublicBaseUrl,getUserAgent,toCloudRegion,} from '@/hono/constants'@@ -57,6 +58,26 @@ describe('Hono Constants', () => {})})+ describe('getPublicBaseUrl', () => {+ it('returns POSTHOG_PUBLIC_URL when set, even if POSTHOG_API_BASE_URL is also set', () => {+ process.env.POSTHOG_API_BASE_URL = 'http://posthog-web-django.posthog.svc.cluster.local:8000'+ process.env.POSTHOG_PUBLIC_URL = 'https://us.posthog.com'+ expect(getPublicBaseUrl()).toBe('https://us.posthog.com')+ })++ it('falls back to POSTHOG_API_BASE_URL when POSTHOG_PUBLIC_URL is unset', () => {+ process.env.POSTHOG_API_BASE_URL = 'https://us.posthog.com'+ delete process.env.POSTHOG_PUBLIC_URL+ expect(getPublicBaseUrl()).toBe('https://us.posthog.com')+ })++ it('returns undefined when neither env var is set', () => {+ delete process.env.POSTHOG_API_BASE_URL+ delete process.env.POSTHOG_PUBLIC_URL+ expect(getPublicBaseUrl()).toBeUndefined()+ })+ })+describe('getAuthorizationServerUrl', () => {it('should return localhost URL when POSTHOG_API_BASE_URL is localhost', () => {process.env.POSTHOG_API_BASE_URL = 'http://localhost:8010'@@ -126,6 +147,7 @@ describe('Hono Constants', () => {it('should return all expected fields', () => {const env = getEnv()expect(env).toHaveProperty('POSTHOG_API_BASE_URL')+ expect(env).toHaveProperty('POSTHOG_PUBLIC_URL')expect(env).toHaveProperty('MCP_APPS_BASE_URL')expect(env).toHaveProperty('POSTHOG_MCP_APPS_ANALYTICS_BASE_URL')expect(env).toHaveProperty('POSTHOG_UI_APPS_TOKEN')diff --git a/services/mcp/tests/hono/request-context.test.ts b/services/mcp/tests/hono/request-context.test.tsindex 37280ed0859a..f85c242bbd6f 100644--- a/services/mcp/tests/hono/request-context.test.ts+++ b/services/mcp/tests/hono/request-context.test.ts@@ -1,11 +1,15 @@-import { describe, expect, it, vi } from 'vitest'+import { afterEach, describe, expect, it, vi } from 'vitest'-const mockMe = vi.fn()+const { mockMe, mockApiClientCtor } = vi.hoisted(() => {+ const mockMe = vi.fn()+ const mockApiClientCtor = vi.fn().mockImplementation(() => ({+ users: () => ({ me: mockMe }),+ }))+ return { mockMe, mockApiClientCtor }+})vi.mock('@/api/client', () => ({- ApiClient: vi.fn().mockImplementation(() => ({- users: () => ({ me: mockMe }),- })),+ ApiClient: mockApiClientCtor,}))import type { RedisLike } from '@/hono/cache/RedisCache'@@ -63,6 +67,43 @@ function makeProps(overrides: Partial<RequestProperties> = {}): RequestPropertie}describe('RequestContext', () => {+ describe('ApiClient construction', () => {+ const originalEnv = { ...process.env }++ afterEach(() => {+ process.env = { ...originalEnv }+ mockApiClientCtor.mockClear()+ mockMe.mockClear()+ })++ it('passes POSTHOG_PUBLIC_URL as publicBaseUrl to the ApiClient', async () => {+ process.env.POSTHOG_API_BASE_URL = 'http://posthog-web-django.posthog.svc.cluster.local:8000'+ process.env.POSTHOG_PUBLIC_URL = 'https://us.posthog.com'++ mockMe.mockResolvedValue({ success: true, data: { distinct_id: 'user-1' } })+ const ctx = new RequestContext(fakeRedis(), env, makeProps())+ await ctx.getDistinctId()++ expect(mockApiClientCtor).toHaveBeenCalledTimes(1)+ const config = mockApiClientCtor.mock.calls[0]![0]+ expect(config.baseUrl).toBe('http://posthog-web-django.posthog.svc.cluster.local:8000')+ expect(config.publicBaseUrl).toBe('https://us.posthog.com')+ })++ it('falls back to POSTHOG_API_BASE_URL when POSTHOG_PUBLIC_URL is not set', async () => {+ process.env.POSTHOG_API_BASE_URL = 'https://us.posthog.com'+ delete process.env.POSTHOG_PUBLIC_URL++ mockMe.mockResolvedValue({ success: true, data: { distinct_id: 'user-1' } })+ const ctx = new RequestContext(fakeRedis(), env, makeProps())+ await ctx.getDistinctId()++ const config = mockApiClientCtor.mock.calls[0]![0]+ expect(config.baseUrl).toBe('https://us.posthog.com')+ expect(config.publicBaseUrl).toBe('https://us.posthog.com')+ })+ })+describe('getDistinctId', () => {it('deduplicates concurrent calls into a single API request', async () => {mockMe.mockResolvedValue({ success: true, data: { distinct_id: 'user-123' } })diff --git a/services/mcp/tests/hono/setup.ts b/services/mcp/tests/hono/setup.tsindex 476771e9460c..2369e257401d 100644--- a/services/mcp/tests/hono/setup.ts+++ b/services/mcp/tests/hono/setup.ts@@ -4,6 +4,7 @@ vi.mock('cloudflare:workers', () => ({env: {INKEEP_API_KEY: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,MCP_APPS_BASE_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,diff --git a/services/mcp/tests/integration/feature-routing.test.ts b/services/mcp/tests/integration/feature-routing.test.tsindex b49b7c710ca9..b54b6936227b 100644--- a/services/mcp/tests/integration/feature-routing.test.ts+++ b/services/mcp/tests/integration/feature-routing.test.ts@@ -12,6 +12,7 @@ const createMockContext = (): Context => ({POSTHOG_ANALYTICS_API_KEY: undefined,POSTHOG_ANALYTICS_HOST: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,},diff --git a/services/mcp/tests/setup.ts b/services/mcp/tests/setup.tsindex c5625fc4a0f7..220df02869df 100644--- a/services/mcp/tests/setup.ts+++ b/services/mcp/tests/setup.ts@@ -16,6 +16,7 @@ vi.mock('cloudflare:workers', () => ({POSTHOG_ANALYTICS_API_KEY: undefined,POSTHOG_ANALYTICS_HOST: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,},diff --git a/services/mcp/tests/unit/api-client.test.ts b/services/mcp/tests/unit/api-client.test.tsindex 33a84b674641..8b433acfbb18 100644--- a/services/mcp/tests/unit/api-client.test.ts+++ b/services/mcp/tests/unit/api-client.test.ts@@ -24,6 +24,62 @@ describe('ApiClient', () => {expect(baseUrl).toBe(customUrl)})+ describe('publicBaseUrl', () => {+ it('defaults publicBaseUrl to baseUrl when not provided', () => {+ const client = new ApiClient({+ apiToken: 'test-token',+ baseUrl: 'http://posthog-web-django.posthog.svc.cluster.local:8000',+ })+ expect(client.publicBaseUrl).toBe('http://posthog-web-django.posthog.svc.cluster.local:8000')+ })++ it('uses publicBaseUrl override when provided', () => {+ const client = new ApiClient({+ apiToken: 'test-token',+ baseUrl: 'http://posthog-web-django.posthog.svc.cluster.local:8000',+ publicBaseUrl: 'https://us.posthog.com',+ })+ expect(client.baseUrl).toBe('http://posthog-web-django.posthog.svc.cluster.local:8000')+ expect(client.publicBaseUrl).toBe('https://us.posthog.com')+ })++ it('getProjectBaseUrl uses publicBaseUrl, not baseUrl', () => {+ const client = new ApiClient({+ apiToken: 'test-token',+ baseUrl: 'http://posthog-web-django.posthog.svc.cluster.local:8000',+ publicBaseUrl: 'https://us.posthog.com',+ })+ expect(client.getProjectBaseUrl('42')).toBe('https://us.posthog.com/project/42')+ })++ it('getProjectBaseUrl returns publicBaseUrl alone for @current', () => {+ const client = new ApiClient({+ apiToken: 'test-token',+ baseUrl: 'http://posthog-web-django.posthog.svc.cluster.local:8000',+ publicBaseUrl: 'https://us.posthog.com',+ })+ expect(client.getProjectBaseUrl('@current')).toBe('https://us.posthog.com')+ })++ it('getProjectBaseUrl falls back to baseUrl when publicBaseUrl is unset', () => {+ const client = new ApiClient({+ apiToken: 'test-token',+ baseUrl: 'https://eu.posthog.com',+ })+ expect(client.getProjectBaseUrl('7')).toBe('https://eu.posthog.com/project/7')+ })++ it('falls back to baseUrl when publicBaseUrl is an empty string', () => {+ const client = new ApiClient({+ apiToken: 'test-token',+ baseUrl: 'https://eu.posthog.com',+ publicBaseUrl: '',+ })+ expect(client.publicBaseUrl).toBe('https://eu.posthog.com')+ expect(client.getProjectBaseUrl('7')).toBe('https://eu.posthog.com/project/7')+ })+ })+it('should send correct headers on fetch', async () => {const mockFetch = vi.fn().mockResolvedValue(new Response(JSON.stringify({}), { status: 200 }))vi.stubGlobal('fetch', mockFetch)diff --git a/services/mcp/tests/unit/exec.test.ts b/services/mcp/tests/unit/exec.test.tsindex 15828e21dc7a..cc8458c65511 100644--- a/services/mcp/tests/unit/exec.test.ts+++ b/services/mcp/tests/unit/exec.test.ts@@ -462,6 +462,7 @@ describe('exec tool', () => {POSTHOG_ANALYTICS_API_KEY: undefined,POSTHOG_ANALYTICS_HOST: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,},@@ -572,6 +573,7 @@ describe('exec tool', () => {POSTHOG_ANALYTICS_API_KEY: undefined,POSTHOG_ANALYTICS_HOST: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,},diff --git a/services/mcp/tests/unit/oauth-region.test.ts b/services/mcp/tests/unit/oauth-region.test.tsindex a8565908853a..e904dbb9edab 100644--- a/services/mcp/tests/unit/oauth-region.test.ts+++ b/services/mcp/tests/unit/oauth-region.test.ts@@ -1,6 +1,13 @@import { afterEach, describe, expect, it } from 'vitest'-import { getAuthorizationServerUrl, getBaseUrlForRegion, isCloudApi, isLocalApi, toCloudRegion } from '@/lib/constants'+import {+ getAuthorizationServerUrl,+ getBaseUrlForRegion,+ getPublicBaseUrl,+ isCloudApi,+ isLocalApi,+ toCloudRegion,+} from '@/lib/constants'describe('OAuth Region Routing', () => {const originalEnv = { ...process.env }@@ -84,6 +91,26 @@ describe('OAuth Region Routing', () => {})})+ describe('getPublicBaseUrl', () => {+ it('returns POSTHOG_PUBLIC_URL when set', () => {+ process.env.POSTHOG_API_BASE_URL = 'http://posthog-web-django.posthog.svc.cluster.local:8000'+ process.env.POSTHOG_PUBLIC_URL = 'https://us.posthog.com'+ expect(getPublicBaseUrl()).toBe('https://us.posthog.com')+ })++ it('falls back to POSTHOG_API_BASE_URL when POSTHOG_PUBLIC_URL is not set', () => {+ process.env.POSTHOG_API_BASE_URL = 'http://localhost:8010'+ delete process.env.POSTHOG_PUBLIC_URL+ expect(getPublicBaseUrl()).toBe('http://localhost:8010')+ })++ it('returns undefined when neither is set', () => {+ delete process.env.POSTHOG_API_BASE_URL+ delete process.env.POSTHOG_PUBLIC_URL+ expect(getPublicBaseUrl()).toBeUndefined()+ })+ })+describe('getAuthorizationServerUrl', () => {it('returns localhost when POSTHOG_API_BASE_URL is localhost', () => {process.env.POSTHOG_API_BASE_URL = 'http://localhost:8010'diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.tsindex b5f006bec077..4860c5a6341c 100644--- a/services/mcp/tests/unit/tool-filtering.test.ts+++ b/services/mcp/tests/unit/tool-filtering.test.ts@@ -249,6 +249,7 @@ const createMockContext = (scopes: string[]): Context => ({POSTHOG_ANALYTICS_API_KEY: undefined,POSTHOG_ANALYTICS_HOST: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,},@@ -485,6 +486,7 @@ describe('Tool Filtering - AI Consent', () => {POSTHOG_ANALYTICS_API_KEY: undefined,POSTHOG_ANALYTICS_HOST: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,},@@ -511,6 +513,7 @@ describe('Tool Filtering - AI Consent', () => {POSTHOG_ANALYTICS_API_KEY: undefined,POSTHOG_ANALYTICS_HOST: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,},diff --git a/services/mcp/tests/unit/tool-schema-snapshots.test.ts b/services/mcp/tests/unit/tool-schema-snapshots.test.tsindex cea3570d9b1e..18110c8eefd4 100644--- a/services/mcp/tests/unit/tool-schema-snapshots.test.ts+++ b/services/mcp/tests/unit/tool-schema-snapshots.test.ts@@ -18,6 +18,7 @@ function createMockContext(): Context {POSTHOG_ANALYTICS_API_KEY: undefined,POSTHOG_ANALYTICS_HOST: undefined,POSTHOG_API_BASE_URL: undefined,+ POSTHOG_PUBLIC_URL: undefined,POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: undefined,POSTHOG_UI_APPS_TOKEN: undefined,},diff --git a/services/mcp/vitest.workers.config.mts b/services/mcp/vitest.workers.config.mtsindex e7ff763f88f1..13671f83eba0 100644--- a/services/mcp/vitest.workers.config.mts+++ b/services/mcp/vitest.workers.config.mts@@ -31,6 +31,7 @@ export default defineWorkersProject({// make init()'s analytics / observability paths short-// circuit cleanly.POSTHOG_API_BASE_URL: '',+ POSTHOG_PUBLIC_URL: '',POSTHOG_ANALYTICS_API_KEY: '',POSTHOG_ANALYTICS_HOST: '',POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: '',diff --git a/services/mcp/worker-configuration.d.ts b/services/mcp/worker-configuration.d.tsindex 6bca667b1a0f..883a1e725358 100644--- a/services/mcp/worker-configuration.d.ts+++ b/services/mcp/worker-configuration.d.ts@@ -9,6 +9,7 @@ declare namespace Cloudflare {interface Env {MCP_APPS_BASE_URL: "https://mcp.posthog.com";POSTHOG_API_BASE_URL: string;+ POSTHOG_PUBLIC_URL: string;POSTHOG_MCP_APPS_ANALYTICS_BASE_URL: string;POSTHOG_UI_APPS_TOKEN: string;POSTHOG_ANALYTICS_API_KEY: string;