Skip to main content
The Kameleoon Model Context Protocol (MCP) server connects AI coding assistants directly to your Kameleoon project. It enables agentic workflows for experiments and feature flags. Beyond reading configurations and pulling variation code, your AI assistant can build and manage experiments, feature flags, goals, segments, triggers, and targeting rules, and run the full rollout lifecycle, all from your development environment. Register and authenticate the server to automate your implementation lifecycle, from a winning variation to a gated production rollout.

Set up the server where you build

Select your AI coding assistant to get a ready-to-paste setup prompt.
Kai, Kameleoon’s in-app AI assistant, includes these same tools natively, with no separate connection step. Use the setup prompts for your AI coding assistant when you want it to act on your Kameleoon project from your IDE instead.
If you want to use these tools from Claude or ChatGPT chat (web or desktop) rather than an IDE, see Connect Kameleoon to Claude and ChatGPT.

Features

After you connect the server, your AI agent can interact with Kameleoon to:
  • Discover and inspect experiments, feature flags, goals, segments, triggers, and targeting rules.
  • Build experiments end to end: create, duplicate, edit their settings and traffic split, add variations with their own code, and run the full lifecycle (start, pause, resume, stop, delete).
  • Manage feature flags: create, duplicate, delete, toggle per environment, and review the change history.
  • Configure flag delivery: add targeted and experimentation rules, custom variations, and typed variables.
  • Create and maintain goals, audience segments, and triggers, and set an experiment’s segment and trigger.
  • Analyze experiment and feature-flag-experiment results, and pull raw variation code (JavaScript and CSS).
  • Automate the full implementation lifecycle, from a winning variation to a gated production rollout.

Create variations with their own code

Your AI assistant can set up a test with several variations, each with its own code, without direct API calls. Give the assistant the page URL and the element selectors to change, and ask it to follow these steps:
  1. Create the experiment with experiment_create, for example as a DEVELOPER experiment.
  2. Use the ID of the auto-created Variation 1 from the experiment_create response, and set its code with experiment_variation_update. Don’t add a second variation for it.
  3. Add each further variation with experiment_variation_create, passing its name and any jsCode, cssCode, customJson, or redirection it needs.
  4. To restrict who views the experiment, set its segment or trigger with targeting_rule_update. The experiment already has a targeting rule, so don’t create another one.
  5. Read back each variation’s code with experiment_code_get to confirm the code that Kameleoon stored.
Kameleoon can’t recover a variation’s previous code from the server. Copy the existing code somewhere safe before you update it.
The tools store the code you provide. They don’t generate it, so the result is only as accurate as what your AI assistant knows about the page, which includes the URL and element selectors. An assistant that can read your codebase or the live page can use that context when it writes the code. In a draft experiment, Kameleoon splits traffic evenly across the original page and all variations. With two variations, each of the three versions gets 33% of the traffic. A variation added to a running experiment starts with 0% traffic. Set its share with experiment_traffic_allocation_set while the experiment is paused or scheduled, or in the Kameleoon app while it’s running. Both variation tools check the experiment first. On an experiment that isn’t a draft, such as one that’s running, the tool returns a preview of what will change and applies it only after you confirm. For example, you can use this prompt: “On site d1alzzxd7k, create a developer experiment for https://www.example.com/pricing with two variations. Make the #buy-now button red in the first variation and green in the second.”

Edit experiments, segments, and triggers

Your AI assistant can change an existing experiment’s settings and targeting without the Kameleoon app. For example, a draft experiment needs a goal and a traffic split before it can start. The assistant can attach the goal, set the split, and point the experiment at the segment or trigger that should target it. Each experiment comes with a targeting rule. The assistant changes the segment or trigger of that rule with targeting_rule_update, so you don’t need to create a second rule. Changes that affect live traffic need your confirmation. When an experiment has left draft, or when you change the conditions of a segment or trigger that anything other than a draft experiment uses, the assistant first returns a preview of what will change. It applies the change only after you confirm. The MCP server can’t change the traffic split of a running, deviated, or stopped experiment, or of an experiment used as a personalization. Make that change in the Kameleoon app. For example, you can use this prompt: “On site d1alzzxd7k, for the draft experiment Pricing test: attach goal Purchase, split traffic 50/50 between the original and the variation, and target it to phone visitors on /pricing.” The assistant finds the experiment and the goal, attaches the goal, sets the split, creates a segment for phone visitors and a trigger for /pricing, and binds both to the experiment. The experiment is then ready to start.

The primary workflow: Winning experiment to production

The Kameleoon MCP server automates the “last mile” of implementation. transpose_winning_experiment fetches the winning (or manually selected) variation’s code and applies winner-decision logic in a single call, so your AI assistant doesn’t need to chain separate results and code-retrieval steps together. Without leaving the IDE, you can instruct your AI assistant to execute the following workflow:
  1. Run transpose_winning_experiment to get the winning variation’s code and implementation instructions.
  2. Convert the code into native, production-ready code (such as React components) aligned with the existing codebase.
  3. Create a feature flag in Kameleoon and gate the new implementation behind it.
  4. Enable and validate the feature in production.

Token usage and plan considerations

Connecting the Kameleoon MCP server to an AI assistant adds a small, fixed overhead: the tool schemas that describe the available actions. This overhead stays flat regardless of which plan the assistant runs on. The token cost of a workflow comes from the work itself, not from the connection. The following factors drive usage:
  • The amount of data a workflow retrieves, such as full experiment configurations, variation code, or activity logs.
  • The amount of code the assistant generates or converts, for example when transposing a winning variation into native app code.
  • The number of sites or brands a single workflow touches. Duplicating and auditing experiments across three sites consumes proportionally more tokens than running the same operation on one site.
  • How broadly you scope a single prompt. A narrow, single-site check consumes far less than an open-ended request to review every experiment across every site.
Before you commit a team to a specific AI assistant plan, scope your expected workflows: how many sites or brands they span, how often you run them, and whether they include large data-retrieval or code-generation steps. Recurring, multi-site workflows need a plan with a larger usage allowance or context window than a plan sized for occasional, single-site prompts. Check your AI assistant provider’s plan documentation for its specific usage limits and context window size.

Available tools

The server exposes the tools below, grouped by area. Each tool maps to a single, well-scoped action, so you can compose them into larger workflows (for example: read results, pull code, create a flag, add a rule, enable it).
For experiment_results_get, feature_flag_experiment_results_get, and transpose_winning_experiment, the goalResults array covers every goal attached to the experiment, which includes primary and secondary goals. Kameleoon computes a winner verdict for the primary goal only. Secondary goals return the same statistical figures as guardrail metrics, without a verdict.
Tools that change live traffic show a preview of what will change, and apply the change only after you confirm:
  • feature_flag_enable, feature_flag_disable, and feature_flag_delete: always.
  • feature_flag_rule_targeted_create, feature_flag_rule_progressive_create, and feature_flag_rule_experimentation_create: when the flag is already enabled in the target environment.
  • experiment_update, experiment_variation_create, experiment_variation_update, and targeting_rule_update: when the experiment isn’t a draft.
  • experiment_traffic_allocation_set: when the experiment is scheduled or paused.
  • segment_update and trigger_update: when the conditions change and anything other than a draft experiment uses the segment or trigger. Renaming never needs confirmation.
  • experiment_lifecycle_update: for stopped and deleted.
segment_delete and trigger_delete refuse to delete an item that’s in use unless you set force. You can’t change the traffic split of a running experiment through the MCP server. Change it in the Kameleoon app. If a feature flag rule tool times out or returns a gateway error, the tool may still have created the rule. Check with feature_flag_get before you retry, or the retry adds a duplicate rule.

Experiments

Build, inspect, and run A/B tests (Web Experiments).

Feature flags

Create and operate feature flags, toggle them per environment, and read their history and results.

Rules, variations, and variables

Shape how a flag delivers value to users: add delivery and experimentation rules, and define the variations and typed variables it serves.

Goals

Create and maintain the conversion goals used by experiments and flags.

Sites

Discover the projects you can access. Most other tools need a site code, so start here.

Segments

Define and inspect the audiences you target.
Segment conditions take at most two levels: groups of conditions joined by a top-level AND or OR. The tool refuses a deeper condition tree with an explanation instead of flattening it, because flattening can widen the audience. Ask your AI assistant to rewrite the tree in two levels.

Triggers

Define when a campaign fires. A trigger says when (a visitor reaches a page, an event happens, or a visit count passes a set number), and a segment says who. An experiment’s targeting rule combines one of each.
Trigger conditions accept page, visit, time, and event types, such as PAGE_URL, VISITS, TIME_RANGE, and EVENT. Visitor attributes, such as DEVICE_TYPE, GEOLOCATION, and BROWSER, belong in a segment, and triggers refuse them. You can’t edit triggers that Kameleoon creates for an experiment’s targeting rule with these tools. Use targeting_rule_update for those.

Targeting rules

Bind a segment (who sees an experiment) and a trigger (when it fires) to an experiment.

Claude Code integration

Step 1: Register the server

To register the server for your user profile (making it available in all projects), open a terminal and run the following command:
To register the server only for the current project (which adds a .mcp.json file to your repository for team sharing), run:
Verify that Claude added the server:
Expected output: kameleoon: ... - ✗ Failed to connect (A failed connection here is normal because you haven’t completed authentication yet).

Step 2: Complete OAuth authentication

In the same terminal, trigger the login flow:
  1. The command automatically opens a browser tab. If it doesn’t, copy the URL printed in the terminal and open it manually.
  2. Sign in to your Kameleoon account.
  3. Click Authorize.
  4. When the browser displays a success message, press Ctrl+C in your terminal.
Verify the connection:
Expected output: kameleoon: ... - ✓ Connected

Step 3: Start a new Claude Code session

Claude Code makes tools from newly added MCP servers available only in sessions that you start after registering the server. Close your current Claude Code chat and open a new one.

Step 4: Verify the connection

In a new Claude Code conversation, try the following prompts:
  • “List the Kameleoon feature flags.”
  • “What experiments are running on site X?”
  • “Show the status of experiment Y.”
  • “Show the code for variation 1 of experiment Z.”

Claude troubleshooting

Antigravity integration

Quick setup

Paste the following self-starter prompt directly into your Antigravity chat to connect automatically:

Manual configuration

Edit the configuration file at ~/.gemini/antigravity/mcp_config.json and add the following JSON block:

Codex integration

Quick setup

Paste the following self-starter prompt into your Codex chat:

Manual configuration

Add the following block to ~/.codex/config.toml. Create the file if it doesn’t exist:

Authenticate the connection

The Kameleoon MCP server uses OAuth. Run the following command in your terminal to start the authorization flow:
Expected behavior:
  1. The browser automatically opens a window.
  2. Click Authorize on the Kameleoon login page.
  3. Kameleoon completes the local callback on port 35535.
  4. The terminal confirms that the proxy connected successfully.
A successful connection outputs text similar to the following:

Verify tool operations

After you authenticate, run the following checks to confirm the tools work as expected:
  1. List available tools: Confirm that tools/list succeeds and returns the Kameleoon tools. Ensure the output includes the tools listed in the tools table, such as experiment_code_get, feature_flag_list, and feature_flag_create.
  2. Retrieve feature flags: Run feature_flag_list(siteCode = "d1alzzxd7k"). A successful response returns a list of feature flags for the specified site.
  3. Retrieve experiment results: Run experiment_results_get(experimentId = 149640). A successful response includes the experiment name, site code, type, and status.

Cursor integration

Cursor integrates MCP tools directly into the IDE Chat sidebar, which makes them available while you code.
  1. Open Cursor Settings (Cmd+Shift+J on macOS, Ctrl+Shift+J on Windows/Linux).
  2. Navigate to Features > MCP Servers > + Add New MCP Server.
  3. Set the Name to kameleoon.
  4. Set the Type to command.
  5. Enter the following string as the Command:
  6. Save the configuration.

Option 2: Configure via mcp.json (advanced)

Open ~/.cursor/mcp.json (create the file if it doesn’t exist) and add the following entry to the mcpServers object:
Restart Cursor after you edit the file manually.

Sample prompts for developer workflows

After you connect the Kameleoon MCP server, use prompts like the following in your IDE:
  • “List the Kameleoon MCP tools available in this session.”
  • “Show all feature flags for site code d1alzzxd7k.”
  • “Get the details for feature flag new_search on site d1alzzxd7k.”
  • “Fetch experiment results for experiment 149640 and summarize the current status.”
  • “Pull the variation code for experiment <experimentId> and variation <variationId>.”
For more advanced workflows, try the following prompts:
  • “Inspect feature flag new_search for site d1alzzxd7k and explain what environments and variations it has.”
  • “Summarize experiment 149640 for an engineer. Include status, site code, winner state, and whether any variation data is available.”
  • “List the active feature flags for site d1alzzxd7k and point out any flags that look like stale candidates.”
  • “Retrieve the code for variation <variationId> in experiment <experimentId> and explain what frontend behavior it changes.”
  • “Create a new feature flag named <name> with key <featureKey> for site d1alzzxd7k.”
  • “Turn on feature flag <featureKey> in the staging environment for site d1alzzxd7k.”
  • “Turn off feature flag <featureKey> in the production environment for site d1alzzxd7k.”

Advanced workflow: End-to-end automation

transpose_winning_experiment covers the winner check and code retrieval in one call, but converting that code and rolling it out still benefit from an explicit system prompt. The following example targets React apps and instructs the AI agent to call the tool, then finish the implementation lifecycle: converting the code, gating it behind a new feature flag, and rolling it out, all through the MCP tools. Paste the following prompt into your AI assistant:

Tool parameters reference

Use the exact tool names and parameter names returned by tools/list. The live MCP schema supports the following parameters.

Experiments

experiment_create accepts MVT and SDK_HYBRID as valid type values, but this tool can’t actually create either one. MVT always fails because the API requires mvtVariations (sections and variations) on creation, and no MCP tool exposes that field. SDK_HYBRID always fails with an “Incorrect Experiments type” error, regardless of payload. AI, CLASSIC, DEVELOPER, and PROMPT all create successfully. To create an MVT experiment, call the Automation API directly and follow the steps in Create a multivariate experiment.
The variation tools don’t support stopped, MVT, or feature-flag experiments. For feature flag variations, use feature_flag_variation_create. You can’t change the traffic split of a running experiment, or of one that uses a bandit allocation method, through the MCP server.

Feature flags

Rules, variations, and variables

Goals

Sites

Segments

Triggers

To bind a saved trigger to an experiment, call targeting_rule_update with triggerConfiguration set to SAVED_TEMPLATE and targetingConfigurationParam set to the trigger ID.

Targeting rules

Accepted enum values: experiment_lifecycle_update.status is started, resumed, paused, stopped, or deleted. Experiment type is AI, CLASSIC, DEVELOPER, MVT, PROMPT, or SDK_HYBRID. Goal type is CLICK, CUSTOM, SCROLL, PAGE_VIEWS, URL, TIME_SPENT, RETENTION_RATE, WAREHOUSE, or RATIO_METRICS. variableType is BOOLEAN, NUMBER, STRING, JSON, JS, CSS, or ENUM. trafficAllocations is a comma-separated variationKey:percentage string that sums to 100 (for example off:50,on:50). releaseDateTime is an ISO-8601 local datetime without offset (for example 2026-07-01T09:00:00) and timeZone is an IANA zone (for example Europe/Paris or UTC). trafficAllocationMethod is MANUAL (default), MULTI_ARMED_BANDIT, or CONTEXTUAL_BANDIT. frequencyUnit is MINUTES, HOURS, or DAYS. audienceBasis is VISITORS (default) or VISITS. segmentConfiguration is ALL_VISITORS, AUTOPROMO_AUTODEFINED, GRAPHICAL_PAGES, HEAT_SLICE, PAGE, SAVED_TEMPLATE, SITE, or URL, and triggerConfiguration takes the same values except ALL_VISITORS. The targetingConfigurationParam input is a saved trigger ID for SAVED_TEMPLATE, a segment ID for HEAT_SLICE, a full URL for PAGE, or a URL fragment for URL.
For environment-specific queries, pass environmentKey = "production" or environmentKey = "staging" where supported.

Prompting tips

  • Include the site code when you work with feature flags.
  • Include the experiment ID when you query experiments or experiment results.
  • Include both experimentId and variationId when you request variation code.
  • Explicitly name the target environment when you ask the agent to turn a feature flag on or off.
  • Request a plain-English summary if you want your AI agent to interpret the MCP response rather than just retrieving the raw data.

General troubleshooting

Port 35535 is already in use

If authentication fails with an EADDRINUSE error, another process already listens on the OAuth callback port.
  • Cause: A stale mcp-remote process remains active from a previous authentication attempt.
  • Fix: Stop the stale process that’s using port 35535, then rerun the OAuth command.

MCP server doesn’t appear in Codex chat

Codex might not hot-reload newly added MCP servers into an already-running thread.
  • Fix: Refresh Codex or start a new session after you update config.toml.

Browser flow doesn’t complete

If the OAuth browser window opens but authorization doesn’t finish:
  • Confirm that you clicked the Authorize button on the Kameleoon login page.
  • Check that your browser or system settings don’t block localhost callbacks.
  • Manually open the callback URL if your browser fails to launch it automatically.

A tool returns BLOCKED instead of making the change

Tools that change live traffic return a preview with the status BLOCKED until you confirm, which doesn’t mean an error.
  • Fix: Read the preview, and if the change is what you want, ask your AI assistant to repeat the call with confirm set to true. For segment_delete and trigger_delete, use force instead.

Headless or remote agents fail to authenticate

Remote or headless agents (such as cloud-hosted Codex) can’t complete the browser-based authorization step.
  • Fix: Use a desktop version of your tool instead.

npx command not found

If the command fails with a “not found” error, ensure that npx is available on your system path. Node.js versions 8.2 and later include npx by default.