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.

3.3 KB
Raw Blame
# Local-dev environment for the MCP service. Copy to .env and fill in the
# real values. .env is gitignored.
#
# This is the single local-dev env file: the Hono server (scripts/dev-hono.ts),
# the edge-proxy worker (wrangler falls back to .env when .dev.vars is absent),
# and the UI-apps build (scripts/build-ui-apps.ts) all read it.
#
# In production (k8s), these go in via the charts repo's Kubernetes
# secret manifest for the MCP deployment, not via this file.

# Custom API base URL for self-hosted PostHog instances.
# WARNING: In PostHog Production, do NOT set this - the code automatically handles US/EU routing.
# See getAuthorizationServerUrl() in src/lib/constants.ts for details.
POSTHOG_API_BASE_URL=http://localhost:8010

# Public-facing PostHog URL used when rendering the clickable links in tool responses
# (the `_posthogUrl` field). Set this when POSTHOG_API_BASE_URL points at a non-clickable
# hostname (e.g. cluster-internal Hono routing). Falls back to POSTHOG_API_BASE_URL when unset.
# POSTHOG_PUBLIC_URL=http://localhost:8010

# Base URL for serving MCP UI app static assets (the MCP server's own URL)
MCP_APPS_BASE_URL=http://localhost:8787

# Trust X-Forwarded-Host when building the public URL in OAuth metadata and redirects.
# Set this only behind a local tunnel (ngrok, cloudflared) that sets the header, so the
# advertised URL names the tunnel host instead of localhost. Never set it in production:
# nothing in front of the worker or the k8s deployment sets this header.
# MCP_TRUST_FORWARDED_HOST=true

# PostHog base URL for MCP Apps analytics (CSP and event ingestion)
POSTHOG_MCP_APPS_ANALYTICS_BASE_URL=http://localhost:8010
POSTHOG_UI_APPS_TOKEN=phc_<your_ui_apps_project_api_key>

# PostHog project API key for dev/self-hosted analytics
# If not set, simply won't capture any analytics
POSTHOG_ANALYTICS_API_KEY=phc_<your_analytics_project_api_key>
POSTHOG_ANALYTICS_HOST=http://localhost:8010

# HMAC-SHA256 signing secret for the typed-confirm `confirmed_action`
# paradigm - bound to user identity, tool purpose, TTL, and a single-use
# nonce inside every `<tool>-prepare` token.
#
# - Minimum 32 bytes. Anything shorter is rejected at boot.
# - Missing or short: the paradigm is disabled (no boot crash);
#   non-`confirmed_action` tools keep working, `-prepare`/`-execute`
#   calls fail at request time, the `mcp_confirmed_action_runtime_installed`
#   gauge reports 0.
# - For local dev only, any 32-byte string is fine. For production,
#   generate with: `openssl rand -hex 32`.
MCP_SIGNED_STATE_KEY=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

# End user IP for the activity log. The PostHog API sees the Hono pod as the caller, so the
# runtime signs the end user IP onto every API call. Each value is a comma-separated key list,
# newest first. Leave them unset in local dev, where the API sees the real client anyway.
#
# - MCP_CLIENT_IP_SIGNING_KEYS (Hono): signs for the API. Must match the API's
#   MCP_CLIENT_IP_SIGNING_KEYS.
# - MCP_EDGE_CLIENT_IP_SIGNING_KEYS (Hono): verifies the IP the Worker signed.
# - MCP_EDGE_CLIENT_IP_SIGNING_KEYS_US / _EU (Worker secrets): sign the Cloudflare client IP for
#   the Hono runtime of that region. Must match that region's MCP_EDGE_CLIENT_IP_SIGNING_KEYS.
# MCP_CLIENT_IP_SIGNING_KEYS=
# MCP_EDGE_CLIENT_IP_SIGNING_KEYS=
# MCP_EDGE_CLIENT_IP_SIGNING_KEYS_US=
# MCP_EDGE_CLIENT_IP_SIGNING_KEYS_EU=