For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • Tutorials
    • The AI Iteration Loop for Deploying Reliable Agents with LangGraph
    • Using LaunchDarkly feature flags and Experimentation with Wordpress
    • Migrate a Hardcoded LangGraph Agent to LaunchDarkly AgentControl in 20 Minutes
    • Offline Evaluation of RAG-Grounded Answers in AgentControl
    • Beyond n8n for Workflow Automation: Agent Graphs as Your Universal Agent Harness
    • Catch your first silent AI failure with Vega AI in under 10 minutes
    • Evaluate LLM code generation with LLM-as-judge evaluators
    • OpenTelemetry for LLM Applications: A Practical Guide with LaunchDarkly and Langfuse
    • Use LaunchDarkly Agent Skills in Claude Code and Cursor
    • Detection to Resolution: Real World Debugging with Rage Clicks and Session Replay
    • Compare AI orchestrators: LangGraph vs Strands vs OpenAI Swarm
    • Building a data extraction pipeline with LaunchDarkly
    • Day 12 | 🎊 New Year, New Observability
    • Day 11 | ✉️ Letters to Santa: What engineering teams really want from Observability in 2026
    • Day 10 | Why observability and feature flags go together like milk and cookies
    • Day 9 | 👻 The Three Ghosts Haunting Your AI This Holiday Season
    • Day 7 | 🎄✨The Rockefeller tree in NYC: SLOs that actually drive decisions
    • Day 6 | 💸 The famous green character that stole your cloud budget: the cardinality problem
    • Day 5 | 🧹 Using a Popular Tidying Method to Consolidate Your Observability Stack
    • Day 4 | ❄️ Tracing the impact of holiday styling in your Node.js app
    • Day 8 | 🎁 Observable Multi-Modal Agentic Systems
    • Day 3 | 🔔 Jingle All the Way to Zero-Config Observability
    • Day 2 | 🎅 He knows if you have been bad or good... But what if he gets it wrong?
    • Collecting user feedback in your app with feature flags
    • Day 1 | 🎄 Observability Under the Tree: What Changed in 2025
    • Build a User Frustration Detection & Response System
    • When to Add Online Evals to Your AgentControl
    • Detecting User Frustration: Understanding Rage Clicks and Session Replay
    • AgentControl config CI/CD Pipeline: Automated Quality Gates and Safe Deployment
    • A Deeper Look at LaunchDarkly Architecture: More than Feature Flags
    • Add Observability to Your React Native App in 5 minutes
    • Smart AI Agent Targeting with MCP Tools
    • Build a LangGraph Multi-Agent System in 20 Minutes with LaunchDarkly AgentControl
    • Snowflake Cortex Completion API + LaunchDarkly SDK Integration
    • Using AgentControl to review database changes
    • How to implement WebSockets and kill switches in a Python application
    • 4 hacks to turbocharge your Cursor productivity
    • Create a feature flag in your IDE in 5 minutes with LaunchDarkly's MCP server
    • Observability for Your Go ORM: OpenTelemetry Integration with GORM
    • The complete guide to OpenTelemetry in Next.js
    • How to instrument your React Native app with OpenTelemetry
    • The complete guide to OpenTelemetry in Python
    • Monitoring Browser Applications with OpenTelemetry
    • How to Use OpenTelemetry to Monitor Next.js Applications
    • What is OpenTelemetry and Why Should I Care?
    • Distributed Tracing in Next.js Apps
    • Tracing Distributed Systems in Next.js
    • Real-time Monitoring in Django: Essential Tools and Techniques
    • DeepSeek vs Qwen: local model showdown featuring LaunchDarkly AgentControl
    • Application Tracing in .NET for Performance Monitoring
    • The Ultimate Guide to Ruby Logging: Best Libraries and Practices
    • Using Materialized Views in ClickHouse (vs. Postgres)
    • Filtering and Sampling LaunchDarkly Ingest
    • How to Set Up Your Production AWS MSK Kafka Cluster
    • Publishing an NPM Package with Private pnpm Monorepo Dependencies
    • How To Use The Chrome Inspector & Debugger
    • 3 Levels of Data Validation in a Full Stack Application With React
    • The power of the monorepo: Keep your fullstack app in sync!
    • Compression: The simple, powerful upgrade for your web stack
    • Video tutorials
Sign inTry it free
LogoLogo
On this page
  • Overview
  • Prerequisites
  • What is MCP?
  • Creating a LaunchDarkly API access token
  • Installing the MCP server
  • Creating a feature flag with MCP
  • Enabling a feature flag
  • Adding a flag targeting rule
  • Evaluating a feature flag
  • Additional feature flag MCP prompts
  • Conclusion
Tutorials

Create a feature flag in your IDE in 5 minutes with LaunchDarkly's MCP server

Was this page helpful?
Previous

Observability for Your Go ORM: OpenTelemetry Integration with GORM

