Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 34 additions & 23 deletions contents/docs/llm-analytics/installation/claude-agent-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,43 @@
title: Claude Agent SDK LLM analytics installation
platformIconName: IconAnthropic
showStepsToc: true
tableOfContents:
[
{ url: "install-the-posthog-sdk", value: "Install the PostHog SDK", depth: 1 },
{ url: "install-the-claude-agent-sdk", value: "Install the Claude Agent SDK", depth: 1 },
tableOfContents: [
{
url: "initialize-posthog-and-run-a-query",
value: "Initialize PostHog and run a query",
depth: 1,
url: 'install-the-posthog-sdk',
value: 'Install the PostHog SDK',
depth: 1,
},
{
url: "reusable-configuration-with-instrument",
value: "Reusable configuration with instrument()",
depth: 1,
url: 'install-the-claude-agent-sdk',
value: 'Install the Claude Agent SDK',
depth: 1,
},
{
url: "tool-usage-and-multi-turn-conversations",
value: "Tool usage and multi-turn conversations",
depth: 1,
url: 'initialize-posthog-and-run-a-query',
value: 'Initialize PostHog and run a query',
depth: 1,
},
{
url: "multi-turn-conversations-with-history",
value: "Multi-turn conversations with history",
depth: 1,
url: 'reusable-configuration-with-instrument',
value: 'Reusable configuration with instrument()',
depth: 1,
},
{ url: "verify-traces-and-generations", value: "Verify traces and generations", depth: 1 },
]
{
url: 'tool-usage-and-multi-turn-conversations',
value: 'Tool usage and multi-turn conversations',
depth: 1,
},
{
url: 'multi-turn-conversations-with-history',
value: 'Multi-turn conversations with history',
depth: 1,
},
{
url: 'verify-traces-and-generations',
value: 'Verify traces and generations',
depth: 1,
},
]
---

<!--
Expand All @@ -36,11 +47,11 @@ Source: https://github.com/PostHog/posthog/blob/master/docs/onboarding/llm-analy
See the docs runbook for more info: https://posthog.com/handbook/docs-and-wizard/onboarding-docs
-->

import { ClaudeAgentSDKInstallation } from "onboarding/llm-analytics/claude-agent-sdk.tsx";
import { OnboardingContentWrapper } from "components/Docs/OnboardingContentWrapper";
import NotableGenerationProperties from "../_snippets/notable-generation-properties.mdx";
import { addNextStepsStep } from "./_snippets/shared-helpers.tsx";
import { ClaudeAgentSDKInstallation } from 'onboarding/llm-analytics/claude-agent-sdk.tsx'
import { OnboardingContentWrapper } from 'components/Docs/OnboardingContentWrapper'
import NotableGenerationProperties from '../_snippets/notable-generation-properties.mdx'
import { addNextStepsStep } from './_snippets/shared-helpers.tsx'

<OnboardingContentWrapper snippets={{ NotableGenerationProperties }}>
<ClaudeAgentSDKInstallation modifySteps={addNextStepsStep} />
<ClaudeAgentSDKInstallation modifySteps={addNextStepsStep} />
</OnboardingContentWrapper>
126 changes: 55 additions & 71 deletions src/components/Product/MCP/MCPConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,88 +1,72 @@
import React from "react";
import { MdxCodeBlock } from "../../CodeBlock";
import React from 'react'
import { MdxCodeBlock } from '../../CodeBlock'

type ConfigVariant =
| "cursor"
| "claude-desktop"
| "windsurf"
| "vscode"
| "claude-code"
| "zed"
| "codex";
type ConfigVariant = 'cursor' | 'claude-desktop' | 'windsurf' | 'vscode' | 'claude-code' | 'zed' | 'codex'

interface MCPConfigSnippetProps {
variant?: ConfigVariant;
variant?: ConfigVariant
}

// Native HTTP config for clients that support it (Cursor, VS Code, Zed)
const MCP_SERVER_CONFIG_NATIVE = {
url: "https://mcp.posthog.com/mcp",
};
url: 'https://mcp.posthog.com/mcp',
}

// mcp-remote config for clients without native HTTP support (Claude Desktop, Windsurf)
const MCP_SERVER_CONFIG_LEGACY = {
command: "npx",
args: ["-y", "mcp-remote@latest", "https://mcp.posthog.com/mcp"],
};
command: 'npx',
args: ['-y', 'mcp-remote@latest', 'https://mcp.posthog.com/mcp'],
}

const EDITOR_CONFIGS = {
cursor: {
language: "json",
content: () => JSON.stringify({ mcpServers: { posthog: MCP_SERVER_CONFIG_NATIVE } }, null, 2),
},
"claude-desktop": {
language: "json",
content: () => JSON.stringify({ mcpServers: { posthog: MCP_SERVER_CONFIG_LEGACY } }, null, 2),
},
windsurf: {
language: "json",
content: () => JSON.stringify({ mcpServers: { posthog: MCP_SERVER_CONFIG_LEGACY } }, null, 2),
},
vscode: {
language: "json",
content: () =>
JSON.stringify(
{ servers: { posthog: { type: "http", ...MCP_SERVER_CONFIG_NATIVE } } },
null,
2,
),
},
"claude-code": {
language: "bash",
content: () => `claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user`,
},
zed: {
language: "json",
content: () =>
JSON.stringify(
{ context_servers: { posthog: { enabled: true, ...MCP_SERVER_CONFIG_NATIVE } } },
null,
2,
),
},
codex: {
language: "bash",
content: () => `codex mcp add posthog --url https://mcp.posthog.com/mcp`,
},
} as const;
cursor: {
language: 'json',
content: () => JSON.stringify({ mcpServers: { posthog: MCP_SERVER_CONFIG_NATIVE } }, null, 2),
},
'claude-desktop': {
language: 'json',
content: () => JSON.stringify({ mcpServers: { posthog: MCP_SERVER_CONFIG_LEGACY } }, null, 2),
},
windsurf: {
language: 'json',
content: () => JSON.stringify({ mcpServers: { posthog: MCP_SERVER_CONFIG_LEGACY } }, null, 2),
},
vscode: {
language: 'json',
content: () => JSON.stringify({ servers: { posthog: { type: 'http', ...MCP_SERVER_CONFIG_NATIVE } } }, null, 2),
},
'claude-code': {
language: 'bash',
content: () => `claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user`,
},
zed: {
language: 'json',
content: () =>
JSON.stringify({ context_servers: { posthog: { enabled: true, ...MCP_SERVER_CONFIG_NATIVE } } }, null, 2),
},
codex: {
language: 'bash',
content: () => `codex mcp add posthog --url https://mcp.posthog.com/mcp`,
},
} as const

const createMdxCodeBlock = (language: string, content: string) => ({
props: {
mdxType: "pre" as const,
children: {
key: null,
props: {
className: `language-${language}`,
mdxType: "code" as const,
children: content,
},
props: {
mdxType: 'pre' as const,
children: {
key: null,
props: {
className: `language-${language}`,
mdxType: 'code' as const,
children: content,
},
},
},
},
});
})

export const MCPConfigSnippet: React.FC<MCPConfigSnippetProps> = ({ variant = "cursor" }) => {
const config = EDITOR_CONFIGS[variant];
return <MdxCodeBlock>{createMdxCodeBlock(config.language, config.content())}</MdxCodeBlock>;
};
export const MCPConfigSnippet: React.FC<MCPConfigSnippetProps> = ({ variant = 'cursor' }) => {
const config = EDITOR_CONFIGS[variant]
return <MdxCodeBlock>{createMdxCodeBlock(config.language, config.content())}</MdxCodeBlock>
}

export default MCPConfigSnippet;
export default MCPConfigSnippet
3 changes: 2 additions & 1 deletion src/hooks/featureDefinitions/platform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ export const platformFeatures = {
},
imports: {
name: 'Warehouse import',
description: 'Import data from external warehouses and sources like Stripe, HubSpot, and S3 for unified analysis',
description:
'Import data from external warehouses and sources like Stripe, HubSpot, and S3 for unified analysis',
},
},
},
Expand Down
7 changes: 6 additions & 1 deletion src/navs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ export const handbookSidebar = [
name: 'Sales, CS & Onboarding',
url: '',
children: [
{
{
name: 'Overview',
url: '',
children: [
Expand Down Expand Up @@ -5527,6 +5527,11 @@ export const docsMenu = {
url: '/docs/llm-analytics/installation/anthropic',
icon: 'IconAnthropic',
},
{
name: 'Claude Agent SDK',
url: '/docs/llm-analytics/installation/claude-agent-sdk',
icon: 'IconAnthropic',
},
{
name: 'Google',
url: '/docs/llm-analytics/installation/google',
Expand Down
12 changes: 4 additions & 8 deletions src/pages/dpa.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ function DpaGenerator() {
Gen Z slang edition
</label>
<br />
<div className="block text-sm opacity-75">
Compliance, but make it bestie energy
</div>
<div className="block text-sm opacity-75">Compliance, but make it bestie energy</div>
</li>
</ul>
</div>
Expand Down Expand Up @@ -745,8 +743,8 @@ function DpaGenerator() {
<h3>Sub-processors (the supporting cast)</h3>
<p>
We work with a small lineup of other companies (cloud hosting, the usual suspects) to
help run the platform. They're vetted, they're on the same vibe re: data protection,
and we'll keep you posted if anyone new joins the cast.
help run the platform. They're vetted, they're on the same vibe re: data protection, and
we'll keep you posted if anyone new joins the cast.
</p>

<h3>International transfers (passport era)</h3>
Expand All @@ -769,9 +767,7 @@ function DpaGenerator() {
keeping screenshots, no clinging to receipts. We move on like grown adults.
</p>

<p className="font-bold">
Cool? Cool. Sign below and we're locked in 💯
</p>
<p className="font-bold">Cool? Cool. Sign below and we're locked in 💯</p>

<div className="pb-16">
<SignatureFields />
Expand Down
5 changes: 1 addition & 4 deletions src/pages/teams/team-ben.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,7 @@ export default function TeamBenPage(): JSX.Element {

const teamLength = bens.length
const pineapplePercentage =
teamLength > 0 &&
Math.round(
(bens.filter((p: any) => p.pineappleOnPizza).length / teamLength) * 100
)
teamLength > 0 && Math.round((bens.filter((p: any) => p.pineappleOnPizza).length / teamLength) * 100)

const heightToHedgehogs = 0
const hedgehogPercentage = 0
Expand Down
Loading