Skip to main content

How to Manage Feature Flags with ConfigCat's MCP Server

· 14 min read
Péter Ádám Kóródi
Between the ifs and elses lies endless possibilities.

In this guide, you’ll learn how to connect your AI client to ConfigCat so you can list, create, and target feature flags using natural language with ConfigCat’s MCP server.

Update feature flag with ConfigCat MCP server

Prerequisites

What is Model Context Protocol (MCP)?

Model Context Protocol (MCP) is an open-source standard for connecting AI applications to external systems. It lets you interact with tools and services using natural language.

ConfigCat's MCP server provides access to ConfigCat's public management API for feature flag and configuration management. It also enables your code editor to understand your feature flags, integrate the appropriate ConfigCat SDK into your project or even create new feature flags directly in your codebase.

Creating Public API credentials

The MCP server needs a ConfigCat Public API credential to access the ConfigCat's public management API and perform the same actions available in the ConfigCat dashboard (like managing feature flags, organizations, configs, targeting rules, segments and audit logs, etc.)

You can create this credential on the Public API credentials management page. The MCP server will use this credential and will have the same permissions.

Installing MCP Server

  1. Install Cursor
  2. Open PreferencesCursor SettingsMCP & Integrations
  3. Click Add Custom MCP
  4. Add (or merge) the snippet below into your JSON settings:
{
"mcpServers": {
"ConfigCat": {
"command": "npx",
"args": ["-y", "@configcat/mcp-server"],
"env": {
"CONFIGCAT_API_USER": "YOUR_API_USER",
"CONFIGCAT_API_PASS": "YOUR_API_PASSWORD"
}
}
}
}
  1. Save – the server will start on demand.
  2. You can start writing prompts into Cursor's AI panel.
info

Replace YOUR_API_USER and YOUR_API_PASSWORD environment variables with your ConfigCat Public API credentials.

Managing Feature Flags with MCP Server

Let's try asking the agent to list all flags using the following prompt:

Prompt:

List my feature flags

Model responses are non-deterministic, so your response might differ from the following, but it should look similar to this:

Answer:

I'll help you list your feature flags. Let me start by getting your organizations and products.


Organization: Test Organization
Product: Test Product
Config: Main Config


Feature Flags:
  1. My First Feature Flag
    Key: isMyFirstFeatureEnabled
    Type: Boolean
    Description: This is your first feature flag. Automatically created to help you get started and to play around with.
Environments:
  • Test Environment
  • Production Environment

You currently have 1 feature flag in your ConfigCat setup. This appears to be a default feature flag that was automatically created when you set up your ConfigCat account. You can use this to test the feature flag functionality, or create additional feature flags as needed for your application.

info

You’ll need to click Run tool or Allow once each time the AI agent tries to interact with the ConfigCat API. MCP servers require user approval before calling external APIs as a security measure. You can review the actual API request payload here before you accept it.

If you check your ConfigCat dashboard you will see your first feature flag automatically created by the ConfigCat registration:

My First Feature Flag

Creating a Feature Flag

Let's ask the AI agent to create a new feature flag:

Prompt:

Create a feature flag called "My New Awesome Feature"

Answer:

I'll create a new feature flag called "My New Awesome Feature" for you. Let me add it to your "Main Config".


Feature Flag Created Successfully
Name: My New Awesome Feature
Key: myNewAwesomeFeature
Type: Boolean
Description: A new awesome feature flag for testing


Initial Values:
  • Test Environment: false (disabled)
  • Production Environment: false (disabled)

The feature flag has been added to your "Main Config" and is currently disabled in both environments.

If you check your ConfigCat dashboard you will see the newly created feature flag:

My New Awesome Feature Flag is OFF

Updating a Feature Flag

Prompt:

Turn the new awesome feature flag ON

Answer:

I'll turn on your new awesome feature flag in both environments. Let me update the values to true for both Test and Production environments.


Feature Flag Turned ON Successfully!
Your "My New Awesome Feature" feature flag is now enabled in both environments:
Current Status:

  • Test Environment:ON (true)
  • Production Environment:ON (true)
Feature Flag Details:
  • Name: My New Awesome Feature
  • Key: myNewAwesomeFeature
  • Type: Boolean
  • Default Value: true (enabled for all users)

The feature flag is now live and will return true for all users in both your Test and Production environments. You can use the key myNewAwesomeFeature in your application code to check if this feature is enabled.

Checking the dashboard you can see that the feature flag is turned on:

My New Awesome Feature Flag is ON

User Targeting

Let's ask the AI agent to do something a little bit more complicated:

Prompt:

turn the "myNewAwesomeFeature" ON for company.com employees

Answer:

I'll set up targeting rules to turn on the "myNewAwesomeFeature" feature flag only for employees of company.com. I'll create a targeting rule that checks if the user's email ends with "@company.com".


Feature Flag Configured for company.com Employees Only!
Perfect! I've successfully configured your "My New Awesome Feature" feature flag to be enabled only for employees of company.com. Here's how it now works:


Feature Flag: myNewAwesomeFeature
Default Value: false (disabled for everyone by default)


Targeting Rule:
  • Condition: User's email ends with @company.com
  • Result: true (feature enabled)
  • Applied to: Both Test and Production environments
How It Works:
  1. company.com Employees (emails ending with @company.com): ✅ Feature ON
  2. All Other Users: ❌ Feature OFF
Example Usage in Your Code:
// When evaluating the feature flag
const user = {
identifier: "user123",
email: "[email protected]" // company.com employee
};

const isFeatureEnabled = client.getValue("myNewAwesomeFeature", false, user);
// Returns: true (for company.com employees)

const regularUser = {
identifier: "user456",
email: "[email protected]" // Regular user
};

const isFeatureEnabledForRegular = client.getValue("myNewAwesomeFeature", false, regularUser);
// Returns: false (for other employees)

The feature flag is now live and will automatically enable the feature only for users with company.com email addresses while keeping it disabled for everyone else!

By checking the ConfigCat dashboard, you can see that the AI figured out it can enable the feature for company.com employees by inspecting email addresses: if an address ends with @company.com, it enables the feature; otherwise, it doesn’t.

My New Awesome Feature Flag with targeting rule

Evaluating a Feature Flag with AI Agents

You can also use the AI agent for feature flag evaluation:

Prompt:

Evaluate the "myNewAwesomeFeature" flag for the user with email: peter@company.com

Answer:

Based on the targeting rule configured, let me evaluate the "myNewAwesomeFeature" flag for the user with email [email protected]:


Evaluation Result: ✅ TRUE (ON)

Reasoning:

  • Targeting Rule: IF Email ends with @company.com THEN return true
  • User Email: [email protected]
  • Match: ✅ Yes, the email ends with @company.com
  • Result: The flag returns true (feature is ON)

Since Peter's email address ([email protected]) ends with @company.com, he matches the targeting rule for company.com employees, so the feature flag will be enabled for him in both Test and Production environments.

Let's evaluate the feature flag for a user with email: [email protected]

Prompt:

Evaluate the "myNewAwesomeFeature" flag for the user with email: john@example.com

Answer:

Based on the targeting rule configured, let me evaluate the "myNewAwesomeFeature" flag for the user with email [email protected]:


Evaluation Result: ❌ FALSE (OFF)

Reasoning:

  • Targeting Rule: IF Email ends with @company.com THEN return true
  • User Email: [email protected]
  • Match: ❌ No, the email ends with @example.com, not @company.com
  • Default Value: false (OFF)
  • Result: The flag returns false (feature is OFF)

Since John's email address ([email protected]) does NOT end with @company.com, he does not match the targeting rule for company.com employees. Therefore, he gets the default value of false, meaning the feature flag will be disabled for him in both Test and Production environments.

note

Note that there’s no feature-flag evaluation endpoint in the ConfigCat Public Management API. To evaluate flags, you’d need to use one of the ConfigCat SDKs. When you evaluate a feature flag via the ConfigCat MCP server, the AI model is running the evaluation logic.

Additional Feature Flag MCP Prompt Examples

  • Cloning a feature flag:

    Create a new feature flag by cloning the configuration of the "myNewAwesomeFeature" flag, and name it "myAnotherAwesomeFeature".

  • Updating a feature flag description

    Update the "myNewAwesomeFeature" flag description: "When enabled, show my awesome new feature.”

  • Listing Zombie (Stale) feature flags older than 6 days

    List the stale feature flags that haven’t been modified in the past 6 days.

  • Sending Invitation

    Invite sarah@example.com to the "Main" product with "Administrators" permissions.

  • Reviewing Audit log activities

    Show who last modified the "myNewAwesomeFeature" flag, and to what.

  • Creating User Segment

    Create a “beta users” segment with these email addresses: sarah@example.com, john@example.com. Enable the "myNewAwesomeFeature" flag for the "beta users" segment.

Conclusion

In this article, you learned how to use ConfigCat feature flags with AI agents. This can make feature flagging easier, and the AI agent can even handle quite complex tasks using natural language.
Always double-check what the AI system is doing before you accept its changes.

The MCP server can help not only with managing ConfigCat feature flags, but also with coding. A future blog post may cover that in more detail. In the meantime, here are a few docs if you want to dig deeper into the ConfigCat model context protocol:

For more on feature flags, check out ConfigCat on Facebook, X, LinkedIn, and GitHub.