LA

LaunchDarkly MCP Server for Feature Flags

Accelerate releases with LaunchDarkly's MCP server for feature flags, enabling safe, fast feature rollout, targeting, and experimentation.

Quick Install
npx -y @launchdarkly/mcp-server

Overview

LaunchDarkly’s MCP (Model Context Protocol) server provides a bridge between AI clients that speak the MCP protocol and LaunchDarkly feature flag data. It serves flag definitions and live updates over a simple, local server interface so developer tools and LLM-based assistants can query flags, receive changes, and evaluate context without embedding LaunchDarkly SDKs directly into every client.

This server is useful for accelerating feature rollouts, running experiments, and enabling safe, contextual feature evaluations inside developer tooling (editors, chat assistants, CI agents). Running the MCP server locally or as a container gives tools a standardized stream of flag state and metadata and supports secure, auditable access via API keys.

Features

  • Exposes LaunchDarkly feature flag definitions and live updates via the MCP protocol (SSE/HTTP).
  • Starts from a single command (npx / packaged binary / Docker) and integrates with many AI clients.
  • Supports environment-based configuration and reading API keys from environment variables.
  • Works as a standalone binary for minimal runtime dependencies.
  • Can be run locally for developer workflows, in containers for CI, or as part of cloud deployments (managed with IaC like Terraform).
  • Simple configuration for popular AI clients (Cursor, Claude, GitHub Copilot CLI, Qodo Gen).

Installation / Configuration

Basic start via npx (recommended for quick setup):

npx -y --package @launchdarkly/mcp-server -- mcp start --api-key api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Cursor / Claude / Qodo / Copilot MCP configuration (example):

{
  "mcpServers": {
    "LaunchDarkly": {
      "command": "npx",
      "args": [
        "-y", "--package", "@launchdarkly/mcp-server", "--", "mcp", "start",
        "--api-key", "api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      ]
    }
  }
}

Read API key from an environment variable (secure):

{
  "mcpServers": {
    "launchdarkly": {
      "command": "npx",
      "args": [
        "-y", "--package", "@launchdarkly/mcp-server", "--", "mcp", "start",
        "--api-key", "$LD_ACCESS_TOKEN"
      ],
      "env": {
        "LD_ACCESS_TOKEN": "MCP_LD_TOKEN"
      }
    }
  }
}

Docker run (example):

docker run --rm -p 8080:8080 \
  709825985650.dkr.ecr.us-east-1.amazonaws.com/launchdarkly/mcp \
  --api-key api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Standalone binary download and run (example for macOS arm64):

curl -L -o mcp-server https://github.com/launchdarkly/mcp-server/releases/download/{tag}/mcp-server-bun-darwin-arm64
chmod +x mcp-server
./mcp-server start --api-key api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Local development from a clone:

git clone https://github.com/launchdarkly/mcp-server.git
cd mcp-server
npm install
npm run build
node ./bin/mcp-server.js start --api-key api-...

Security note: store API keys in environment variables or secrets managers and avoid committing them to source control.

Available Resources and Operations

The MCP server exposes LaunchDarkly model context useful to AI clients, typically including:

  • Feature flag definitions and metadata (keys, variations, rules).
  • Live flag state/updates via server-sent events (SSE).
  • Environment and project identifiers for scoping.
  • Subscribe/stream operations to receive incremental updates.

Clients generally subscribe to a stream endpoint and can request the current snapshot of flags and then process updates as they arrive.

Use Cases

  • Local development: Developers run the MCP server and use their editor/assistant to evaluate feature state for the current branch or environment without embedding SDKs in every tool.
  • CI / Preview environments: Spin up an MCP instance in CI to let review apps and bots evaluate flags and enforce gating rules before merge.
  • LLM-assisted feature triage: An assistant queries the MCP server to provide context-aware suggestions about flag rollout, targeted audiences, or likely impact of a change.
  • Experiment analysis: Tools can consume flag state and rollout percentages to correlate with metrics during experiments.

Concrete example — safe rollout testing:

  1. Start MCP server locally with a staging API key.
  2. Use your AI assistant connected via MCP to query whether a feature flag is enabled for a given user key.
  3. Adjust targeting rules in LaunchDarkly and observe live updates in the assistant via the MCP stream.

Managed deployments and IaC

The MCP server can be run as a container or VM and is compatible with common infrastructure-as-code workflows. If you manage environments with Terraform, include the container or VM resource and inject API keys securely from your secrets backend. The server’s simple command-line interface makes it straightforward to integrate into automation pipelines.

Troubleshooting & Best Practices

  • Ensure the API key has the appropriate LaunchDarkly permissions (read access to flags/environments).
  • If an AI client supports environment variables in MCP configs, prefer those for secrets.
  • For long-lived deployments, run the Docker/binary version and monitor logs for SSE connection errors.
  • If a client doesn’t support env variables in MCP config, use a small local wrapper script that injects secrets.

Repository: https://github.com/launchdarkly/mcp-server

For issues, feature requests, or contributions, open PRs or issues in the GitHub repo. Refer to the repo’s CONTRIBUTING.md and RUNTIMES.md for runtime support details.