A Model Context Protocol (MCP) server that enables AI coding agents to interact with FeatBit feature flag management. Built with .NET 10, ASP.NET Core, and Aspire for modern cloud-native architecture.
The FeatBit MCP Server supports quick installation across multiple development environments. Choose your preferred client below:
Standard config works in most clients:
{
"servers": {
"featbit": {
"type": "http",
"url": "https://mcp.featbit.co/mcp"
}
}
}Install in VS Code or search "@mcp featbit" in Extensions, or manually add to .vscode/mcp.json:
{
"servers": {
"featbit": {
"type": "http",
"url": "https://mcp.featbit.co/mcp"
}
}
}Add to Cursor MCP settings (~/.cursor/mcp.json on macOS/Linux or %APPDATA%\.cursor\mcp.json on Windows):
{
"servers": {
"featbit": {
"url": "https://mcp.featbit.co/mcp"
}
}
}Run the following command:
claude mcp add --transport http featbit https://mcp.featbit.co/mcpRun the following command:
codex mcp add "featbit" --url "https://mcp.featbit.co/mcp"- Install the FeatBit MCP Server using one of the methods above
- You should see the FeatBit MCP Server in the list of available tools
- Try a prompt like:
- "How do I integrate FeatBit .NET SDK in my ASP.NET Core project?"
- "Show me how to deploy FeatBit to Kubernetes using Helm"
- "What's the best way to use feature flags in React?"
That's it! Your AI assistant will now have access to FeatBit documentation and integration guides.
This MCP server enables AI coding agents (like GitHub Copilot) to help developers with FeatBit feature flag management through natural language interactions. The server exposes three main MCP tools to solve these problems:
-
SDK Integration Code Generation (
generate_integration_codetool)- Generate integration code for multiple SDKs (.NET, JavaScript/TypeScript, Java, Python, Go, OpenFeature)
- Provides best practices and working examples tailored to specific use cases
- Helps developers quickly integrate FeatBit into their applications
-
Feature Flag Deployment Assistance (
how_to_deploytool)- Step-by-step deployment guides for various platforms (Kubernetes, Azure, AWS, GCP, on-premise)
- Support for different deployment methods (Helm, Docker Compose, Terraform, etc.)
- Simplifies the FeatBit deployment process across different environments
-
Documentation Search & Troubleshooting (
search_documentationtool)- Intelligent document routing using AI and RAG for quick access to relevant FeatBit documentation
- Provides troubleshooting guidance for common issues
- Helps developers find answers without leaving their coding environment
- .NET 10 SDK
- Visual Studio 2025, VS Code, or JetBrains Rider
- (Optional) FeatBit account for online mode - get one at featbit.co
-
Clone the repository
git clone https://github.com/featbit/featbit-mcp.git cd featbit-mcp -
Configure AI Provider (Azure OpenAI Only)
Edit the same file to add your Azure OpenAI configuration:
{ "AI": { "Provider": "AzureOpenAI", "AzureOpenAI": { "Endpoint": "https://your-resource.openai.azure.com/", "ApiKey": "your-azure-openai-api-key", "Deployment": "gpt-4" } } }Note: Currently, only Azure OpenAI is supported as the AI provider.
-
Configure FeatBit SDK (Optional for Online Mode)
Note: The server can run with or without FeatBit connection configured. Without FeatBit connection, it uses default values from FeatureFlag.cs for all feature flags. To enable dynamic feature flag control, configure the FeatBit connection in the Configuration section above.
cd FeatBit
dotnet run --project FeatBit.AppHostThis starts the Aspire Dashboard where you can monitor the MCP server with full observability.
cd FeatBit
dotnet run --project FeatBit.McpServerThe server will start on http://localhost:5000 (or the port specified in launchSettings.json).
The project includes pre-configured VS Code tasks:
build- Build the entire solutionbuild-apphost- Build only the AppHostbuild-mcpserver- Build only the MCP Server
Press Ctrl+Shift+P → "Tasks: Run Task" → Select a task
Use the standard configuration to connect to the hosted FeatBit MCP server:
{
"servers": {
"featbit": {
"type": "http",
"url": "https://mcp.featbit.co/mcp"
}
}
}If you're running the server locally, use:
{
"servers": {
"featbit-local": {
"type": "http",
"url": "http://localhost:5180/mcp"
}
}
}The server also exposes HTTP endpoints for testing:
# Test with curl
curl -X POST http://localhost:5000/mcp \
-H "Content-Type: application/json" \
-d '{"method":"tools/list"}'Or use the included Postman collection.
- .NET 10: Latest .NET runtime
- ASP.NET Core: Web framework for HTTP-based MCP server
- Aspire: Cloud-native orchestration and observability
- Model Context Protocol (MCP): Microsoft's MCP framework for AI agent integration
- Microsoft Extensions AI: Unified AI client abstraction
- FeatBit Server SDK: Feature flag evaluation
- OpenTelemetry: Distributed tracing, metrics, and logging
FeatBit.sln
├── FeatBit.AppHost # Aspire orchestration host
├── FeatBit.McpServer # Main MCP server application
│ ├── Controllers/ # (Future: REST controllers)
│ ├── Domain/ # Domain models
│ │ ├── Deployments/ # Deployment-related models
│ │ ├── Migrations/ # Data migrations
│ │ └── Sdks/ # SDK-specific models
│ ├── Extensions/ # Service registration extensions
│ ├── Infrastructure/ # Cross-cutting concerns
│ ├── Middleware/ # Request pipeline middleware
│ ├── Resources/ # Embedded documentation
│ │ ├── Deployments/ # Deployment guides
│ │ └── Sdks/ # SDK integration guides
│ ├── Services/ # Business logic services
│ └── Tools/ # MCP tool implementations
├── FeatBit.ServiceDefaults # Aspire service defaults
├── FeatBit.FeatureFlags # Feature flag evaluation
└── FeatBit.Contracts # Shared interfaces
The MCP server uses a gateway pattern to limit and consolidate tools exposed to AI agents:
// Single tool handles multiple SDKs and topics
[McpServerTool]
public async Task<string> GenerateIntegrationCode(string sdk, string topic)
{
// Gateway validates and routes to appropriate internal handler
return await sdkService.GetSdkDocumentationAsync(sdk, topic);
}Benefits:
- Simplified AI agent interaction (fewer tools to choose from)
- Centralized validation and routing logic
- Easier to add new SDKs without exposing new tools
Different SDK implementations registered as services:
builder.Services.AddTransient<NetServerSdk>();
builder.Services.AddTransient<JavascriptSdks>();
builder.Services.AddTransient<JavaSdks>();The SdkService acts as a context that selects the appropriate strategy based on the sdk parameter.
Custom middleware for cross-cutting concerns:
app.UseMiddleware<McpToolTracingMiddleware>(); // OpenTelemetry tracing
app.UseMiddleware<GlobalExceptionHandlerMiddleware>(); // Error handlingHeavy use of .NET's built-in DI container:
// Scoped per request
builder.Services.AddScoped<ISessionContext, SessionContext>();
builder.Services.AddScoped<IFeatureFlagEvaluator, FeatureFlagEvaluator>();
// Singleton for shared resources
builder.Services.AddSingleton<IDocumentLoader, ResourcesDocumentLoader>();
builder.Services.AddSingleton<IClaudeSkillsMarkdownParser, ClaudeSkillsMarkdownParser>();
// Transient for lightweight services
builder.Services.AddTransient<NetServerSdk>();AiChatClientFactory creates different AI chat clients based on configuration:
public IChatClient CreateChatClient(string? provider = null)
{
// Factory selects OpenAI, Azure OpenAI, or other providers
}IDocumentLoader abstracts document retrieval:
public interface IDocumentLoader
{
Task<string> LoadDocumentAsync(string path);
}Implementations:
ResourcesDocumentLoader: Loads from embedded resourcesS3DocumentLoader: Could load from AWS S3 (future)- Enables easy switching between storage backends
The server uses FeatBit's own SDK to control its behavior:
// Feature flags control SDK selection strategy
var useAiForSelection = await featureFlagEvaluator.BoolVariationAsync(
"use-ai-sdk-selection",
defaultValue: false
);This enables:
- Gradual rollout of new features
- A/B testing different AI selection strategies
- Safe experimentation in production
Document selection can use multiple strategies in sequence:
- Try exact match by filename
- If not found, use AI for semantic search
- If still not found, return default documentation
McpToolTracingMiddleware adapts the MCP request/response into OpenTelemetry spans:
public class McpToolTracingMiddleware
{
// Converts MCP tool invocations to OpenTelemetry traces
}// Separate from MCP's internal session management
builder.Services.AddScoped<ISessionContext, SessionContext>();The server maintains its own session context for feature flag user identification, independent of MCP's session handling.
Documentation is embedded in the assembly:
<EmbeddedResource Include="Resources\Deployments\*.md" />
<EmbeddedResource Include="Resources\Sdks\**\*.md" />Benefits:
- Self-contained distribution
- No external dependencies at runtime
- Versioning aligned with code
Trade-offs:
- Larger assembly size
- Documentation updates require recompilation
The server uses feature flags defined in FeatureFlag.cs with default values as fallback:
public sealed record FeatureFlag(string Key, bool DefaultValue, string Description)
{
public static readonly FeatureFlag DocNotFound = new(
Key: "doc-not-found",
DefaultValue: false,
Description: "Controls whether to return a suggestion message when no documentation is found"
);
}This enables:
- Development without connecting to FeatBit server
- Automatic fallback when FeatBit server is unavailable
- Type-safe feature flag definitions with default values
Advanced Offline Mode: For more advanced offline scenarios and bootstrap capabilities, please refer to the FeatBit .NET Server SDK documentation or contact FeatBit official support.
Full OpenTelemetry integration via Aspire:
builder.AddServiceDefaults(); // Adds OpenTelemetryTraces:
- HTTP request tracing
- MCP tool invocation tracing (via
McpToolTracingMiddleware) - AI chat client tracing (via
ChatClientOpenTelemetryMiddleware) - Feature flag evaluation tracing
Metrics:
- Request counts and durations
- Tool usage statistics
- Feature flag evaluation counts
Logs:
- Structured logging via
ILogger<T> - Correlated with traces via Activity IDs
- Stateless Design: Each request is independent, enabling horizontal scaling
- Scoped Services: Session context is scoped per request, no shared state
- Feature Flag Caching: FeatBit SDK caches flags locally, reducing network calls
- Resource Embedding: No external I/O for documentation retrieval
- API Key Management: AI provider keys stored in configuration (use Key Vault in production)
- FeatBit Secret: Environment secret for feature flag evaluation
- Input Validation: Tool parameters validated before processing
- Error Handling: Global exception handler prevents information leakage
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
See LICENSE for details.
- Documentation: FeatBit Documentation
- Issues: GitHub Issues
- Community: FeatBit Slack