Next
Built with

Published May 28th, 2025

Portrait of Tilde Thurium.

by Tilde Thurium

Overview

You can now create, evaluate, and modify flags from within your IDE or AI client using natural language with LaunchDarkly’s new MCP server. Follow along with this tutorial for step by step instructions.

This MCP server is currently in beta. For the most up to date instructions, read LaunchDarkly MCP server in the product documentation.

Prerequisites

In order to complete this tutorial, you must have the following prerequisites:

  • A LaunchDarkly account — sign up for a free one here.
  • The Cursor IDE installed on your local machine. Although this tutorial is Cursor-focused, our MCP server also works with any AI client that supports MCP, such as Windsurf or even Raycast.
  • A JavaScript runtime on your local machine that supports ECMAScript 2020 or newer. Functionally, this means Node.js v18 or v20, Bun v1 or newer, or Deno 1.39 and above.

What is MCP?

Model-context protocol (MCP) is an open protocol that lets you interact with APIs using natural language.

LaunchDarkly’s MCP server is powered by Speakeasy, a developer tool for generating SDKs, documentation, and agent tools.

Creating a LaunchDarkly API access token

To use the LaunchDarkly MCP server, you’ll need to create a LaunchDarkly API access token with appropriately scoped permissions.

Go to the the LaunchDarkly Authorization page. (If you’re an EU or Federal user, that link won’t work – instead, navigate to Organization settings > Authorization in the left nav menu.) Click Create token. Give the token a memorable name, such as “Tilde’s MCP server.” The Role should be Writer. Leave the service token box unchecked. The MCP server will be running on your local machine, so a personal API token is a better fit. Also, leave the API version set to the most recent version (currently 20240415).

Dialog box showing how to create an API access token in the LaunchDarkly UI.

How to create an API access token in the LaunchDarkly app UI.

After you create your API token, copy it to your clipboard. You’ll need it for the next step. After you leave the page the token will be hidden, so don’t lose it.

If you’d rather customize your permissions in a more granular fashion, you can use the Role builder. Read about custom roles or see these example policies in the docs.

Installing the MCP server

In Cursor, go to Settings > Cursor Settings > Tools & Integrations > MCP Tools > New MCP server.

Copy the example configuration, using your API token instead of the dummy key in this example.

1{
2 "mcpServers": {
3 "LaunchDarkly": {
4 "command": "npx",
5 "args": [
6 "-y", "--package", "@launchdarkly/mcp-server", "--", "mcp", "start",
7 "--api-key", "api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
8 ]
9 }
10 }
11}

If you’re using LaunchDarkly’s Federal or EU instances, you’ll need to point your server at a different host by adding a server-url argument like so. Replace <host> with your host URL.

1{
2 "mcpServers": {
3 "LaunchDarkly": {
4 "command": "npx",
5 "args": [
6 "-y", "--package", "@launchdarkly/mcp-server", "--", "mcp", "start",
7 "--api-key", "api-xxxxxxx",
8 "--server-url", "<host>"
9 ]
10 }
11 }
12}

Creating a feature flag with MCP

Toggle Cursor’s AI pane. Try asking the agent to create a flag using the following prompt:

Prompt:

create a feature flag to gate my awesome new feature

Model responses are non-deterministic, so your response may not exactly match the following, but it should be something like this:

Response:

To create a feature flag for your awesome new feature, I’ll need to know which LaunchDarkly project you want to add the flag to. Could you please provide the project key (the unique identifier for your LaunchDarkly project)? If you have a preferred flag key or description, let me know as well, or I can generate them for you!

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.

Screenshot of the Run tool button in the AI chat pane of the Cursor IDE.

The Run tool button.

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

Screenshot of a list of feature flags in the LaunchDarkly user interface. The top flag is called Awesome New Feature.

The flags list.

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

Screenshot of request parameters used to call the LaunchDarkly flag creation API within the Cursor IDE, via MCP.

Request parameters for the create flag API call.

Enabling a feature flag

Ask the AI agent to check the value of the flag:

Prompt:

what is the value of the awesome-new-feature flag?

Your response should be something like this:

Response:

The value of the awesome-new-feature flag is currently set to off (false) by default in both the production and test environments. If you want to enable it or check its value for a specific user or context, let me know!

This matches what we see in the LaunchDarkly UI:

Screenshot of flag configuration in the LaunchDarkly UI. The flag is Off, serving false to all users in the Test environment.

Flag configuration for Awesome New Feature .

Let’s try to turn the flag on and see what happens!

Prompt:

Turn the awesome new feature flag ON, serving True to all users.

Don’t forget to click Run tool after submitting your prompt to the agent.

Response:

The awesome-new-feature flag is now turned ON in both the production and test environments! Your awesome new feature is now enabled for all users in these environments.
If you want to target specific users, add rules, or need to verify the flag’s status, just let me know!

