repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
ndaba1/twinit | https://github.com/ndaba1/twinit/blob/02a62566898f3127bfc18449fcae9ebcdad248ad/src/lib/astro.ts | src/lib/astro.ts | import { execa } from "execa";
import { showSuccess } from "../util/index.js";
import detectPackageManager from "../util/pacman.js";
// Add tailwindcss to Astro
export default async function () {
const pacman = await detectPackageManager();
pacman.name === "npm" && (pacman.name = "npx");
console.log("Adding Tai... | typescript | MIT | 02a62566898f3127bfc18449fcae9ebcdad248ad | 2026-01-05T05:00:07.855350Z | false |
ndaba1/twinit | https://github.com/ndaba1/twinit/blob/02a62566898f3127bfc18449fcae9ebcdad248ad/src/lib/nuxt2.ts | src/lib/nuxt2.ts | import fs from "fs-extra";
import { Listr } from "listr2";
import { createRequire } from "module";
import path from "path";
import { showSuccess } from "../util/index.js";
import detectPackageManager from "../util/pacman.js";
const require = createRequire(import.meta.url);
// Install tailwindcss on nuxt
export defaul... | typescript | MIT | 02a62566898f3127bfc18449fcae9ebcdad248ad | 2026-01-05T05:00:07.855350Z | false |
ndaba1/twinit | https://github.com/ndaba1/twinit/blob/02a62566898f3127bfc18449fcae9ebcdad248ad/src/lib/angular.ts | src/lib/angular.ts | import path from "path";
import { runGenericTasks } from "../util/index.js";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export default async function (opts: any) {
await runGenericTasks({
opts,
sources: ["./src/**/*.{html,ts}"],
cssFile: path.join(process.cwd(), "src", "styles.css"),
... | typescript | MIT | 02a62566898f3127bfc18449fcae9ebcdad248ad | 2026-01-05T05:00:07.855350Z | false |
ndaba1/twinit | https://github.com/ndaba1/twinit/blob/02a62566898f3127bfc18449fcae9ebcdad248ad/src/lib/solid.ts | src/lib/solid.ts | // Implementation for solid is exactly the same as for CRA
import implementation from "./cra.js";
export default implementation;
| typescript | MIT | 02a62566898f3127bfc18449fcae9ebcdad248ad | 2026-01-05T05:00:07.855350Z | false |
ndaba1/twinit | https://github.com/ndaba1/twinit/blob/02a62566898f3127bfc18449fcae9ebcdad248ad/src/lib/parcel.ts | src/lib/parcel.ts | export default async function () {
console.log("Not yet implemented...");
}
| typescript | MIT | 02a62566898f3127bfc18449fcae9ebcdad248ad | 2026-01-05T05:00:07.855350Z | false |
ndaba1/twinit | https://github.com/ndaba1/twinit/blob/02a62566898f3127bfc18449fcae9ebcdad248ad/src/lib/meteor.ts | src/lib/meteor.ts | export default async function () {
console.log("Not yet implemented...");
}
| typescript | MIT | 02a62566898f3127bfc18449fcae9ebcdad248ad | 2026-01-05T05:00:07.855350Z | false |
ndaba1/twinit | https://github.com/ndaba1/twinit/blob/02a62566898f3127bfc18449fcae9ebcdad248ad/src/lib/vanilla.ts | src/lib/vanilla.ts | typescript | MIT | 02a62566898f3127bfc18449fcae9ebcdad248ad | 2026-01-05T05:00:07.855350Z | false | |
ndaba1/twinit | https://github.com/ndaba1/twinit/blob/02a62566898f3127bfc18449fcae9ebcdad248ad/src/lib/vite-react.ts | src/lib/vite-react.ts | // Vite-react similar to CRA with very minor differences
import { runGenericTasks } from "../util/index.js";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export default async function (opts: any) {
await runGenericTasks({
opts,
sources: ["./index.html", "./src/**/*.{js,jsx,ts,tsx}"],
tw... | typescript | MIT | 02a62566898f3127bfc18449fcae9ebcdad248ad | 2026-01-05T05:00:07.855350Z | false |
chrisgrieser/obsidian-theme-design-utilities | https://github.com/chrisgrieser/obsidian-theme-design-utilities/blob/e6d506c8fe6ef353e6a3ad46d30426db5823e04e/src/obsidian-undocumented-api.d.ts | src/obsidian-undocumented-api.d.ts | import "obsidian";
declare module "obsidian" {
interface App {
isMobile: () => boolean;
emulateMobile: (toggle: boolean) => void;
setTheme: (mode: string) => void; // dark mode
customCss: {
setTheme: (theme: string) => void; // sets theme
theme: string; // get current theme
themes: unknown[]; // get ... | typescript | MIT | e6d506c8fe6ef353e6a3ad46d30426db5823e04e | 2026-01-05T05:00:09.411849Z | false |
chrisgrieser/obsidian-theme-design-utilities | https://github.com/chrisgrieser/obsidian-theme-design-utilities/blob/e6d506c8fe6ef353e6a3ad46d30426db5823e04e/src/main.ts | src/main.ts | import { MarkdownView, Notice, Plugin } from "obsidian";
// https://www.electronjs.org/docs/latest/api/web-contents#contentsopendevtoolsoptions
declare const electronWindow: {
openDevTools: () => void;
toggleDevTools: () => void;
};
//ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
/... | typescript | MIT | e6d506c8fe6ef353e6a3ad46d30426db5823e04e | 2026-01-05T05:00:09.411849Z | false |
IntrinsicLabsAI/gbnfgen | https://github.com/IntrinsicLabsAI/gbnfgen/blob/0ef1dd70bed9948905ba67374be5487adbdd6320/src/compiler.test.ts | src/compiler.test.ts | import { expect, test } from "vitest";
import { compile, compileSync } from "./compiler.js";
import { serializeGrammar } from "./grammar.js";
test("union types", () => {
const grammar = compileSync(`
interface Person {
age: number[] | string[];
}
`, "Person"
);
expect(serializeGrammar(grammar).trimEnd... | typescript | MIT | 0ef1dd70bed9948905ba67374be5487adbdd6320 | 2026-01-05T05:00:12.064788Z | false |
IntrinsicLabsAI/gbnfgen | https://github.com/IntrinsicLabsAI/gbnfgen/blob/0ef1dd70bed9948905ba67374be5487adbdd6320/src/inMemoryHost.ts | src/inMemoryHost.ts | import ts from "typescript";
export interface InMemoryCompilerHost extends ts.CompilerHost {
addSource(fileName: string, code: string): void;
}
class InMemoryCompilerHostImpl implements InMemoryCompilerHost {
private files: Map<string, ts.SourceFile> = new Map<string, ts.SourceFile>();
addSource(fileName: str... | typescript | MIT | 0ef1dd70bed9948905ba67374be5487adbdd6320 | 2026-01-05T05:00:12.064788Z | false |
IntrinsicLabsAI/gbnfgen | https://github.com/IntrinsicLabsAI/gbnfgen/blob/0ef1dd70bed9948905ba67374be5487adbdd6320/src/grammar.ts | src/grammar.ts | export interface Grammar {
elements: Array<GrammarElement>;
}
export interface GrammarElement {
identifier: string;
alternatives: Array<GrammarRule>;
}
export type GrammarRule =
| RuleSequence
| RuleAlternatives
| RuleGroup
| RuleLiteral
| RuleReference
| RuleCharRange;
export interface RuleSequenc... | typescript | MIT | 0ef1dd70bed9948905ba67374be5487adbdd6320 | 2026-01-05T05:00:12.064788Z | false |
IntrinsicLabsAI/gbnfgen | https://github.com/IntrinsicLabsAI/gbnfgen/blob/0ef1dd70bed9948905ba67374be5487adbdd6320/src/util.ts | src/util.ts | import {
GrammarElement,
GrammarRule,
RuleReference,
alternatives,
charPattern,
group,
literal,
reference,
sequence,
} from "./grammar.js";
// ----- Default Grammar Register ----- //
const WS_ELEM: GrammarElement = {
identifier: "ws",
alternatives: [charPattern(/[ \t\n]*/g)],
};
const STRING_EL... | typescript | MIT | 0ef1dd70bed9948905ba67374be5487adbdd6320 | 2026-01-05T05:00:12.064788Z | false |
IntrinsicLabsAI/gbnfgen | https://github.com/IntrinsicLabsAI/gbnfgen/blob/0ef1dd70bed9948905ba67374be5487adbdd6320/src/index.ts | src/index.ts | import { compile, compileSync } from "./compiler.js";
import {
serializeGrammar,
Grammar,
GrammarElement,
GrammarRule,
RuleCharRange,
RuleGroup,
RuleLiteral,
RuleReference,
RuleSequence,
isCharRange,
isGroup,
isLiteral,
isReference,
isSequence,
reference,
sequence,
charPattern,
group... | typescript | MIT | 0ef1dd70bed9948905ba67374be5487adbdd6320 | 2026-01-05T05:00:12.064788Z | false |
IntrinsicLabsAI/gbnfgen | https://github.com/IntrinsicLabsAI/gbnfgen/blob/0ef1dd70bed9948905ba67374be5487adbdd6320/src/compiler.ts | src/compiler.ts | import { EnumDeclaration, InterfaceDeclaration, Project, ts } from "ts-morph";
import { alternatives, Grammar, GrammarElement, GrammarRule, group, literal, reference, sequence, } from "./grammar.js";
import {
getDefaultGrammar,
GrammarRegister,
registerToGrammar,
toElementId,
toListElementId,
WS_REF,
} fro... | typescript | MIT | 0ef1dd70bed9948905ba67374be5487adbdd6320 | 2026-01-05T05:00:12.064788Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/examples/ai-sdk/src/index.ts | examples/ai-sdk/src/index.ts | import { openai } from "@ai-sdk/openai";
import { PostHogAgentToolkit } from "@posthog/agent-toolkit/integrations/ai-sdk";
import { generateText, stepCountIs } from "ai";
import "dotenv/config";
async function analyzeProductUsage() {
console.log("π PostHog AI Agent - Product Usage Analysis\n");
const agentToolkit ... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/examples/langchain-js/src/index.ts | examples/langchain-js/src/index.ts | import { ChatPromptTemplate, MessagesPlaceholder } from "@langchain/core/prompts";
import { ChatOpenAI } from "@langchain/openai";
import { PostHogAgentToolkit } from "@posthog/agent-toolkit/integrations/langchain";
import { AgentExecutor, createToolCallingAgent } from "langchain/agents";
import "dotenv/config";
async... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/worker-configuration.d.ts | typescript/worker-configuration.d.ts | /* eslint-disable */
// Generated by Wrangler by running `wrangler types` (hash: 96c2de0d6730863f9401b3bcb7bbc669)
// Runtime types generated with workerd@1.20250508.0 2025-03-10 nodejs_compat
declare namespace Cloudflare {
interface Env {
INKEEP_API_KEY: string;
POSTHOG_BASE_URL: string;
MCP_OBJECT: DurableObje... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | true |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/tsup.config.ts | typescript/tsup.config.ts | import { defineConfig } from "tsup";
export default defineConfig({
entry: {
index: "src/index.ts",
tools: "src/tools/index.ts",
"ai-sdk": "src/integrations/ai-sdk/index.ts",
langchain: "src/integrations/langchain/index.ts",
},
format: ["cjs", "esm"],
dts: true,
clean: true,
splitting: false,
treeshake: ... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/scripts/generate-tool-schema.ts | typescript/scripts/generate-tool-schema.ts | #!/usr/bin/env tsx
// Generates JSON schema from Zod tool-inputs schemas for Python Pydantic schema generation
import * as fs from "node:fs";
import * as path from "node:path";
import { zodToJsonSchema } from "zod-to-json-schema";
import * as schemas from "../src/schema/tool-inputs";
const outputPath = path.join(__d... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/scripts/update-openapi-client.ts | typescript/scripts/update-openapi-client.ts | #!/usr/bin/env tsx
import { execSync } from "node:child_process";
import * as fs from "node:fs";
const SCHEMA_URL = "https://app.posthog.com/api/schema/";
const TEMP_SCHEMA_PATH = "temp-openapi.yaml";
const OUTPUT_PATH = "src/api/generated.ts";
async function fetchSchema() {
console.log("Fetching OpenAPI schema fro... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/inkeepApi.ts | typescript/src/inkeepApi.ts | export interface InkeepResponse {
choices: Array<{
message: {
content: string;
};
}>;
}
export async function docsSearch(apiKey: string, userQuery: string): Promise<string> {
if (!apiKey) {
throw new Error("No API key provided");
}
const response = await fetch("https://api.inkeep.com/v1/chat/completions... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/index.ts | typescript/src/index.ts | export {
getToolsFromContext,
PostHogAgentToolkit,
type PostHogToolsOptions,
} from "./tools";
export type { Context, State, Tool } from "./tools/types";
| typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/types.ts | typescript/src/tools/types.ts | import type { ApiClient } from "@/api/client";
import type { StateManager } from "@/lib/utils/StateManager";
import type { SessionManager } from "@/lib/utils/SessionManager";
import type { ScopedCache } from "@/lib/utils/cache/ScopedCache";
import type { ApiRedactedPersonalApiKey } from "@/schema/api";
import type { z ... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/index.ts | typescript/src/tools/index.ts | import type { Context, Tool, ToolBase, ZodObjectAny } from "./types";
import { ApiClient } from "@/api/client";
import { SessionManager } from "@/lib/utils/SessionManager";
import { StateManager } from "@/lib/utils/StateManager";
import { MemoryCache } from "@/lib/utils/cache/MemoryCache";
import { hash } from "@/lib/... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/toolDefinitions.ts | typescript/src/tools/toolDefinitions.ts | import z from "zod";
import toolDefinitionsJson from "../../../schema/tool-definitions.json";
export const ToolDefinitionSchema = z.object({
description: z.string(),
category: z.string(),
feature: z.string(),
summary: z.string(),
title: z.string(),
required_scopes: z.array(z.string()),
annotations: z.object({
... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/insights/query.ts | typescript/src/tools/insights/query.ts | import { InsightQueryInputSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = InsightQueryInputSchema;
type Params = z.infer<typeof schema>;
export const queryHandler = async (context: Context, params: Params) => {
const { insigh... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/insights/utils.ts | typescript/src/tools/insights/utils.ts | import type { Context } from "@/tools/types";
export const isShortId = (id: string): boolean => {
return /^[A-Za-z0-9]{8}$/.test(id);
};
export const resolveInsightId = async (
context: Context,
insightId: string,
projectId: string,
): Promise<number> => {
if (isShortId(insightId)) {
const result = await conte... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/insights/update.ts | typescript/src/tools/insights/update.ts | import { InsightUpdateSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
import { resolveInsightId } from "./utils";
const schema = InsightUpdateSchema;
type Params = z.infer<typeof schema>;
export const updateHandler = async (context: Context,... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/insights/create.ts | typescript/src/tools/insights/create.ts | import { InsightCreateSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = InsightCreateSchema;
type Params = z.infer<typeof schema>;
export const createHandler = async (context: Context, params: Params) => {
const { data } = para... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/insights/delete.ts | typescript/src/tools/insights/delete.ts | import { InsightDeleteSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import { resolveInsightId } from "./utils";
import type { z } from "zod";
const schema = InsightDeleteSchema;
type Params = z.infer<typeof schema>;
export const deleteHandler = async (context: Context,... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/insights/get.ts | typescript/src/tools/insights/get.ts | import { InsightGetSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = InsightGetSchema;
type Params = z.infer<typeof schema>;
export const getHandler = async (context: Context, params: Params) => {
const { insightId } = params;
... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/insights/getAll.ts | typescript/src/tools/insights/getAll.ts | import { InsightGetAllSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = InsightGetAllSchema;
type Params = z.infer<typeof schema>;
export const getAllHandler = async (context: Context, params: Params) => {
const { data } = para... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/surveys/global-stats.ts | typescript/src/tools/surveys/global-stats.ts | import { SurveyGlobalStatsSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = SurveyGlobalStatsSchema;
type Params = z.infer<typeof schema>;
export const globalStatsHandler = async (context: Context, params: Params) => {
const pro... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/surveys/stats.ts | typescript/src/tools/surveys/stats.ts | import { SurveyStatsSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = SurveyStatsSchema;
type Params = z.infer<typeof schema>;
export const statsHandler = async (context: Context, params: Params) => {
const projectId = await con... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/surveys/update.ts | typescript/src/tools/surveys/update.ts | import { SurveyUpdateSchema } from "@/schema/tool-inputs";
import { formatSurvey } from "@/tools/surveys/utils/survey-utils";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = SurveyUpdateSchema;
type Params = z.infer<typeof schema>;
export const updateHandler = asyn... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/surveys/create.ts | typescript/src/tools/surveys/create.ts | import { SurveyCreateSchema } from "@/schema/tool-inputs";
import { formatSurvey } from "@/tools/surveys/utils/survey-utils";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = SurveyCreateSchema;
type Params = z.infer<typeof schema>;
export const createHandler = asyn... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/surveys/delete.ts | typescript/src/tools/surveys/delete.ts | import { SurveyDeleteSchema } from "@/schema/tool-inputs";
import type { Context, Tool, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = SurveyDeleteSchema;
type Params = z.infer<typeof schema>;
export const deleteHandler = async (context: Context, params: Params) => {
const { surveyId }... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/surveys/get.ts | typescript/src/tools/surveys/get.ts | import { SurveyGetSchema } from "@/schema/tool-inputs";
import { formatSurvey } from "@/tools/surveys/utils/survey-utils";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = SurveyGetSchema;
type Params = z.infer<typeof schema>;
export const getHandler = async (contex... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/surveys/getAll.ts | typescript/src/tools/surveys/getAll.ts | import { SurveyGetAllSchema } from "@/schema/tool-inputs";
import { formatSurveys } from "@/tools/surveys/utils/survey-utils";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = SurveyGetAllSchema;
type Params = z.infer<typeof schema>;
export const getAllHandler = asy... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/surveys/utils/survey-utils.ts | typescript/src/tools/surveys/utils/survey-utils.ts | import type { SurveyListItemOutput, SurveyOutput } from "@/schema/surveys";
import type { Context } from "@/tools/types";
type SurveyData = SurveyOutput | SurveyListItemOutput;
export interface FormattedSurvey extends Omit<SurveyData, "end_date"> {
status: "draft" | "active" | "completed" | "archived";
end_date?: s... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/experiments/getResults.ts | typescript/src/tools/experiments/getResults.ts | import { ExperimentResultsResponseSchema } from "@/schema/experiments";
import { ExperimentResultsGetSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ExperimentResultsGetSchema;
type Params = z.infer<typeof schema>;
/**
* Get ... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/experiments/update.ts | typescript/src/tools/experiments/update.ts | import { ExperimentUpdateTransformSchema } from "@/schema/experiments";
import { ExperimentUpdateSchema } from "@/schema/tool-inputs";
import { getToolDefinition } from "@/tools/toolDefinitions";
import type { Context, Tool } from "@/tools/types";
import type { z } from "zod";
const schema = ExperimentUpdateSchema;
t... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/experiments/create.ts | typescript/src/tools/experiments/create.ts | import { ExperimentCreateSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ExperimentCreateSchema;
type Params = z.infer<typeof schema>;
/**
* Create a comprehensive A/B test experiment with guided setup
* This tool helps user... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/experiments/delete.ts | typescript/src/tools/experiments/delete.ts | import { ExperimentDeleteSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ExperimentDeleteSchema;
type Params = z.infer<typeof schema>;
export const deleteHandler = async (context: Context, { experimentId }: Params) => {
const... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/experiments/get.ts | typescript/src/tools/experiments/get.ts | import { ExperimentGetSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ExperimentGetSchema;
type Params = z.infer<typeof schema>;
export const getHandler = async (context: Context, { experimentId }: Params) => {
const projectI... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/experiments/getAll.ts | typescript/src/tools/experiments/getAll.ts | import { ExperimentGetAllSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ExperimentGetAllSchema;
type Params = z.infer<typeof schema>;
export const getAllHandler = async (context: Context, _params: Params) => {
const projectI... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/query/run.ts | typescript/src/tools/query/run.ts | import { QueryRunInputSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = QueryRunInputSchema;
type Params = z.infer<typeof schema>;
export const queryRunHandler = async (context: Context, params: Params) => {
const { query } = p... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/query/generateHogQLFromQuestion.ts | typescript/src/tools/query/generateHogQLFromQuestion.ts | import { InsightGenerateHogQLFromQuestionSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = InsightGenerateHogQLFromQuestionSchema;
type Params = z.infer<typeof schema>;
export const generateHogQLHandler = async (context: Context... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/organizations/setActive.ts | typescript/src/tools/organizations/setActive.ts | import { OrganizationSetActiveSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = OrganizationSetActiveSchema;
type Params = z.infer<typeof schema>;
export const setActiveHandler = async (context: Context, params: Params) => {
co... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/organizations/getOrganizations.ts | typescript/src/tools/organizations/getOrganizations.ts | import { OrganizationGetAllSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = OrganizationGetAllSchema;
type Params = z.infer<typeof schema>;
export const getOrganizationsHandler = async (context: Context, _params: Params) => {
... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/organizations/getDetails.ts | typescript/src/tools/organizations/getDetails.ts | import { OrganizationGetDetailsSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = OrganizationGetDetailsSchema;
type Params = z.infer<typeof schema>;
export const getDetailsHandler = async (context: Context, _params: Params) => {... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/llmAnalytics/getLLMCosts.ts | typescript/src/tools/llmAnalytics/getLLMCosts.ts | import { LLMAnalyticsGetCostsSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = LLMAnalyticsGetCostsSchema;
type Params = z.infer<typeof schema>;
export const getLLMCostsHandler = async (context: Context, params: Params) => {
co... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/dashboards/update.ts | typescript/src/tools/dashboards/update.ts | import { DashboardUpdateSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = DashboardUpdateSchema;
type Params = z.infer<typeof schema>;
export const updateHandler = async (context: Context, params: Params) => {
const { dashboard... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/dashboards/create.ts | typescript/src/tools/dashboards/create.ts | import { DashboardCreateSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = DashboardCreateSchema;
type Params = z.infer<typeof schema>;
export const createHandler = async (context: Context, params: Params) => {
const { data } = ... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/dashboards/delete.ts | typescript/src/tools/dashboards/delete.ts | import { DashboardDeleteSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = DashboardDeleteSchema;
type Params = z.infer<typeof schema>;
export const deleteHandler = async (context: Context, params: Params) => {
const { dashboard... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/dashboards/get.ts | typescript/src/tools/dashboards/get.ts | import { DashboardGetSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = DashboardGetSchema;
type Params = z.infer<typeof schema>;
export const getHandler = async (context: Context, params: Params) => {
const { dashboardId } = pa... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/dashboards/getAll.ts | typescript/src/tools/dashboards/getAll.ts | import { DashboardGetAllSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = DashboardGetAllSchema;
type Params = z.infer<typeof schema>;
export const getAllHandler = async (context: Context, params: Params) => {
const { data } = ... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/dashboards/addInsight.ts | typescript/src/tools/dashboards/addInsight.ts | import { DashboardAddInsightSchema } from "@/schema/tool-inputs";
import { resolveInsightId } from "@/tools/insights/utils";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = DashboardAddInsightSchema;
type Params = z.infer<typeof schema>;
export const addInsightHan... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/errorTracking/listErrors.ts | typescript/src/tools/errorTracking/listErrors.ts | import { ErrorTrackingListSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ErrorTrackingListSchema;
type Params = z.infer<typeof schema>;
export const listErrorsHandler = async (context: Context, params: Params) => {
const { o... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/errorTracking/errorDetails.ts | typescript/src/tools/errorTracking/errorDetails.ts | import { ErrorTrackingDetailsSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ErrorTrackingDetailsSchema;
type Params = z.infer<typeof schema>;
export const errorDetailsHandler = async (context: Context, params: Params) => {
c... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/projects/eventDefinitions.ts | typescript/src/tools/projects/eventDefinitions.ts | import { EventDefinitionSchema } from "@/schema/properties";
import { ProjectEventDefinitionsSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ProjectEventDefinitionsSchema;
type Params = z.infer<typeof schema>;
export const eve... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/projects/setActive.ts | typescript/src/tools/projects/setActive.ts | import { ProjectSetActiveSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ProjectSetActiveSchema;
type Params = z.infer<typeof schema>;
export const setActiveHandler = async (context: Context, params: Params) => {
const { proj... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/projects/getProjects.ts | typescript/src/tools/projects/getProjects.ts | import { ProjectGetAllSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ProjectGetAllSchema;
type Params = z.infer<typeof schema>;
export const getProjectsHandler = async (context: Context, _params: Params) => {
const orgId = a... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/projects/propertyDefinitions.ts | typescript/src/tools/projects/propertyDefinitions.ts | import { PropertyDefinitionSchema } from "@/schema/properties";
import { ProjectPropertyDefinitionsInputSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = ProjectPropertyDefinitionsInputSchema;
type Params = z.infer<typeof schema>... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/documentation/searchDocs.ts | typescript/src/tools/documentation/searchDocs.ts | import { docsSearch } from "@/inkeepApi";
import { DocumentationSearchSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = DocumentationSearchSchema;
type Params = z.infer<typeof schema>;
export const searchDocsHandler = async (con... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/featureFlags/getDefinition.ts | typescript/src/tools/featureFlags/getDefinition.ts | import { FeatureFlagGetDefinitionSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = FeatureFlagGetDefinitionSchema;
type Params = z.infer<typeof schema>;
export const getDefinitionHandler = async (context: Context, { flagId, flag... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/featureFlags/update.ts | typescript/src/tools/featureFlags/update.ts | import { FeatureFlagUpdateSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = FeatureFlagUpdateSchema;
type Params = z.infer<typeof schema>;
export const updateHandler = async (context: Context, params: Params) => {
const { flagK... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/featureFlags/create.ts | typescript/src/tools/featureFlags/create.ts | import { FeatureFlagCreateSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = FeatureFlagCreateSchema;
type Params = z.infer<typeof schema>;
export const createHandler = async (context: Context, params: Params) => {
const { name,... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/featureFlags/delete.ts | typescript/src/tools/featureFlags/delete.ts | import { FeatureFlagDeleteSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = FeatureFlagDeleteSchema;
type Params = z.infer<typeof schema>;
export const deleteHandler = async (context: Context, params: Params) => {
const { flagK... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/tools/featureFlags/getAll.ts | typescript/src/tools/featureFlags/getAll.ts | import { FeatureFlagGetAllSchema } from "@/schema/tool-inputs";
import type { Context, ToolBase } from "@/tools/types";
import type { z } from "zod";
const schema = FeatureFlagGetAllSchema;
type Params = z.infer<typeof schema>;
export const getAllHandler = async (context: Context, _params: Params) => {
const projec... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/integrations/ai-sdk/index.ts | typescript/src/integrations/ai-sdk/index.ts | import { ApiClient } from "@/api/client";
import { SessionManager } from "@/lib/utils/SessionManager";
import { StateManager } from "@/lib/utils/StateManager";
import { MemoryCache } from "@/lib/utils/cache/MemoryCache";
import { hash } from "@/lib/utils/helper-functions";
import { getToolsFromContext } from "@/tools";... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/integrations/langchain/index.ts | typescript/src/integrations/langchain/index.ts | import { ApiClient } from "@/api/client";
import { SessionManager } from "@/lib/utils/SessionManager";
import { StateManager } from "@/lib/utils/StateManager";
import { MemoryCache } from "@/lib/utils/cache/MemoryCache";
import { hash } from "@/lib/utils/helper-functions";
import { getToolsFromContext } from "@/tools";... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/integrations/mcp/index.ts | typescript/src/integrations/mcp/index.ts | import { McpServer, type ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
import { McpAgent } from "agents/mcp";
import type { z } from "zod";
import { ApiClient } from "@/api/client";
import { getPostHogClient } from "@/integrations/mcp/utils/client";
import { handleToolError } from "@/integrations/mcp/... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/integrations/mcp/utils/client.ts | typescript/src/integrations/mcp/utils/client.ts | import { PostHog } from "posthog-node";
let _client: PostHog | undefined;
export const getPostHogClient = () => {
if (!_client) {
_client = new PostHog("sTMFPsFhdP1Ssg", {
host: "https://us.i.posthog.com",
flushAt: 1,
flushInterval: 0,
});
}
return _client;
};
| typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/integrations/mcp/utils/handleToolError.ts | typescript/src/integrations/mcp/utils/handleToolError.ts | import { getPostHogClient } from "@/integrations/mcp/utils/client";
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
export class MCPToolError extends Error {
public readonly tool: string;
public readonly originalError: unknown;
public readonly timestamp: Date;
constructor(message: string... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/api/generated.ts | typescript/src/api/generated.ts | export namespace Schemas {
// <Schemas>
export type AIEventType =
| "$ai_generation"
| "$ai_embedding"
| "$ai_span"
| "$ai_trace"
| "$ai_metric"
| "$ai_feedback";
export type UrlMatchingEnum = "contains" | "regex" | "exact";
export type NullEnum = null;
export type ActionStepJSON = Par... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | true |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/api/client.ts | typescript/src/api/client.ts | import { ErrorCode } from "@/lib/errors";
import { withPagination } from "@/lib/utils/api";
import { getSearchParamsFromRecord } from "@/lib/utils/helper-functions";
import {
type ApiEventDefinition,
ApiEventDefinitionSchema,
type ApiPropertyDefinition,
ApiPropertyDefinitionSchema,
type ApiRedactedPersonalApiKey,
... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | true |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/api/fetcher.ts | typescript/src/api/fetcher.ts | import type { ApiConfig } from "./client";
import type { createApiClient } from "./generated";
export const buildApiFetcher: (config: ApiConfig) => Parameters<typeof createApiClient>[0] = (
config,
) => {
return {
fetch: async (input) => {
const headers = new Headers();
headers.set("Authorization", `Bearer $... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/errors.ts | typescript/src/lib/errors.ts | export enum ErrorCode {
INVALID_API_KEY = "INVALID_API_KEY",
}
| typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/analytics.ts | typescript/src/lib/analytics.ts | export type AnalyticsEvent = "mcp tool call" | "mcp tool response";
| typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/constants.ts | typescript/src/lib/constants.ts | import { env } from "cloudflare:workers";
export const DEV = false;
export const CUSTOM_BASE_URL = env.POSTHOG_BASE_URL || (DEV ? "http://localhost:8010" : undefined);
export const MCP_DOCS_URL = "https://posthog.com/docs/model-context-protocol";
| typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/types.ts | typescript/src/lib/types.ts | type PrefixedString<T extends string> = `${T}:${string}`;
| typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/utils/helper-functions.ts | typescript/src/lib/utils/helper-functions.ts | import crypto from "node:crypto";
export function hash(data: string) {
// Use PBKDF2 with sufficient computational effort for security
// 100,000 iterations provides good security while maintaining reasonable performance
const salt = crypto.createHash("sha256").update("posthog_mcp_salt").digest();
return crypto.pb... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/utils/StateManager.ts | typescript/src/lib/utils/StateManager.ts | import type { ApiClient } from "@/api/client";
import type { ApiUser } from "@/schema/api";
import type { State } from "@/tools/types";
import type { ScopedCache } from "./cache/ScopedCache";
export class StateManager {
private _cache: ScopedCache<State>;
private _api: ApiClient;
private _user?: ApiUser;
construc... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/utils/SessionManager.ts | typescript/src/lib/utils/SessionManager.ts | import type { ScopedCache } from "@/lib/utils/cache/ScopedCache";
import type { State } from "@/tools";
import { v7 as uuidv7 } from "uuid";
export class SessionManager {
private cache: ScopedCache<State>;
constructor(cache: ScopedCache<State>) {
this.cache = cache;
}
async _getKey(sessionId: string): Promise<... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/utils/api.ts | typescript/src/lib/utils/api.ts | import { ApiListResponseSchema } from "@/schema/api";
import type { z } from "zod";
export const withPagination = async <T>(
url: string,
apiToken: string,
dataSchema: z.ZodType<T>,
): Promise<T[]> => {
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${apiToken}`,
},
});
if (!respo... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/utils/cache/MemoryCache.ts | typescript/src/lib/utils/cache/MemoryCache.ts | import { ScopedCache } from "@/lib/utils/cache/ScopedCache";
const _cacheStore = new Map<string, any>();
export class MemoryCache<T extends Record<string, any>> extends ScopedCache<T> {
private cache: Map<string, any> = new Map();
constructor(scope: string) {
super(scope);
this.cache = _cacheStore.get(scope) |... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/utils/cache/DurableObjectCache.ts | typescript/src/lib/utils/cache/DurableObjectCache.ts | import { ScopedCache } from "@/lib/utils/cache/ScopedCache";
interface DurableObjectStorage {
get<T = unknown>(key: string): Promise<T | undefined>;
put<T>(key: string, value: T): Promise<void>;
delete(key: string): Promise<boolean>;
delete(keys: string[]): Promise<number>;
list(options?: {
prefix?: string;
s... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/lib/utils/cache/ScopedCache.ts | typescript/src/lib/utils/cache/ScopedCache.ts | export abstract class ScopedCache<T extends Record<string, any>> {
constructor(private scope: string) {}
abstract get<K extends keyof T>(key: K): Promise<T[K] | undefined>;
abstract set<K extends keyof T>(key: K, value: T[K]): Promise<void>;
abstract delete<K extends keyof T>(key: K): Promise<void>;
abstract clea... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/query.ts | typescript/src/schema/query.ts | import { z } from "zod";
// Common enums and types
const NodeKind = z.enum(["TrendsQuery", "FunnelsQuery", "HogQLQuery", "EventsNode"]);
const IntervalType = z.enum(["hour", "day", "week", "month"]);
const ChartDisplayType = z.enum([
"ActionsLineGraph",
"ActionsTable",
"ActionsPie",
"ActionsBar",
"ActionsBarVal... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/flags.ts | typescript/src/schema/flags.ts | import { z } from "zod";
export interface PostHogFeatureFlag {
id: number;
key: string;
name: string;
}
export interface PostHogFlagsResponse {
results?: PostHogFeatureFlag[];
}
const base = ["exact", "is_not", "is_set", "is_not_set"] as const;
const stringOps = [
...base,
"icontains",
"not_icontains",
"regex... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/errors.ts | typescript/src/schema/errors.ts | import { z } from "zod";
export enum OrderByErrors {
Occurrences = "occurrences",
FirstSeen = "first_seen",
LastSeen = "last_seen",
Users = "users",
Sessions = "sessions",
}
export enum OrderDirectionErrors {
Ascending = "ASC",
Descending = "DESC",
}
export enum StatusErrors {
Active = "active",
Resolved = ... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/dashboards.ts | typescript/src/schema/dashboards.ts | import { z } from "zod";
export const DashboardTileSchema = z.object({
insight: z.object({
short_id: z.string(),
name: z.string(),
derived_name: z.string().nullable(),
description: z.string().nullable(),
query: z.object({
kind: z.union([z.literal("InsightVizNode"), z.literal("DataVisualizationNode")]),
... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/tool-inputs.ts | typescript/src/schema/tool-inputs.ts | import { z } from "zod";
import {
AddInsightToDashboardSchema,
CreateDashboardInputSchema,
ListDashboardsSchema,
UpdateDashboardInputSchema,
} from "./dashboards";
import { ErrorDetailsSchema, ListErrorsSchema } from "./errors";
import { FilterGroupsSchema, UpdateFeatureFlagInputSchema } from "./flags";
import { Cr... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/insights.ts | typescript/src/schema/insights.ts | import { z } from "zod";
export const InsightSchema = z.object({
id: z.number(),
short_id: z.string(),
name: z.string().nullish(),
description: z.string().nullish(),
filters: z.record(z.any()),
query: z.any(),
result: z.any().optional(),
created_at: z.string(),
updated_at: z.string(),
created_by: z
.object... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/api.ts | typescript/src/schema/api.ts | import { z } from "zod";
export const ApiPropertyDefinitionSchema = z.object({
id: z.string(),
name: z.string(),
description: z.string().nullish(),
is_numerical: z.boolean().nullish(),
updated_at: z.string().nullish(),
updated_by: z.any().nullish(),
is_seen_on_filtered_events: z.boolean().nullish(),
property_t... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/properties.ts | typescript/src/schema/properties.ts | import {
ApiEventDefinitionSchema,
type ApiListResponseSchema,
ApiPropertyDefinitionSchema,
} from "@/schema/api";
import type { z } from "zod";
export const PropertyDefinitionSchema = ApiPropertyDefinitionSchema.pick({
name: true,
property_type: true,
});
export const EventDefinitionSchema = ApiEventDefinitionS... | typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
PostHog/mcp | https://github.com/PostHog/mcp/blob/e2ee61a01b3d06b9934eaf6196c222ccc70cee5c/typescript/src/schema/projects.ts | typescript/src/schema/projects.ts | import { z } from "zod";
export const ProjectSchema = z.object({
id: z.number(),
name: z.string(),
organization: z.string().uuid(),
});
export type Project = z.infer<typeof ProjectSchema>;
| typescript | MIT | e2ee61a01b3d06b9934eaf6196c222ccc70cee5c | 2026-01-05T05:00:12.097572Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.