Skip to content

feat(mcp): Add built-in MCP server for AI agent flag management - #761

Open
marceloboeira wants to merge 1 commit into
mainfrom
mcp
Open

feat(mcp): Add built-in MCP server for AI agent flag management#761
marceloboeira wants to merge 1 commit into
mainfrom
mcp

Conversation

@marceloboeira

Copy link
Copy Markdown
Member

Description

AI coding assistants are becoming a primary interface for developers. Adding a built-in MCP server lets agents manage flags directly without leaving the editor or hand-crafting API calls.

The server is embedded in the Flagr binary at /mcp on the same port as the REST API, using Streamable HTTP transport. Single binary, single port, no sidecars.

Disabled by default. Set FLAGR_MCP_ENABLED=true to opt in. When off the route simply doesn't exist, so no extra attack surface.

27 tools covering the full flag lifecycle: CRUD for flags, segments, variants, and constraints, plus distributions, tags, and evaluation. Built with the official Go MCP SDK. Integration tests run across the full docker-compose matrix with a disabled-mode test verifying the route is absent when the flag is off.

How Has This Been Tested?

Besides all the unit/integration tests, I tested the e2e functionality by running opencode locally and pointing to the built MCP (see images).

Input

Screenshot 2026-07-26 at 16 11 47

Result

Screenshot 2026-07-26 at 16 12 03

Created Flag

Screenshot 2026-07-26 at 16 12 35 Screenshot 2026-07-26 at 16 12 19

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mergify

mergify Bot commented Jul 26, 2026

Copy link
Copy Markdown

Queued — the merge queue status continues in this comment ↓.

AI coding assistants are becoming a primary interface for developers.
Adding a built-in MCP server lets agents manage flags directly without
leaving the editor or hand-crafting API calls.

The server is embedded in the Flagr binary at /mcp on the same port as
the REST API, using Streamable HTTP transport. Single binary, single
port, no sidecars.

Disabled by default. Set FLAGR_MCP_ENABLED=true to opt in. When off
the route simply doesn't exist, so no extra attack surface.

27 tools covering the full flag lifecycle: CRUD for flags, segments,
variants, and constraints, plus distributions, tags, and evaluation.
Built with the official Go MCP SDK. Integration tests run across the
full docker-compose matrix with a disabled-mode test verifying the
route is absent when the flag is off.
@mergify

mergify Bot commented Jul 26, 2026

Copy link
Copy Markdown

Merge Queue Status

  • Entered queue2026-07-26 20:15 UTC · Rule: default · triggered by @marceloboeira with the merge queue checkbox
  • Checks skipped · PR is already up-to-date
  • 🚫 Left the queue2026-07-26 20:15 UTC · at c1c01d43b7ba80fdc3871fa4c82b922cd3223a3d

This pull request spent 13 seconds in the queue, including 3 seconds running CI.

Required conditions to merge

Reason

Pull request #761 has been dequeued

GitHub refused to merge the pull request. At least 1 approving review is required by reviewers with write access. You're not authorized to push to this branch. Visit https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected. This is usually enforced by a branch protection or ruleset rule.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@marceloboeira

Copy link
Copy Markdown
Member Author

@zhouzhuojie do you want to take a look? in theory there is nothing breaking as it's disabled by default.

@marceloboeira marceloboeira self-assigned this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant