Manage Feature Flags with MCP

The PostHog MCP server lets your AI coding agent create, manage, and schedule Feature Flags directly from your code editor. Create flags, configure targeting rules, check rollout status, and schedule future changes – without switching to the PostHog app.

This works in any MCP client – Cursor, Windsurf, Claude Code, VS Code, and others.

How it works

With MCP, your coding agent can:

  • Create flags while building features – "Create a flag called new-search rolled out to 10% of users" as part of your development workflow
  • Check flag status before deploying – "Which feature flags are active in production?" to verify your deploy won't conflict
  • Clean up stale flags – "Find flags not evaluated in 90 days" and remove the dead code
  • Update rollout rules – "Roll out dark-mode to 50%" or "add the beta-testers cohort to the new-dashboard flag"
  • Schedule future flag changes – "Schedule the new-checkout flag to enable at midnight" or "Set up a recurring weekly disable for maintenance windows"

Feature flag tools

The MCP server provides these tools for working with Feature Flags:

ToolDescription
create-feature-flagCreate a new feature flag with rollout percentage, targeting rules, and optional multivariate variants.
feature-flag-get-definitionGet the full definition of a flag, including filters, groups, and payloads.
feature-flag-get-allList all feature flags in the current project. Filter by active/inactive status.
update-feature-flagUpdate a flag's rollout percentage, targeting rules, or variants.
delete-feature-flagDelete a feature flag.

Scheduled change tools

Schedule future flag changes programmatically using these tools:

ToolDescription
scheduled-changes-listList scheduled changes in the current project. Filter by flag ID to see pending, executed, and failed schedules.
scheduled-changes-getGet the full details of a specific scheduled change by ID, including payload, timing, and execution status.
scheduled-changes-createSchedule a future change to a feature flag – enable/disable, add release conditions, or update variants. Supports recurring schedules (daily, weekly, monthly, yearly).
scheduled-changes-updateUpdate a pending scheduled change's timing, payload, or recurrence settings.
scheduled-changes-deleteDelete a scheduled change by ID. The change is permanently removed and won't execute.

Example prompts

Try these with your MCP-enabled agent:

  • Create a feature flag called new-checkout-flow rolled out to 20% of users on the pro plan.
  • Show me all active feature flags.
  • Which flags haven't been modified in the last 90 days?
  • Update the dark-mode flag to roll out to 100% of users.
  • Create a multivariate flag called button-color with three variants: red, blue, and green.
  • Delete the old-pricing-test flag.

Scheduling prompts

  • Schedule the new-checkout-flow flag to enable at midnight tomorrow.
  • List all pending scheduled changes for my feature flags.
  • Create a recurring schedule to disable the maintenance-mode flag every Sunday at 2am.
  • Cancel the scheduled rollout for the dark-mode flag.
  • Update the scheduled change for beta-features to trigger at 9am instead of noon.

Install the MCP server

The recommended way to install is with the AI wizard:

Terminal
npx @posthog/wizard mcp add

The wizard supports Claude, Cursor, Windsurf, VS Code, and more. You can also configure it manually.

See the MCP server docs for full setup instructions.

Community questions

Was this page useful?

Questions about this page? or post a community question.