Create a feature flag in your IDE in 5 minutes with the LaunchDarkly MCP server
Published May 28, 2025
This topic explains how to create, evaluate, and modify flags from within your IDE or AI client using natural language with the LaunchDarkly model-context protocol (MCP) server.
This tutorial uses the LaunchDarkly hosted MCP server, which connects your AI client to LaunchDarkly over HTTP and authenticates with OAuth. To learn more, read LaunchDarkly MCP server and LaunchDarkly hosted MCP server.
Prerequisites
To complete this tutorial, you must have the following prerequisites:
- A LaunchDarkly account. Sign up for free.
- Any AI client that supports MCP, such as Cursor. The examples in this tutorial use Cursor.
What is MCP?
Model-context protocol (MCP) is an open protocol that lets you interact with APIs using natural language.
The LaunchDarkly hosted MCP server covers multiple product areas, including feature management for managing feature flags, AgentControl for managing configs, and observability for querying logs, traces, and errors. To learn more about the available capabilities, read Available MCP tools.
Authenticating with the hosted MCP server
The hosted MCP server uses OAuth to authenticate with your LaunchDarkly account, so you don’t need to create or manage an API access token. When you connect your AI client, LaunchDarkly prompts you to authorize access in your browser, and your existing permissions apply automatically.
The hosted MCP server is not available in the LaunchDarkly federal or European Union (EU) instances. Instead, use the local MCP server, which authenticates with an API access token. To learn more, read LaunchDarkly in federal environments or LaunchDarkly in the European Union (EU).
Installing the MCP server
The quickest way to connect is the MCP server install page. Visit this page, select your AI client, and follow the prompts to authorize and connect. This tutorial uses Cursor, which you can also configure manually.
To add the hosted MCP server in Cursor:
- In Cursor, navigate to Settings > Cursor Settings > Tools & Integrations > MCP Tools.
- Click Add Custom MCP. An “Install MCP Server?” dialog appears.
- Enter the following values:
- Name:
LaunchDarkly - Type:
streamableHttp - URL:
https://mcp.launchdarkly.com/mcp/launchdarkly
- Name:
- Click Install.
- Toggle on the LaunchDarkly server, then click Connect to authorize with your LaunchDarkly account.
Alternatively, you can edit .cursor/mcp.json in your project root directly:
After you save the file, toggle on the LaunchDarkly server in Cursor and click Connect to authorize your account.
For manual configuration steps for Claude Code, Windsurf, and GitHub Copilot, or to migrate from an earlier npx-based local server, read LaunchDarkly hosted MCP server.
Creating a feature flag with MCP
Toggle Cursor’s AI pane. Try asking the agent to create a flag using the following prompt:
Model responses are non-deterministic, so your response may not exactly match the following, but it should be something like this:
Oops, we forgot to specify which LaunchDarkly project we wanted to use. Luckily the agent retains context between queries, and knows how to ask us for the info it needs. The MCP protocol is forgiving and you don’t have to get prompts perfect on the first try.
My example LaunchDarkly project is named raccoon-api-facts. 🦝 Don’t judge me. Input your own project name in the AI chat pane and hit Enter. Although these flag and project names are technically called keys when referenced in code, the LaunchDarkly MCP server can understand what we are asking for without that level of specificity. Hooray for natural language interfaces.
Click Run tool in your AI pane in Cursor to finish creating the flag. You’ll need to do this every time the AI agent attempts to interact with the LaunchDarkly API. MCP servers require explicit approval before calling external APIs as a security measure.

Next, roll over to the LaunchDarkly UI. You should read about the awesome-new-feature flag in your list. If it’s not there, double-check that you’re in the correct project.

Back in Cursor, if you click on called MCP tool you can read about the details of the request the MCP server sent to the LaunchDarkly API:

Enabling a feature flag
Ask the AI agent to check the value of the flag:
Your response should be something like this:
This matches what we see in the LaunchDarkly UI:

Let’s try to turn the flag on and see what happens!
Don’t forget to click Run tool after submitting your prompt to the agent.
You may need to reload the LaunchDarkly UI in your browser to read about the updated flag state:


Adding a flag targeting rule
What if we ask the AI agent to do something a little more complicated? Let’s create a targeting rule so that the flag is serving true for users whose email addresses end in launchdarkly.com. This could be useful if we wanted to roll out our awesome new feature to internal users first, to test for bugs.
Checking the AI agent’s work in the LaunchDarkly UI, it looks like the targeting updates were successful:

Evaluating a feature flag
Now that our targeting rule is set up, let’s try evaluating our awesome feature flag using a few different contexts.
Great. What about evaluating a context that should be false?
You can even pass in the context in natural language rather than JSON.
The LaunchDarkly API doesn’t have an endpoint for evaluating feature flags. For that, you can use one of the SDKs. When you evaluate a feature flag through the MCP server, the AI model is running the evaluation logic.
Conclusion
In this tutorial you learned how to create and manage feature flags from within your IDE, using the LaunchDarkly hosted MCP server. This can save you time and the mental energy of context switching, which will ultimately help you ship more quickly.
For more complex, multi-step workflows, you can pair the MCP server with LaunchDarkly agent skills, which guide your agent through the right sequence of tool calls.
Related content
If you enjoyed this tutorial, here’s some related reading:
