Skip to content

: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.

chore(mcp): disable UI app bundle caching in local dev (#65390)

Georgis Andonis020ea40930e5
diff --git a/services/mcp/src/hono/public-routes.ts b/services/mcp/src/hono/public-routes.ts
index 638d962f7782..bca2ef51a06d 100644
--- a/services/mcp/src/hono/public-routes.ts
+++ b/services/mcp/src/hono/public-routes.ts
@@ -1,6 +1,7 @@
import { serveStatic } from '@hono/node-server/serve-static'
import type { Hono } from 'hono'
+import { isLocalApi } from '@/lib/constants'
import { buildRedirectUrl, getPublicUrl, matchAuthServerRedirect } from '@/lib/routing'
import { getAdvertisedOAuthScopes } from '@/tools/toolDefinitions'
@@ -80,6 +81,17 @@ const authRedirectHandler = (c: HonoCtx): Response => {
* resource metadata, MCP UI app static assets, and auth-server fallback redirects.
*/
export function registerPublicRoutes(app: Hono, redis: RedisWithPing, lifecycle: Lifecycle): void {
+ // The client (e.g. Claude Desktop) caches UI app bundles, so after rebuilding them
+ // locally it can keep serving the old version and your changes won't show up.
+ // Disable caching in dev so rebuilds are always reflected.
+ // Prod keeps its default caching.
+ app.use('/ui-apps/*', async (c, next) => {
+ await next()
+ if (isLocalApi()) {
+ c.header('Cache-Control', 'no-store')
+ }
+ })
+
// MCP UI app static assets. The CF runtime serves these via the Workers
// Static Assets binding (`wrangler.jsonc`'s `assets.directory: ./public/`);
// here we serve them from disk so the same `${MCP_APPS_BASE_URL}/ui-apps/...`