Integrate Unleash with Cursor
The Unleash MCP server connects Cursor to your Unleash instance, enabling AI-assisted feature flag management. You can evaluate code changes, create flags, generate wrapping code, manage rollouts, and clean up flags from within Cursor’s AI-first development environment.
Cursor supports MCP across two interfaces:
- Cursor IDE — The primary interface, an AI-first code editor with Agent mode, Rules, Hooks, Skills, and Plugins
- Cursor CLI — Terminal-based agent access via the
agentcommand
Cursor’s IDE-native primitives create a layered automation system for feature flags: Rules encode your team’s conventions, Hooks validate MCP operations before they execute, Skills orchestrate multi-step workflows, and Plugins bundle everything for team distribution.
Prerequisites
Before you begin, make sure you have the following:
- Node.js 18 or later: The MCP server is distributed as an npm package
- Cursor: IDE or CLI installed
- An Unleash instance: Cloud or self-hosted, with API access enabled
- A personal access token (PAT): With permissions to create and manage feature flags
Install the MCP server
The Unleash MCP server runs as a local stdio process. Configuration differs between the IDE and CLI, but both use the same npm package and credentials.
First, create a credentials file:
Now configure your preferred interface:
Cursor IDE
Cursor CLI
Requirements: Cursor installed.
You can add the Unleash MCP server with a one-click install from cursor.directory or by creating the configuration file manually.
One-click install
Create file manually
The Unleash MCP server is listed on cursor.directory.
Click Add to Cursor on the listing page, or open this link directly.
Cursor opens and pre-fills the MCP server configuration. The installer prompts you for your UNLEASH_BASE_URL and UNLEASH_PAT values.
The one-click flow writes credentials directly into .cursor/mcp.json. This is fine for personal use, but for team projects you should replace the inline values with an envFile reference so the configuration file is safe to commit. See the “Create file manually” tab for details.
Configuration scopes:
Both are merged; project takes precedence on conflict. For team collaboration, use the project-level file.
Cursor uses its own .cursor/mcp.json location with the "mcpServers" root key. This differs from VS Code’s .vscode/mcp.json with a "servers" root key. If you are migrating from VS Code, update the file location and root key.
Tool reference
The Unleash MCP server exposes nine tools. The following table summarizes each tool and when to use it.
| Tool | Description | When to use |
|---|---|---|
evaluate_change | Analyzes a code change and determines whether it should be behind a feature flag. | Before implementing risky changes |
detect_flag | Searches for existing flags that match a description to prevent duplicates. | Before creating new flags |
create_flag | Creates a new feature flag with proper naming, typing, and metadata. | When no suitable flag exists |
wrap_change | Generates framework-specific code to guard a feature behind a flag. | After creating a flag |
get_flag_state | Returns the current state, strategies, and metadata for a flag. | Debugging, status checks |
set_flag_rollout | Configures rollout percentages and activation strategies. | Gradual releases |
toggle_flag_environment | Enables or disables a flag in a specific environment. | Testing, staged rollouts |
remove_flag_strategy | Deletes a rollout strategy from a flag. | Simplifying flag configuration |
cleanup_flag | Returns file locations and instructions for removing a flag after rollout. | After full rollout |
Workflows
The Unleash MCP server supports three core workflows: evaluate and wrap code in feature flags, manage rollouts across environments, and clean up after rollout. Cursor adds a fourth workflow unique to its architecture: Rules-guided flag evaluation.
Evaluate and wrap code in feature flags
Use this workflow when implementing a change that might affect production stability, such as a payment integration, authentication flow, or external API call.
Evaluate the change
Tell the agent what you are working on:
The agent calls evaluate_change and returns a recommendation with a suggested flag name.
Check for duplicates
The agent automatically calls detect_flag to search for existing flags.
If a suitable flag exists, the agent suggests reusing it instead of creating a duplicate.
Rules-guided flag evaluation
Use this workflow to automate flag evaluation based on encoded policies. When a glob-scoped Rule targets a high-risk directory, the agent evaluates risk without the developer explicitly asking.
Create a Rule
Create a glob-scoped Rule targeting your high-risk domain (see Rule templates below for a complete example):
Save as .cursor/rules/payments-flags.mdc with a glob pattern like src/payments/**/*.ts.
Rules-guided evaluation catches risk during implementation rather than during code review. The flag becomes part of the development flow, not an afterthought.
Manage rollouts across environments
Use this workflow to enable a flag in staging for testing while keeping it disabled in production.
Check flag state
Enable in staging
Configure rollout
The agent calls get_flag_state and returns the flag metadata, enabled environments, and active strategies.
AI assistants can make mistakes and toggle the wrong flag. Enable change requests on production environments to require human approval before changes take effect. See the MCP server documentation for details.
Clean up after rollout
Use this workflow when a feature has been fully rolled out and the flag is no longer needed.
The agent calls cleanup_flag and returns:
- All files and line numbers where the flag is used
- Which code path to preserve (the “enabled” branch)
- Suggestions for tests to run after removal
Review the list, remove the conditional branches, and delete the flag from Unleash.
Feature flags should be temporary. Regularly clean up flags after successful rollouts to prevent technical debt.
Rule templates
Cursor Rules encode your team’s FeatureOps policies, so the agent considers feature flags automatically.
Store them in .cursor/rules/ as .mdc files with YAML frontmatter.
For more details on Rules, see the Cursor Rules documentation.
Always Apply: universal conventions
This Rule loads into every agent session. Use it for organization-wide flag standards.
Glob-scoped: domain-specific policies
This Rule loads only when the agent works with files matching the glob pattern. Use it for high-risk domains that always require flags.
Apply Intelligently: rollout guidance
This Rule loads automatically when the agent detects the conversation is about rollout strategies.
Hook examples
Hooks automate validation and auditing of MCP operations.
Store them in .cursor/hooks.json at your project root.
For more details on hooks, see the Cursor Hooks documentation.
Validate flag naming before creation
This hook fires before any Unleash MCP tool call. If the tool is create_flag, it checks the flag name against your naming convention and blocks requests that violate it.
Hooks can return allow, deny, or ask to control flow. They default to fail-open but can be configured with failClosed: true for strict enforcement. Enterprise teams can distribute hooks via the web dashboard; they sync to all team members automatically.
Audit all MCP operations
This hook fires after every Unleash MCP tool call and logs the operation for audit purposes.
Unleash plugin
A plugin bundles MCP tools, Rules, Skills, and Hooks into a single installable package. The Unleash plugin is the recommended way to distribute the integration across teams and projects.
Directory structure
plugin.json
SKILL.md
Skills are invoked with /skill-name in chat or discovered automatically by the agent when the context is relevant.
mcp.json
Install the plugin
- From Team Marketplace: Admin imports the GitHub repository via Dashboard > Settings > Plugins. Set as required for automatic installation across the team.
- Local testing: Symlink to
~/.cursor/plugins/local/unleash-featureops:
For more details on creating and distributing plugins, see the Cursor Plugins documentation.
Prompt patterns
The following prompt patterns help you use the MCP tools effectively.
Evaluate and create a flag
Intent: Determine if a change requires a feature flag, then create and wrap it.
Prompt:
Expected behavior: The agent calls evaluate_change, then detect_flag, create_flag, and wrap_change as needed.
Detect and reuse existing flags
Intent: Avoid duplicate flags when similar functionality exists.
Prompt:
Expected behavior: The agent calls detect_flag and presents matches with confidence levels.
Toggle or check flag state
Intent: Enable, disable, or query a flag in a specific environment.
Prompts:
Expected behavior: The agent calls toggle_flag_environment or get_flag_state.
Clean up a flag
Intent: Safely remove flagged code and delete unused flags.
Prompts:
Expected behavior: The agent calls cleanup_flag and provides removal instructions.
Rules-triggered automatic evaluation
Intent: Automatically evaluate code changes based on encoded policies.
Trigger: A glob-scoped Rule (e.g., targeting src/payments/**) loads when the agent works with matching files.
Expected behavior: The Rule instructs the agent to call evaluate_change whenever it modifies files in the target domain. If a flag is needed, the agent notifies you and offers to create it.
Skill-orchestrated workflow
Intent: Run a multi-step FeatureOps workflow using a skill.
Prompt:
Expected behavior: The skill orchestrates the full workflow: evaluate the current changes, check for duplicates, create the flag if needed, wrap the code, and suggest a rollout strategy. Each step calls the appropriate MCP tool.
CLI-based evaluation
Intent: Evaluate and flag changes from the terminal.
Prompts:
Expected behavior: The CLI agent uses the same MCP tools as the IDE. In non-interactive mode (-p), the agent outputs results and exits.
Enterprise governance
Cursor provides enterprise controls relevant to MCP server deployment.
- MCP server trust management — Enterprise admins can whitelist or blocklist specific MCP servers at the organization level. Ensure the Unleash MCP server is on the whitelist.
- Privacy mode — Enforces zero data retention with AI providers. Enabled by default for team members. Does not affect MCP server communication, which goes directly to your Unleash instance.
- Team Rules — Organization-wide Rules with enforcement toggles. Prevent developers from disabling mandatory FeatureOps policies.
- Team hooks — Enterprise-distributed hooks that sync to team members every 30 minutes via the web dashboard. Use these for MCP validation and audit logging.
- Agent sandbox — Enforceable org-wide on Enterprise plans. Controls what the agent can execute autonomously.
- Audit logs — Track administrative actions including MCP-related operations.
- SSO/SCIM — SAML/OIDC authentication and automated user provisioning.
For MCP server governance, commit .cursor/mcp.json and .cursor/hooks.json to version control. This ensures all team members use the same MCP servers with the same validation rules.
Use tool approval prompts for write operations like create_flag and toggle_flag_environment.
Auto-run is appropriate for read-only operations like get_flag_state, detect_flag, and evaluate_change.
Troubleshooting
MCP server not appearing in Cursor
- Check
.cursor/mcp.jsonfor syntax errors - Verify the file is at the project root under
.cursor/ - Open Settings > Features > Model Context Protocol and toggle the server on
- Restart Cursor after making changes
- Check MCP logs via Output panel > “MCP Logs”
Environment variables not expanding
- Cursor uses
${env:NAME}syntax (not${NAME}or${VAR}) - Restart your terminal and IDE after modifying your shell profile
- Verify variables are exported:
echo $UNLEASH_BASE_URL - If using
envFile, verify the file path is correct and the file exists
Authentication failed
- Confirm your Unleash PAT is valid and has not expired
- Check that the PAT has permissions to create and manage feature flags
- Verify that
UNLEASH_BASE_URLincludes/apiat the end - Test directly:
curl -H "Authorization: $UNLEASH_PAT" "$UNLEASH_BASE_URL/admin/projects"
Hook not firing
- Verify
.cursor/hooks.jsonexists and contains valid JSON - Check that the
matcherpattern matches the expected tool (e.g.,MCP:unleash) - Ensure hook scripts are executable:
chmod +x .cursor/hooks/validate-flag-name.sh - View hook output in the Hooks output channel
Node.js not found
Local servers using npx require Node.js 18+. Verify with node --version. If Node.js is installed but not found by Cursor, check that the IDE inherits your shell PATH.
Tool approval prompts
By default, the agent requests approval before executing MCP tools. Configure auto-run in Settings or use ~/.cursor/permissions.json for granular control. In the CLI, use --approve-mcps.
CLI shows 'not loaded (needs approval)'
agent mcp list may show “not loaded (needs approval)” even after running agent mcp enable. This is expected. MCP servers are lazy-loaded and only start when an agent session begins. Start an interactive session with agent --approve-mcps to auto-approve, or approve the server when prompted during your first session. Once approved, subsequent sessions load the server automatically.
Cloud Agent MCP access
Cloud Agents access MCP servers configured for the team. Ensure the Unleash MCP server is configured at the team level and credentials are set in the Cloud Agent Secrets tab.
envFile vs env interpolation
Use envFile for simplicity. Use ${env:NAME} interpolation if you need per-variable control or mixing environment sources. Don’t use both for the same variable.
Best practices
Follow these guidelines for effective feature flag management with Cursor.
While the MCP server can automate flag creation, high-risk changes should involve human review. Use tool approval prompts for flag creation, rollout plans, and cleanup decisions.
Establish organization-wide standards for flag names (e.g., domain-feature-variant) and types. Encode these in Rules so the agent applies them automatically.
Always use detect_flag before creating new flags. This keeps naming consistent and reduces fragmentation across services.
Feature flags should be removed after successful rollouts. Use cleanup_flag regularly to prevent technical debt.
Configure MCP servers at project scope (.cursor/mcp.json) and commit to version control. All team members get the same configuration.
Write your feature flag guidelines in Rules with appropriate application modes. The agent reads these Rules and applies the guidance automatically based on context.