LaunchDarkly MCP Integration
March 21, 2025 ยท View on GitHub
An MCP (Model Context Protocol) integration for querying LaunchDarkly feature flags and other resources.
Features
- List LaunchDarkly projects
- List environments within a project
- List and search feature flags
- Get detailed information about specific feature flags
- Check feature flag status across environments
Prerequisites
- Node.js 18+
- LaunchDarkly API access token with appropriate permissions
Project Structure
/src
/tools # Feature-specific tools
environments.ts # Environment-related tools
featureFlags.ts # Feature flag operations
index.ts # Tool registration
projects.ts # Project management tools
search.ts # Search functionality
api.ts # API request handling
config.ts # Configuration and env variables
index.ts # Main application entry
Installation
- Clone this repository
- Install dependencies:
npm install - Build the TypeScript code:
npm run build
Configuration
There are two ways to configure the API key:
-
Environment Variable:
export LD_API_KEY="api-xxxx" -
.env File:
- Copy
.env.exampleto.env - Update the values in the
.envfile
cp .env.example .env # Edit .env with your API key - Copy
Usage
Running the MCP Server
npm start
Integration with Claude Desktop
- Go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json
- Add the following configuration:
{
"mcpServers": {
"launchdarkly": {
"command": "node",
"args": [
"/path/to/ldmcp/dist/index.js"
],
"env": {
"LD_API_KEY": "api-xxxxxx"
}
}
}
}
Replace /path/to/ldmcp with the actual path to this repository and api-xxxxxx with your actual LaunchDarkly API key.
Multiple MCP Integrations Example
You can configure multiple MCP integrations in Claude Desktop:
{
"mcpServers": {
"launchdarkly": {
"command": "node",
"args": [
"/path/to/ldmcp/dist/index.js"
],
"env": {
"LD_API_KEY": "api-xxxxxx"
}
},
}
}
Integration with Cursor
Go to Cursor Settings > MCP and add a new MCP command:
node /path/to/ldmcp/dist/index.js
You'll also need to set the LD_API_KEY environment variable when launching Cursor.
Available Tools
The following tools are available through this MCP integration:
listProjects: List all projects in LaunchDarklylistEnvironments: List all environments in a specific projectlistFeatureFlags: List feature flags in a project with optional filteringgetFeatureFlag: Get detailed information about a specific feature flaggetFeatureFlagStatus: Check the status of a feature flag across environmentssearchFeatureFlags: Search for feature flags across all projects
Example Queries for Claude
Here are some example queries you can ask Claude once the MCP is connected:
- "List all the LaunchDarkly projects"
- "Show me all environments in the 'default' project"
- "List feature flags in the 'default' project"
- "Get details about the 'dark-mode' feature flag in the 'default' project"
- "Is the 'new-signup-flow' flag enabled in production?"
- "Search for all feature flags related to 'beta' features"
Development
Adding New Features
To add new LaunchDarkly API capabilities:
- Create or modify a tool module in the
/src/toolsdirectory - Register your tool in the appropriate file
- Rebuild with
npm run build
License
ISC