: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
chore(mcp): add quill-charts plumbing for ui-apps (#61807)
Sam Pennington63a864b232e3
diff --git a/packages/quill/packages/charts/package.json b/packages/quill/packages/charts/package.jsonindex 32007f576daa..9351657374c4 100644--- a/packages/quill/packages/charts/package.json+++ b/packages/quill/packages/charts/package.json@@ -19,9 +19,11 @@"./story-helpers": "./src/story-helpers.tsx","./package.json": "./package.json"},+ "scripts": {+ "build": "tsc -p tsconfig.build.json"+ },"dependencies": {"@floating-ui/react": "^0.27.19",- "@testing-library/dom": ">=9.3.4","d3-array": "^3.2.4","d3-color": "^3.1.0","d3-scale": "^4.0.2",@@ -32,6 +34,7 @@"devDependencies": {"@posthog/quill-tokens": "workspace:*","@storybook/react": "catalog:",+ "@testing-library/dom": ">=9.3.4","@testing-library/react": "^14.3.1","@types/d3-array": "^3.2.1","@types/d3-color": "^3.1.3",@@ -40,7 +43,8 @@"@types/jest": "catalog:","@types/react": "^18.3.27","@types/react-dom": "^18.3.7",- "jest": "^29.7.0"+ "jest": "^29.7.0",+ "typescript": "catalog:"},"peerDependencies": {"react": "^18.3.1 || ^19.0.0",diff --git a/packages/quill/packages/charts/tsconfig.build.json b/packages/quill/packages/charts/tsconfig.build.jsonnew file mode 100644index 000000000000..930c84d610fd--- /dev/null+++ b/packages/quill/packages/charts/tsconfig.build.json@@ -0,0 +1,12 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "noEmit": false,+ "declaration": true,+ "emitDeclarationOnly": true,+ "rootDir": "src",+ "outDir": "dist"+ },+ "include": ["src/index.ts"],+ "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/testing", "src/story-helpers.tsx"]+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 23a9f9030f26..e6f000573eab 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -343,7 +343,7 @@ importers:version: 0.25.12jest:specifier: ^29.7.0- version: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ version: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))puppeteer:specifier: 19.0.0version: 19.0.0([email protected])@@ -1899,9 +1899,6 @@ importers:'@floating-ui/react':specifier: ^0.27.19- '@testing-library/dom':- specifier: '>=9.3.4'- version: 9.3.4d3-array:specifier: ^3.2.4version: 3.2.4@@ -1933,6 +1930,9 @@ importers:'@storybook/react':specifier: 'catalog:'version: 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])+ '@testing-library/dom':+ specifier: '>=9.3.4'+ version: 9.3.4'@testing-library/react':specifier: ^14.3.1@@ -1960,6 +1960,9 @@ importers:jest:specifier: ^29.7.0version: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ typescript:+ specifier: 6.0.3+ version: 6.0.3packages/quill/packages/components:dependencies:@@ -3775,6 +3778,9 @@ importers:'@posthog/quill':specifier: workspace:*version: link:../../packages/quill/packages/quill+ '@posthog/quill-charts':+ specifier: workspace:*+ version: link:../../packages/quill/packages/charts'@toon-format/toon':specifier: ^2.1.0version: 2.1.0@@ -31962,7 +31968,7 @@ snapshots:'@swc/core': 1.15.18'@swc/jest': 0.2.37(@swc/[email protected])expect-playwright: 0.8.0- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-circus: 29.7.0jest-environment-node: 29.7.0jest-junit: 16.0.0@@ -39033,6 +39039,25 @@ snapshots:- ts-node- utf-8-validate+ dependencies:+ '@jest/core': 29.7.0([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ '@jest/test-result': 29.7.0+ '@jest/types': 29.6.3+ chalk: 4.1.2+ create-jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ exit: 0.1.2+ import-local: 3.2.0+ jest-config: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest-util: 29.7.0+ jest-validate: 29.7.0+ yargs: 17.7.2+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - supports-color+ - ts-node+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@jest/core': 29.7.0([email protected](@swc/[email protected])(@types/[email protected])([email protected]))@@ -39675,7 +39700,7 @@ snapshots:dependencies:expect-playwright: 0.8.0- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-circus: 29.7.0jest-environment-node: 29.7.0jest-process-manager: 0.4.0@@ -40110,7 +40135,7 @@ snapshots:dependencies:ansi-escapes: 6.0.0chalk: 5.6.2- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-regex-util: 29.6.3jest-watcher: 29.7.0slash: 5.1.0@@ -40182,6 +40207,18 @@ snapshots:- ts-node- utf-8-validate+ dependencies:+ '@jest/core': 29.7.0([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ '@jest/types': 29.6.3+ import-local: 3.2.0+ jest-cli: 29.7.0+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - supports-color+ - ts-node+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@jest/core': 29.7.0([email protected](@swc/[email protected])(@types/[email protected])([email protected]))diff --git a/services/mcp/package.json b/services/mcp/package.jsonindex 5215266a32df..8a6a6d71d2dc 100644--- a/services/mcp/package.json+++ b/services/mcp/package.json@@ -45,6 +45,7 @@"@modelcontextprotocol/sdk": "^1.29.0","@posthog/mcp-analytics": "npm:@posthog/[email protected]","@posthog/quill": "workspace:*",+ "@posthog/quill-charts": "workspace:*","@toon-format/toon": "^2.1.0","agents": "0.10.2","ai": "^6.0.0",diff --git a/services/mcp/src/ui-apps/components/charts/theme.ts b/services/mcp/src/ui-apps/components/charts/theme.tsnew file mode 100644index 000000000000..43ab92e4a6de--- /dev/null+++ b/services/mcp/src/ui-apps/components/charts/theme.ts@@ -0,0 +1,26 @@+import { type ChartTheme } from '@posthog/quill-charts'++// PostHog brand palette. Canvas can't read CSS custom properties, so we hand the+// chart concrete hexes. The chart picks one per series by index; legends use the+// same array to stay in sync.+export const CHART_COLORS = [+ '#1d4aff', // PostHog blue+ '#621da6', // PostHog purple+ '#00d683', // PostHog green+ '#f54e00', // PostHog orange+ '#f7a501', // PostHog yellow+ '#dc2626', // red+]++// Single mid-gray for axis labels — readable on both light and dark hosts. Claude+// Desktop's iframe doesn't set `prefers-color-scheme`, so we can't detect the host+// theme and adapt at runtime.+export const CHART_THEME: ChartTheme = {+ colors: CHART_COLORS,+ backgroundColor: '#ffffff',+ axisColor: '#9ca3af',+ gridColor: 'rgba(128, 128, 128, 0.2)',+ crosshairColor: 'rgba(128, 128, 128, 0.5)',+ tooltipBackground: '#ffffff',+ tooltipColor: '#111827',+}diff --git a/services/mcp/tsconfig.json b/services/mcp/tsconfig.jsonindex ec4138e5764c..d06077c06c3d 100644--- a/services/mcp/tsconfig.json+++ b/services/mcp/tsconfig.json@@ -16,7 +16,6 @@"noImplicitReturns": true,"noFallthroughCasesInSwitch": true,"noUncheckedIndexedAccess": true,- "exactOptionalPropertyTypes": true,"skipLibCheck": true,"types": ["node", "./worker-configuration.d.ts", "./types.d.ts", "@cloudflare/vitest-pool-workers"],"paths": {@@ -26,6 +25,7 @@"@posthog/mcp-ui": ["./src/ui-apps/lib/index.ts"],"@posthog/mcp-ui/*": ["./src/ui-apps/lib/*"],"@posthog/quill": ["../../packages/quill/packages/quill/dist/index.d.ts"],+ "@posthog/quill-charts": ["../../packages/quill/packages/charts/dist/index.d.ts"],"lucide-react": ["./node_modules/lucide-react"],"@common/*": ["../../common/*"]}diff --git a/services/mcp/vite.ui-apps.config.ts b/services/mcp/vite.ui-apps.config.tsindex cf49663c675a..0921abcd3b3b 100644--- a/services/mcp/vite.ui-apps.config.ts+++ b/services/mcp/vite.ui-apps.config.ts@@ -51,6 +51,13 @@ export default defineConfig({find: /^@posthog\/quill$/,replacement: resolve(__dirname, '../../packages/quill/packages/quill/dist/index.js'),},+ // quill-charts is consumed as source (its package main is src/index.ts); resolve it+ // explicitly so files reached via the `products` alias — and the local chart wrappers —+ // can find it without a node_modules symlink.+ {+ find: /^@posthog\/quill-charts$/,+ replacement: resolve(__dirname, '../../packages/quill/packages/charts/src/index.ts'),+ },// lucide-react isn't a workspace dep at the products/ level, so files// resolved via the `products` alias can't find it. Pin to this// package's installed copy (matches the version Quill expects).