Integrate Unleash with GitHub Copilot
The Unleash MCP server connects GitHub Copilot to your Unleash instance, enabling AI-assisted feature flag management directly in your IDE. You can evaluate code changes, create flags, automatically wrap changes in feature flags, manage rollouts, and clean up flags without leaving your editor.
GitHub Copilot supports MCP in several environments:
- Visual Studio Code with full MCP support available in versions 1.102+.
- JetBrains IDEs with IntelliJ IDEA, PyCharm, WebStorm, and others AI Assistant.
- Visual Studio with the GitHub Copilot extension.
- Neovim with community plugins like mcphub.nvim.
- Copilot CLI, a command-line interface.
- On GitHub.com, a web-based Copilot (no MCP support).
Prerequisites
Before you begin, make sure you have the following:
- Node.js 18 or later: the MCP server is distributed as an npm package.
- A supported IDE, see environment-specific requirements here.
- 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 by environment, but all IDEs use the same npm package and credentials.
First, create a shared credentials file that works across all environments:
Configure your IDE
Visual Studio Code
JetBrains IDEs
Visual Studio
Neovim
Copilot CLI
GitHub.com
Requirements: Visual Studio Code 1.102 or later with GitHub Copilot extension.
Create the configuration file
Create a file at .vscode/mcp.json in your project root:
Global configuration: To use the MCP server across all projects, run MCP: Add Server from the Command Palette and choose Global.
Remote development: For Dev Containers, WSL, or SSH, define the server in the remote .vscode/mcp.json or in the customizations.vscode.mcp section of devcontainer.json.
Verify the installation
After configuring your IDE, verify that the Unleash MCP tools are available (full list below).
Try one of the following prompts (or the prompt patterns below):
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
This section describes common workflows for using the Unleash MCP server with GitHub Copilot.
Evaluate and wrap a risky change
Use this workflow when you’re implementing a change that might affect production stability, such as a payment integration, authentication flow, or external API call.
Evaluate the change
Ask Copilot to assess whether the change needs a feature flag:
Copilot calls evaluate_change and returns a recommendation with a suggested flag name.
Check for duplicates
Copilot automatically calls detect_flag to search for existing flags. If a suitable flag exists, Copilot suggests reusing it instead of creating a duplicate.
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
Copilot calls get_flag_state and returns the flag metadata, enabled environments, and active strategies.
Clean up after rollout
Use this workflow when a feature has been fully rolled out and the flag is no longer needed.
Copilot 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.
Define custom instructions
You can configure project-level instructions to make feature flag evaluation automatic. When custom instructions are present, Copilot considers them on every interaction.
Create a file at .github/copilot-instructions.md in your repository:
With these instructions in place, when a developer asks Copilot to “add Stripe payments,” Copilot automatically evaluates, detects, creates, and wraps without explicit prompting.
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, create it if needed and wrap the code in the flag.
Prompt:
Expected behavior: Copilot 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: Copilot 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: Copilot calls toggle_flag_environment or get_flag_state.
Clean up a flag
Intent: Safely remove flagged code and delete unused flags.
Prompts:
Expected behavior: Copilot calls cleanup_flag and provides removal instructions.
Troubleshooting
MCP tools not showing up
VS Code
JetBrains
Neovim
Copilot CLI
- Check that
.vscode/mcp.jsonis in the project root. - Verify the env file path is correct and the file exists.
- Confirm Node.js and npm are available in your terminal.
- Check that your Unleash PAT has the required permissions.
Run MCP: List Servers from the Command Palette and select Show Output to view server logs.
Authentication failed
- Confirm your Unleash PAT is valid and has permissions to create and manage feature flags.
- Check that
UNLEASH_BASE_URLincludes/apiat the end. - For GitHub Enterprise plans, ensure the “MCP servers in Copilot” policy is enabled.
Too many tools in the tool picker
Visual Studio Code limits a single chat session to 128 tools. If you have many MCP servers installed:
- Create a tool set with only the Unleash tools you need.
- Deselect tools from other MCP servers you’re not actively using.
Server not starting in remote containers
When using Dev Containers, WSL, or SSH remote development:
- Define the server in the remote
.vscode/mcp.jsonor in thecustomizations.vscode.mcpsection ofdevcontainer.json. - Ensure Node.js is available in the container.
envFile not supported
Some IDEs (JetBrains, Visual Studio) do not support the envFile property. In these cases:
- Set environment variables directly in the IDE’s MCP configuration.
- Use system-level environment variables in your shell profile.
- For CI/CD, use secrets management to inject variables.
Best practices
Follow these guidelines for effective feature flag management with AI assistants.
While the MCP server can automate flag creation, high-risk changes should involve human review. Approve flag creation, rollout plans, and cleanup decisions.
Establish organization-wide standards for flag names (e.g., domain-action-variant) and types (release, experiment, kill-switch). The MCP server enforces these rules.
Always use detect_flag before creating new flags. This keeps naming consistent and reduces fragmentation across microservices.
Feature flags should be removed after successful rollouts. Use cleanup_flag regularly to prevent technical debt.
Architecture
The following diagram shows how the Unleash MCP server fits into your development workflow.
Key points:
- The MCP server runs locally on your machine as a stdio process.
- It communicates with the Unleash Admin API using your PAT.
- Feature flag evaluations happen locally in your application via SDKs or Unleash Edge.
- No user data is sent to the Unleash server during flag evaluation.