About productmetrics
productmetrics is an MCP server for querying PostHog analytics and managing projects, feature flags, and experiments. It uses a personal API key with the PostHog REST API rather than hosted OAuth.
Key features
- 01List and inspect projects
- 02List, inspect, and query insights
- 03Run HogQL queries
- 04Create and update feature flags
- 05List and inspect experiments
Use cases
- 01Review project analytics from an MCP client
- 02Run a HogQL query against PostHog
- 03Manage feature flags with an MCP client
MCP support
Exposes PostHog project, insight, feature flag, and experiment operations as MCP tools. It runs as a stdio server and authenticates with a personal API key.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y @reneturcios/productmetricsLocal servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
12Saved tool list · updated 1w ago
This tool takes no parameters.
Details
From the project READMEproductmetrics
PostHog product analytics as MCP tools, talking to the PostHog REST API. productmetrics is a clean-room rebuild of the core surface of the PostHog MCP server, under a new name: fresh code, no copied branding. The original is PostHog's hosted remote MCP (OAuth); hosted OAuth is NOT reproduced — this rebuild is a personal-API-key REST client for the same API.
Tools (core subset, 12)
list_projects, get_project, list_insights, get_insight,
query_insight, run_hogql_query, list_feature_flags,
get_feature_flag, create_feature_flag, update_feature_flag,
list_experiments, get_experiment.
Not in this subset: events and persons, actions and cohorts, annotations, dashboards, data warehouse, error tracking, surveys, session recordings, subscriptions, and organization admin tools.
Setup
Create a personal API key in PostHog and set it:
export POSTHOG_API_KEY=phx_...
export POSTHOG_PROJECT_ID=12345 # optional default project
Optionally override the host with POSTHOG_HOST (for example the EU
host) or the full base with POSTHOG_API_BASE_URL (default
https://app.posthog.com/api). Without the key, every tool call fails
with an error naming the missing variable. Pass project_id per call
or rely on the POSTHOG_PROJECT_ID fallback.
CLI
npx @reneturcios/productmetrics list_projects '{}'
npx @reneturcios/productmetrics mcp # stdio MCP server
Each tool name is a subcommand taking one JSON object argument.
MCP client config
{
"mcpServers": {
"productmetrics": {
"command": "npx",
"args": ["-y", "@reneturcios/productmetrics", "mcp"],
"env": { "POSTHOG_API_KEY": "phx_..." }
}
}
}
Docker
docker run -i -e POSTHOG_API_KEY ghcr.io/cloudcorprecords/productmetrics
Development
npm install
npm run build
npm test
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.