Configure the MCP server
Configure the hosted MCP server so you can manage feature flags and AgentControl configs, and view observability data, directly from your AI client. The hosted MCP server is available at https://mcp.launchdarkly.com/mcp/launchdarkly. It connects your AI client to LaunchDarkly using OAuth, and supports feature flag management, AgentControl configs, and observability. Access tokens last two hours and your AI client refreshes them automatically, but you must authorize the connection again every 90 days. Removing you from your LaunchDarkly account ends the connection, and changes to your role apply right away.Configure using the install page
Accounts that use an AI client, such as Claude or Cursor, can connect directly through the install page. You do not need to edit a configuration file to use this method. To configure the server using the install page:- Open the install page.
- Choose your AI client.
- Follow the prompts to authorize and connect.
Configure manually
To configure your AI client manually, expand the instructions for your client below. This section includes examples for Cursor, Claude Code, Windsurf, and GitHub Copilot.Expand Cursor installation instructions
Expand Cursor installation instructions
Cursor supports two methods to add the MCP server.To add the server through Cursor Settings:
- Navigate to Settings > Cursor Settings > Tools & Integrations > MCP Tools in Cursor.
- 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.
-
Create or update
.cursor/mcp.jsonin your project root with the following: - Navigate to Settings > Cursor Settings > Tools & Integrations > MCP Tools.
- Toggle on the LaunchDarkly server.
- Click Connect to authorize with your LaunchDarkly account.
Expand Claude Code installation instructions
Expand Claude Code installation instructions
To manually configure the MCP server in Claude Code:
-
Add the server to your Claude Code MCP configuration with the following:
Expand Windsurf installation instructions
Expand Windsurf installation instructions
To manually configure the MCP server in Windsurf:
- Open Windsurf Settings and navigate to Cascade.
-
Click View raw config. This opens
mcp_config.json. You can also open this file directly:- macOS:
~/.codeium/windsurf/mcp_config.json - Windows:
%USERPROFILE%\.codeium\windsurf\mcp_config.json
- macOS:
-
Add the LaunchDarkly server to the
mcpServersobject with the following: - Save the file and restart Windsurf.
Expand GitHub Copilot installation instructions
Expand GitHub Copilot installation instructions
To manually configure the MCP server with GitHub Copilot, add the server to the MCP configuration for a target GitHub repo:
- Navigate to a target repository on GitHub.
- Select Settings > Code and automation > Copilot > Coding agent.
-
Navigate to the “MCP configuration” section and add the following JSON configuration:
- Click Save.
Data sharing and prompt injection
When your AI client calls an MCP tool, the client sends the tool’s result to the AI model it uses. This means the LaunchDarkly data that MCP tools return leaves LaunchDarkly and goes to your AI model provider. LaunchDarkly doesn’t control your AI client or your model provider.Data that can leave LaunchDarkly
Depending on which tools your AI client calls, the data sent to your model provider can include:- Flag, segment, and AgentControl config details, such as names, descriptions, targeting rules, and variations.
- Change history and approval requests, including their descriptions.
- Contexts and their attributes, which can include personal data about your end users.
- Observability data, such as logs, traces, errors, and session details.
- The names and email addresses of members in your LaunchDarkly account.
- Server-side SDK keys, if your AI client calls the tool that returns them.
Prompt injection
Some of the data that MCP tools return is written by people other than you. Members of your account write flag descriptions, segment names, and approval request descriptions. Your applications and your end users produce logs, errors, session details, and context attributes. The model reads this content as part of the tool result, and it might follow instructions hidden in that content. This is called prompt injection. This means that anyone who can write data that MCP tools return can try to give instructions to the model that you connect. The model acts with the access you authorized. Here is an example of a flag description that contains an injected instruction:Reduce the risk
To reduce the risk of data sharing:- Connect as a member whose role grants only the access your work needs. The MCP server acts with the permissions of the member who authorized it. For example, if you only need to read flags, connect as a member with a Reader base role.
- Keep connections short-lived. Disconnect the MCP server in your AI client when you finish your work. When you no longer need it, revoke its access in LaunchDarkly. To learn how to revoke access, read Disconnect an OAuth app.
- Review tool calls before your AI client runs them, especially calls that change or delete data. Don’t set your AI client to approve these calls automatically.
The
toolsets and writes URL parameters do not limit accessYou can add toolsets and writes parameters to the MCP server URL to narrow which tools your AI client sees. These parameters don’t limit what the connection can do in your account, because your AI client chooses them and can connect again with different values. To limit access, use the role of the member who authorizes the connection.Migrate to the hosted server
Migrate to the hosted server if you used an earlier version of the localnpx-based server. Here’s how:
-
Replace your existing server configuration. Here is an example of a configuration to remove:
Here is an example of a configuration to add:Remove any hardcoded API keys or environment variables used by the local server, such as the
--api-keyargument orLD_ACCESS_TOKEN. OAuth now handles authentication instead. - Close and reopen your AI client.
- Disconnect and reconnect the server to restart the OAuth flow.
- For Cursor, navigate to Settings > Cursor Settings > Tools & Integrations > MCP Tools, then click Connect. Claude Code, Windsurf, and GitHub Copilot do not require any additional action.
Resolve a 403 error after OAuth
A 403 error after completing the OAuth consent screen often results from a permissions issue with the account you used, not an OAuth failure. To resolve a 403 error:- Confirm that the account you authorized has sufficient permissions. The MCP server needs permission to create, read, update, and delete flags and AgentControl configs in the projects you want to use. We recommend a Writer base role, a LaunchDarkly Developer preset role, or another role that provides this access.
- For accounts with custom role creation, confirm your custom role includes access to the project and environment you want to use through MCP tools.
- Disconnect and reconnect the server to restart the OAuth flow.
- For Cursor, navigate to Settings > Cursor Settings > Tools & Integrations > MCP Tools, then click Connect. Claude Code, Windsurf, and GitHub Copilot do not require any additional action.