Reflag MCP Server: Create and Manage Feature Flags
Create and manage feature flags on an MCP server with Reflag to control rollouts, A/B tests, and user targeting.
Overview
The Reflag MCP Server implements the Model Context Protocol (MCP) for managing feature flags, rollouts, and evaluation contexts. It is intended to be used alongside the Reflag CLI to create, update and evaluate flags locally or in a development environment. By exposing a simple HTTP/JSON evaluation API and a set of CLI commands, the MCP server lets teams prototype and test feature rollouts, A/B experiments, and user targeting without requiring a hosted feature flag service.
Using an MCP server is useful when you want a reproducible, versioned source of truth for flags and evaluation logic that integrates with local tooling and CI pipelines. It stores flag models, environments, and targeting rules, and can evaluate flags against a supplied model context (for example, a user object). The same models can be used by client SDKs or a gateway in production, so development and staging behavior matches production expectations.
Features
- Create and edit feature flags, variants and default values
- Define environments (development, staging, production) with independent rules
- Target users or groups using attributes in the model context
- Percentage rollouts and A/B testing via variant weightings or deterministic bucketing
- Local evaluation API that accepts a model context (e.g., user) and returns flag values
- Import/export of flag definitions to JSON for versioning and CI
- CLI-first workflow that integrates into scripts and pipelines
Installation / Configuration
Install the Reflag CLI (contains MCP server subcommands). You can use npm/yarn or run with npx:
# Install globally
# Or run via npx without global install
Start a local MCP server (example):
# start server on port 8080 with a local data directory
Minimal configuration file (reflag.mcp.json):
Environment variables (optional):
- REFLAG_MCP_PORT — port the server listens on (e.g., 8080)
- REFLAG_MCP_DATA_DIR — path to persist flag models and exports
Create a flag from the CLI (example):
Export/import flag definitions for version control:
# Export all flags to a JSON file
# Import flags from a JSON file
Available Resources
- GitHub repository (source and packages): https://github.com/reflagcom/javascript/tree/main/packages/cli#model-context-protocol
- CLI help: run
npx @reflag/cli mcp --helpornpx @reflag/cli mcp server --help - Model Context Protocol (MCP): use the server’s evaluation contract to send model contexts (user, session, request attributes) to the server for deterministic evaluation
Common server endpoints (illustrative):
| Endpoint | Method | Description |
|---|---|---|
| /v1/flags | GET | List flags and metadata |
| /v1/flags/:id | GET/PUT/DELETE | Read/update/delete a flag |
| /v1/evaluate | POST | Evaluate one or more flags against a model context |
Example evaluate request (POST /v1/evaluate):
Response example:
Use Cases
- Gradual rollout
- Create a boolean flag with a default of false, and add a percentage rollout rule for a small subset of