Connect AI coding assistants and autonomous agents to Flaggr using the official @flaggr/mcp-server package
Last updated September 14, 2026
Model Context Protocol (MCP) Server
The Flaggr MCP Server (@flaggr/mcp-server) connects AI coding assistants—such as Claude Desktop, Cursor, VS Code Copilot, and Antigravity—directly to your Flaggr instance.
With the MCP server, AI assistants can:
- List, create, update, evaluate, and toggle feature flags
- Inspect post-toggle safety, health, and error rate drift
- Profile distributed traces and detect server-side latency hotspots
- Measure true SSE real-time stream propagation latency (RTT)
- Inspect granular audit logs with path-scoped diffs
- Execute staged canary rollouts and A/B test experiments
Installation & Setup
1. Claude Desktop
Add @flaggr/mcp-server to your claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"flaggr": {
"command": "npx",
"args": ["-y", "@flaggr/mcp-server"],
"env": {
"FLAGGR_API_URL": "https://flaggr.dev",
"FLAGGR_API_TOKEN": "fgr_your_token_here"
}
}
}
}Tip: If you have already authenticated using the Flaggr CLI (
flaggr login), the MCP server will automatically discover your credentials from~/.flaggr/config.json. You can omitFLAGGR_API_TOKEN.
2. Cursor IDE
Add to your project's .cursor/mcp.json or Global Cursor Settings:
{
"mcpServers": {
"flaggr": {
"command": "npx",
"args": ["-y", "@flaggr/mcp-server"],
"env": {
"FLAGGR_API_URL": "https://flaggr.dev",
"FLAGGR_API_TOKEN": "fgr_your_token_here"
}
}
}
}Authentication Methods
The Flaggr MCP server supports three authentication methods:
- Auto-Discovery via Flaggr CLI:
Reads
~/.flaggr/config.jsonminted byflaggr login. Zero configuration required. - Interactive OAuth via
loginTool: Prompt the agent: "Log in to Flaggr". The agent calls thelogintool, opening your browser to authorize and select a project. - Direct Environment Variable:
Set
FLAGGR_API_TOKENin your MCP configuration.
Tool Catalog
The MCP server exposes 30+ tools organized into functional domains:
Feature Flag Operations
| Tool | Parameters | Description |
|---|---|---|
list_flags | projectId, serviceId?, environment? | List all flags with current states |
get_flag | key, serviceId, environment | Retrieve complete flag configuration |
create_flag | key, name, type, defaultValue, projectId, serviceId, ... | Create a new boolean, string, number, or object flag |
update_flag | key, serviceId, environment, name?, description?, ... | Modify flag properties, descriptions, and default values |
toggle_flag | key, serviceId, environment?, enabled? | Toggle flag or set explicit boolean state |
delete_flag | key, serviceId, environment | Permanently delete a feature flag |
evaluate_flag | flagKey, serviceId?, environment?, context? | Evaluate flag with targeting context and reason |
check_and_rollback_flag | flagKey, serviceId, environment?, dryRun?, maxErrorRateDelta? | Evaluates drift safety and triggers automated rollback if degraded |
get_stale_flags | projectId | Discovers stale, inactive, and launch-ready flags with technical debt scoring and code cleanup advice |
Post-Toggle Safety & Analytics
| Tool | Parameters | Description |
|---|---|---|
get_flag_toggle_impact | flagKey, serviceId, environment?, range?, windowMinutes? | Evaluates pre- vs post-toggle error rates, P99 latency shifts, volume ratio, and returns an automated health badge (healthy, warning, degraded) with rollback advice |
get_flag_metrics | flagKey, serviceId, environment?, range? | Detailed volume, realtime evals/sec, percentiles, breakdowns, and time series |
get_sdk_analytics | serviceId?, environment?, flagKey?, range? | Retrieves client-side SDK analytics: evaluation summaries, Core Web Vitals (LCP, CLS, FCP) correlated to active flags, client error rates, and SDK diagnostics |
get_evaluation_heatmap | projectId, range?, serviceId?, environment? | Grid of evaluation activity across all flag x service cells |
get_project_health | projectId | Aggregated platform health score and active issues |
Distributed Tracing & Hotspot Detection
| Tool | Parameters | Description |
|---|---|---|
get_trace | traceId | Renders an ASCII flamechart waterfall for an OpenTelemetry trace with hotspot analysis |
get_flag_traces | flagKey?, serviceId?, environment?, limit? | Queries recent evaluation traces for bottlenecks |
trace_flag_evaluation | flagKey, serviceId?, context? | Evaluates flag on-demand, captures full trace, and returns flamechart |
Real-Time Streaming & RTT
| Tool | Parameters | Description |
|---|---|---|
measure_round_trip | key, serviceId, environment?, enabled? | Connects to SSE stream, mutates flag, and measures millisecond propagation time |
watch_flag_updates | serviceId, environment?, flagKey?, durationSeconds? | Listens to live Server-Sent Events updates |
Audit & Revision History
| Tool | Parameters | Description |
|---|---|---|
get_audit_log | projectId, limit?, cursor?, action?, search? | Query audit log with path-scoped diffs (e.g. targeting[0].percentage: 50 -> 75) |
get_flag_history | flagKey, serviceId, environment?, limit? | Version history and per-version deep diffs |
Progressive Canary Delivery & Rollouts
| Tool | Parameters | Description |
|---|---|---|
start_canary_rollout | flagKey, serviceId, environment?, initialRolloutPercent?, targetRolloutPercent?, rampStepPercent?, soakPeriodMinutes?, errorRateGateDelta?, latencyGateDeltaMs?, autoRollbackOnBreach? | Start an automated progressive canary rollout (e.g. 5% -> 25% -> 50% -> 100%) with metric health gates |
get_canary_status | flagKey, serviceId, environment? | Query current canary pipeline status, stage progress, soak time remaining, and real-time metric health assessment |
advance_canary_stage | flagKey, serviceId, environment?, force? | Advance a canary rollout to its next progressive stage after verifying metric health gates |
abort_canary_rollout | flagKey, serviceId, environment?, reason? | Immediately abort a canary rollout and automatically revert the flag to its pre-canary baseline snapshot |
Targeting Rule Explanation & Blast-Radius Simulator
| Tool | Parameters | Description |
|---|---|---|
explain_flag_evaluation | flagKey, serviceId, environment?, context?, defaultValue? | Step-by-step diagnostic evaluation debugger explaining clause-by-clause why a user context resolved to a specific variant |
simulate_flag_targeting | flagKey, serviceId, environment?, candidateFlag?, cohortSize?, cohortAttributes? | Counterfactual blast-radius simulation comparing current baseline flag vs proposed candidate flag across synthetic user cohorts |
Adaptive Multi-Armed Bandits & Experimentation
| Tool | Parameters | Description |
|---|---|---|
list_bandit_experiments | projectId?, serviceId?, flagKey?, environment? | List active Multi-Armed Bandit experiments |
create_bandit_experiment | name, projectId, serviceId, flagKey, algorithm?, epsilon?, minExplorationFloor?, confidenceThreshold?, autoRolloutWinner? | Initialize Bayesian Thompson Sampling or Epsilon-Greedy bandit on a feature flag |
get_bandit_status | experimentId | Get real-time conversion rates, Beta prior parameters, and posterior win probabilities |
reallocate_bandit_traffic | experimentId | Dynamically rebalance feature flag variant weights and auto-rollout winner if confident |
record_bandit_reward | experimentId, variantName, converted? | Ingest evaluation trial and conversion reward for a bandit variant |
Reusable Customer Cohorts & Dynamic Segments
| Tool | Parameters | Description |
|---|---|---|
list_cohorts | projectId | List reusable customer cohorts and dynamic audience segments in a project |
get_cohort | projectId, cohortId | Get cohort definition, audience rules, and static member count by ID |
create_cohort | projectId, name, type, description?, rules?, members? | Create a new reusable customer cohort (static list or rule-based dynamic predicate) |
evaluate_cohort_membership | projectId, cohortId, userId, context? | Test whether a user targeting key and evaluation context match an audience cohort |
MCP Resources
Agents can read context directly via dynamic resource URIs:
flaggr://auth/status— Active token preview, current project, and connection statusflaggr://projects— List of all accessible projectsflaggr://project/{slug}/flags— Feature flags in a projectflaggr://flag/{key}/health— Flag health statusflaggr://flag/{key}/toggle-impact— Post-toggle safety and drift analysis
MCP Prompts
The server provides pre-packaged prompt templates for complex flag management tasks:
verify_toggle_safety
Prompts the agent to inspect the safety of a recent flag toggle:
Verify post-toggle safety for flag "checkout-v2" in service "web-app".The agent calls get_flag_toggle_impact, analyzes before/after error rates and P99 latencies, and proposes rolling back if health is degraded.
gradual_rollout
Guides an agent through a staged percentage rollout (5% → 25% → 50% → 100%), verifying health metrics at each step before advancing.
ab_test_setup
Designs an experiment with treatment and control variants, sets traffic allocation, and configures outcome metrics.
Autonomous Agent Workflow Examples
Example: Verifying a Production Flag Toggle
Ask your assistant:
"Check if toggling
new-payment-enginein production was safe or if there was any error drift."
The assistant invokes:
{
"tool": "get_flag_toggle_impact",
"arguments": {
"flagKey": "new-payment-engine",
"serviceId": "checkout-service",
"environment": "production"
}
}The MCP server responds with:
============================================================
FLAG TOGGLE IMPACT REPORT: new-payment-engine
============================================================
Status: [HEALTHY]
Latest Toggle Event:
- Transition: false -> true
- Actor: lead-dev@flaggr.dev
- Timestamp: 2026-09-12T08:00:00.000Z
- Propagation Latency: 38ms
Before vs After Comparison (±30m window):
┌──────────────────────┬─────────────┬─────────────┬────────────────┐
│ Metric │ Before │ After │ Delta / Ratio │
├──────────────────────┼─────────────┼─────────────┼────────────────┤
│ Evaluations │ 2450 │ 2480 │ 1.01x │
│ Errors │ 1 │ 1 │ +0 │
│ Error Rate │ 0.04% │ 0.04% │ +0.00% │
│ Avg Latency │ 1.35ms │ 1.34ms │ - │
│ P99 Latency │ 3.80ms │ 3.75ms │ -0.05ms │
└──────────────────────┴─────────────┴─────────────┴────────────────┘
Automated Recommendation:
Healthy: Post-toggle metrics are stable with no significant error or latency regression.
============================================================The assistant summarizes the findings and confirms the deployment is stable.
Next Steps
- REST API Reference — Core Flaggr REST endpoints
- Flag Health Guide — Post-toggle safety and drift diagnostics
- OpenFeature SDKs — Evaluate flags in your application code