You may need to reload the LaunchDarkly UI in your browser to see the updated flag state:

Screenshot of flag configuration in the LaunchDarkly UI. The flag is On, serving true to all users in the Test environment.

Updated configuration for the Awesome New Feature flag in the Test environment.

Screenshot of flag configuration in the LaunchDarkly UI. The flag is On, serving true to all users in the Production environment.

Updated configuration for the Awesome New Feature flag in the Production environment.

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.

Prompt:

For the awesome new feature flag, update the targeting rules so the flag is only enabled and serving true for users who have email addresses ending with launchdarkly.com. Everyone else should get the false variation.

Response:

The awesome-new-feature flag is now enabled only for users whose email addresses end with launchdarkly.com in both production and test environments. For all other users, the flag will be off.
If you need to further adjust the targeting or want to verify the setup, let me know!

Checking the AI agent’s work in the LaunchDarkly UI, it looks like the targeting updates were successful:

Screenshot of flag configuration in the LaunchDarkly UI. The flag is On, serving true to users whose email addresses end in launchdarkly.com and false to everyone else.

Updated configuration for the Awesome New Feature flag, including a targeting rule.

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.

Prompt:

Evaluate the awesome new feature flag using the following context: {“name”: “tilde”, “email”: “tthurium@launchdarkly.com”}

Response:

To evaluate the awesome-new-feature flag for the context: {“name”: “tilde”, “email”: “tthurium@launchdarkly.com”}*

  • The flag is ON, but only enabled for users whose email ends with @launchdarkly.com.
  • The provided email tthurium@launchdarkly.com matches this rule.

Result: The awesome-new-feature flag will be enabled (true) for this user.
If you want to see the raw evaluation or check for a different context, let me know!

Great. What about evaluating a context that should be false?

Prompt:

evaluate the awesome new feature flag using the following context: {“name”: “tilde”, “email”: “tthurium@foo.com”}

Response:

For the context {“name”: “tilde”, “email”: “tthurium@foo.com”}:

  • The awesome-new-feature flag is ON, but only enabled for users whose email ends with “@launchdarkly.com”.
  • The email tthurium@foo.com does not match this rule.

Result: The awesome-new-feature flag will be disabled (false) for this user. If you want to check for another context or need the raw evaluation details, let me know!

You can even pass in the context in natural language rather than JSON.

Prompt:

Evaluate the value of Awesome New Feature flag with a context where the user has an email address foo@bar.com

Response:

Given the current targeting rules for the “Awesome New Feature” flag:

  • The only users who receive the true variation are those whose email ends with launchdarkly.com.
  • All other users receive the false variation. For a user with the email address foo@bar.com, the flag will evaluate to false in both the Production and Test environments.

Note that the LaunchDarkly API doesn’t have an endpoint for evaluating feature flags. For that, you’d need to use one of LaunchDarkly’s SDKs. When you evaluate a feature flag via MCP, the AI model is running the evaluation logic. Cool!

Additional feature flag MCP prompts

Most flag-related actions you can do with the LaunchDarkly REST API can now be done from the comfort of your editor. Here are some examples of additional prompts that you may find useful. Replace the placeholders with the names/keys of your actual flags and projects.

TaskPrompt
Disabling a feature flagTurn the $FEATURE_FLAG_KEY flag off.
Updating a feature flag descriptionUpdate the $FEATURE_FLAG_KEY flag description: “When enabled, show the updated UI for my awesome new feature.”
Listing all feature flags in a projectShow me all the feature flags in the $PROJECT_KEY project.
Getting a feature flag’s detailsTell me about my $FEATURE_FLAG_KEY feature flag.
Adding individual targetsAdd a new targeting rule for the $FEATURE_FLAG_KEY feature flag so that the user tthurium@launchdarkly.com receives the true variation.
Copying a feature flagCreate a new feature flag that copies the configuration of the $FEATURE_FLAG_KEY flag, but add V2 to the flag key.
Archiving a feature flagArchive the feature flag $FEATURE_FLAG_KEY.
Deleting a feature flag. (Be careful with this one — the action can’t be undone!) Delete the feature flag $FEATURE_FLAG_KEY.

Conclusion

In this tutorial you learned how to create and manage feature flags from within your IDE, using the magic of MCP. This can save you time, as well as the mental energy of context switching, which will ultimately help you ship more quickly.

Stay tuned for updates. We’re actively working on adding more functionality to our MCP server.

If you enjoyed this tutorial, here’s some related reading:

  • A list of awesome MCP servers
  • Getting started with the LaunchDarkly REST API
  • Customizing user experiences using FastAPI and LaunchDarkly segment targeting

Thanks for following along! If you have any questions, or you want to tell me about the cool stuff you’re building, you can reach me via email (tthurium@launchdarkly.com), Bluesky, Discord, or LinkedIn.