Getting startedGet started

LaunchDarkly MCP server

Overview

This topic describes how to get started with the LaunchDarkly Model Context Protocol (MCP) server.

Model-context protocol (MCP) is an open protocol that lets you interact with REST APIs using natural language. The LaunchDarkly MCP server lets you set up and manage feature flags and AI Configs from within your integrated development environment (IDE) or AI client. The REST APIs exposed by the MCP server are called MCP tools.

Get started

To get started, you need an API access token with permission to execute any of the MCP tools available. Then, you need to add the MCP server definition to your AI client.

You also need a JavaScript runtime that support ECMAScript 2020 or newer.

Authentication

First, create an API access token:

  1. Click the gear icon in the left sidenav to view Organization settings.

  2. Click Authorization.

  3. In the “Access tokens” section, click Create token.

  4. Give your token a human-readable Name.

  5. Assign a Role to the token by choosing one from the menu.

    • The LaunchDarkly MCP server provides tools for managing flags and AI Configs, so your token should have permission to create, read, update, and delete flags and AI Configs in the projects you want to work in. You could use a token with a Writer base role, a LaunchDarkly Developer preset role, or another role that provides this access.
  6. Click Save token. The new token appears in the Authorization page.

  7. Copy and save the token somewhere secure. After you leave this page, the token is obscured.

To learn more, read Creating API access tokens.

Installation

You can install the LaunchDarkly MCP server in any AI client that supports the MCP protocol. For most AI clients, this means creating or updating an MCP server .json configuration file. Refer to your client’s instructions for where this configuration is located.

Here’s how:

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}

Replace api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with your API access token.

Run the MCP server from a local build

Optionally, you can run LaunchDarkly’s MCP server from a local build, instead of from your AI client.

First, install and build the MCP server:

Install LaunchDarkly's MCP server locally
$git clone git@github.com:launchdarkly/mcp-server.git
>
>npm install
>npm run build

Then, configure your server definition to reference your local clone. For example:

Configure MCP server definition
1{
2 "mcpServers": {
3 "LaunchDarkly": {
4 "command": "node",
5 "args": [
6 "/path/to/mcp-server/bin/mcp-server.js", "start",
7 "--api-key", "api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
8 ]
9 }
10 }
11}

Interaction

After you install the LaunchDarkly MCP server in your AI client, you can prompt your agent to create or manage your flags and AI Configs. Typically you need to click Run tool or similar in your AI client to execute the result.

For examples of prompts and responses, read the tutorial Create a feature flag in your IDE in 5 minutes with LaunchDarkly’s MCP server.

Review available MCP tools

The LaunchDarkly MCP server provides the following MCP tools, which correspond to the linked REST API endpoints:

Restrict usage

You can specify additional options in your server configuration if you want to restrict the MCP server’s access to your LaunchDarkly account.

To give the MCP server only read-only access, we recommend using both of the following options:

  • When you create your API access token, specify a Reader base role, or another role with read-only access.
  • In your server configuration, add "--scope", "read" to the args array.

To enable only specific tools, in your server configuration, add "--tool", "<tool>" to the args array for each tool you want to enable. For example:

Enable only specific MCP tools
1{
2 "mcpServers": {
3 "LaunchDarkly": {
4 "command": "npx",
5 "args": [
6 "-y", "--package", "@launchdarkly/mcp-server", "--", "mcp", "start",
7 "--tool", "create-feature-flag", "--tool", "update-feature-flag",
8 "--api-key", "api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
9 ]
10 }
11 }
12}

You can find the tools provided by the LaunchDarkly MCP server by reviewing the “Tools” list in your IDE:

A list of tools provided by the LaunchDarkly MCP server.

A list of tools provided by the LaunchDarkly MCP server.

Additional resources

For additional information on the LaunchDarkly MCP server, or to file issues for our team, visit the LaunchDarkly MCP server GitHub repository.