Skip to content

Commit 2765904

Browse files
docs: add MCP (Model Context Protocol) documentation
Signed-off-by: Jonathan Norris <[email protected]>
1 parent cbdc961 commit 2765904

File tree

1 file changed

+368
-1
lines changed
  • docs/reference/other-technologies

1 file changed

+368
-1
lines changed
Lines changed: 368 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,376 @@
11
---
22
title: MCP
33
sidebar_label: MCP
4+
sidebar_position: 3
5+
id: mcp
46
---
57

68
# Model Context Protocol (MCP)
79

8-
Content coming soon.
10+
The **OpenFeature Model Context Protocol (MCP) Server** enables AI coding assistants to interact with OpenFeature through a standardized protocol. It provides SDK installation guidance and feature flag evaluation capabilities directly within your AI-powered development environment.
911

12+
:::info Active Development
13+
This project is in active development. Features and APIs may change.
14+
:::
15+
16+
## Overview
17+
18+
The OpenFeature MCP Server is a local tool that connects AI coding assistants (like Cursor, Claude Desktop, VS Code Continue, and Windsurf) to OpenFeature functionality. It acts as a bridge between your AI assistant and OpenFeature capabilities, enabling intelligent code generation, SDK installation guidance, and feature flag evaluation—all through natural language interactions.
19+
20+
### Key Benefits
21+
22+
- **AI-Assisted Development**: Get contextual OpenFeature SDK installation instructions directly in your coding environment
23+
- **Intelligent Code Generation**: AI assistants can generate OpenFeature integration code with proper provider setup
24+
- **Feature Flag Evaluation**: Evaluate feature flags via OFREP without leaving your development workflow
25+
- **Multi-Language Support**: Works with OpenFeature SDKs across multiple languages and frameworks
26+
- **Standardized Integration**: Uses the Model Context Protocol for consistent AI assistant integration
27+
28+
## What is MCP?
29+
30+
MCP (Model Context Protocol) is a standardized protocol that enables AI assistants to access external tools and data sources. The OpenFeature MCP Server implements this protocol to provide:
31+
32+
1. **SDK Installation Prompts**: Contextual guidance for installing and configuring OpenFeature SDKs
33+
2. **OFREP Integration**: Remote flag evaluation capabilities through the OpenFeature Remote Evaluation Protocol
34+
3. **Provider Documentation**: Installation instructions for popular feature flag providers
35+
36+
### How It Works
37+
38+
```mermaid
39+
graph LR
40+
A[AI Assistant] --> B[MCP Server]
41+
B --> C[SDK Installation Guides]
42+
B --> D[OFREP Flag Evaluation]
43+
D --> E[Flag Management System]
44+
```
45+
46+
1. Your AI assistant connects to the OpenFeature MCP Server via stdio
47+
2. When you ask about OpenFeature, the AI uses MCP tools to fetch relevant information
48+
3. For flag evaluation, the server connects to your flag management system via OFREP
49+
4. The AI assistant provides intelligent responses with accurate, up-to-date information
50+
51+
## Installation
52+
53+
### Quick Start
54+
55+
The easiest way to use the OpenFeature MCP Server is through NPX, which requires no installation:
56+
57+
```json
58+
{
59+
"mcpServers": {
60+
"OpenFeature": {
61+
"command": "npx",
62+
"args": ["-y", "@openfeature/mcp"]
63+
}
64+
}
65+
}
66+
```
67+
68+
### Global Installation
69+
70+
For faster startup times, you can install the MCP server globally:
71+
72+
```bash
73+
npm install -g @openfeature/mcp
74+
```
75+
76+
Then configure your AI assistant to use the global installation:
77+
78+
```json
79+
{
80+
"mcpServers": {
81+
"OpenFeature": {
82+
"command": "openfeature-mcp"
83+
}
84+
}
85+
}
86+
```
87+
88+
## Configuration
89+
90+
### AI Assistant Setup
91+
92+
#### Cursor
93+
94+
Add to `~/.cursor/mcp_settings.json`:
95+
96+
```json
97+
{
98+
"mcpServers": {
99+
"OpenFeature": {
100+
"command": "npx",
101+
"args": ["-y", "@openfeature/mcp"]
102+
}
103+
}
104+
}
105+
```
106+
107+
#### VS Code (Continue)
108+
109+
Add to `.continue/config.json`:
110+
111+
```json
112+
{
113+
"mcpServers": {
114+
"OpenFeature": {
115+
"command": "npx",
116+
"args": ["-y", "@openfeature/mcp"]
117+
}
118+
}
119+
}
120+
```
121+
122+
#### Claude Code (CLI)
123+
124+
Add the server via CLI:
125+
126+
```bash
127+
claude mcp add --transport stdio openfeature npx -y @openfeature/mcp
128+
```
129+
130+
Then manage the connection with `/mcp` in the CLI.
131+
132+
#### Windsurf
133+
134+
In the "Manage MCP servers" raw config, add:
135+
136+
```json
137+
{
138+
"mcpServers": {
139+
"OpenFeature": {
140+
"command": "npx",
141+
"args": ["-y", "@openfeature/mcp"]
142+
}
143+
}
144+
}
145+
```
146+
147+
#### Claude Desktop
148+
149+
Edit your Claude Desktop config at:
150+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
151+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
152+
153+
Add the following configuration:
154+
155+
```json
156+
{
157+
"mcpServers": {
158+
"openfeature": {
159+
"command": "npx",
160+
"args": ["-y", "@openfeature/mcp"]
161+
}
162+
}
163+
}
164+
```
165+
166+
Restart Claude Desktop after saving.
167+
168+
### OFREP Configuration
169+
170+
To use OFREP flag evaluation features, configure authentication and endpoint details. The server checks configuration in this priority order:
171+
172+
1. **Environment Variables**
173+
- `OPENFEATURE_OFREP_BASE_URL` or `OFREP_BASE_URL`
174+
- `OPENFEATURE_OFREP_BEARER_TOKEN` or `OFREP_BEARER_TOKEN`
175+
- `OPENFEATURE_OFREP_API_KEY` or `OFREP_API_KEY`
176+
177+
2. **Configuration File**: `~/.openfeature-mcp.json`
178+
179+
```json
180+
{
181+
"OFREP": {
182+
"baseUrl": "https://flags.example.com",
183+
"bearerToken": "<your-token>",
184+
"apiKey": "<your-api-key>"
185+
}
186+
}
187+
```
188+
189+
You can override the config file path using the `OPENFEATURE_MCP_CONFIG_PATH` environment variable.
190+
191+
## Available Tools
192+
193+
The OpenFeature MCP Server provides two main tools accessible to AI assistants:
194+
195+
### 1. SDK Installation Guide
196+
197+
**Tool Name**: `install_openfeature_sdk`
198+
199+
Fetches comprehensive installation instructions for OpenFeature SDKs in various languages and frameworks. Optionally includes provider-specific setup guidance.
200+
201+
#### Parameters
202+
203+
| Parameter | Type | Required | Description |
204+
|-----------|------|----------|-------------|
205+
| `technology` | string | Yes | Target language/framework (see supported list below) |
206+
| `providers` | string[] | No | Provider identifiers to include installation instructions |
207+
208+
#### Supported Technologies
209+
210+
- `android` - Android SDK
211+
- `dotnet` - .NET SDK
212+
- `go` - Go SDK
213+
- `ios` - iOS/Swift SDK
214+
- `java` - Java SDK
215+
- `javascript` - JavaScript SDK
216+
- `nestjs` - NestJS SDK
217+
- `nodejs` - Node.js SDK
218+
- `php` - PHP SDK
219+
- `python` - Python SDK
220+
- `react` - React SDK
221+
- `ruby` - Ruby SDK
222+
223+
#### Supported Providers
224+
225+
The provider list is automatically sourced from the OpenFeature ecosystem. Popular providers include:
226+
227+
- `flagd` - OpenFeature reference implementation
228+
- `launchdarkly` - LaunchDarkly provider
229+
- `split` - Split.io provider
230+
- `cloudbees` - CloudBees Feature Management
231+
- `configcat` - ConfigCat provider
232+
- And many more in the [OpenFeature ecosystem](/ecosystem)
233+
234+
#### Example Usage
235+
236+
When interacting with your AI assistant:
237+
238+
> "How do I install the OpenFeature SDK for Node.js with the flagd provider?"
239+
240+
The AI will use this tool to fetch relevant installation instructions and provide you with step-by-step guidance.
241+
242+
### 2. OFREP Flag Evaluation
243+
244+
**Tool Name**: `ofrep_flag_eval`
245+
246+
Evaluate feature flags using the OpenFeature Remote Evaluation Protocol. Supports both single flag and bulk evaluation.
247+
248+
#### Parameters
249+
250+
| Parameter | Type | Required | Description |
251+
|-----------|------|----------|-------------|
252+
| `base_url` | string | No | Base URL of your OFREP-compatible flag service |
253+
| `flag_key` | string | No | Flag key for single evaluation (omit for bulk) |
254+
| `context` | object | No | Evaluation context (e.g., `{ targetingKey: "user-123" }`) |
255+
| `etag` | string | No | ETag for bulk evaluation caching |
256+
| `auth` | object | No | Authentication configuration |
257+
| `auth.bearer_token` | string | No | Bearer token for authorization |
258+
| `auth.api_key` | string | No | API key for authorization |
259+
260+
#### API Endpoints
261+
262+
**Single Flag Evaluation**:
263+
```
264+
POST /ofrep/v1/evaluate/flags/{flagKey}
265+
```
266+
267+
**Bulk Evaluation**:
268+
```
269+
POST /ofrep/v1/evaluate/flags
270+
```
271+
272+
#### Example Usage
273+
274+
When interacting with your AI assistant:
275+
276+
> "Can you check the value of the 'new-checkout-flow' feature flag for user-123?"
277+
278+
The AI will use this tool to evaluate the flag and provide you with the result, along with additional metadata like variant and reason.
279+
280+
For more information about OFREP, see the [OFREP documentation](/docs/reference/other-technologies/ofrep).
281+
282+
## Examples
283+
284+
### Getting SDK Installation Help
285+
286+
```
287+
You: How do I get started with OpenFeature in a React application?
288+
289+
AI: Let me help you install the OpenFeature React SDK...
290+
[The AI fetches installation instructions using the MCP server]
291+
292+
Here's how to get started:
293+
294+
1. Install the package:
295+
npm install @openfeature/react-sdk
296+
297+
2. Import and configure...
298+
```
299+
300+
### Evaluating Feature Flags
301+
302+
```
303+
You: What's the current value of the 'dark-mode' flag?
304+
305+
AI: Let me check the current flag value...
306+
[The AI evaluates the flag using OFREP through the MCP server]
307+
308+
The 'dark-mode' flag is currently:
309+
- Value: true
310+
- Variant: on
311+
- Reason: TARGETING_MATCH
312+
```
313+
314+
### Multi-Provider Setup
315+
316+
```
317+
You: Show me how to set up OpenFeature with LaunchDarkly in TypeScript
318+
319+
AI: Here's how to integrate OpenFeature with LaunchDarkly...
320+
[The AI fetches both OpenFeature and LaunchDarkly provider setup]
321+
322+
First, install the dependencies:
323+
npm install @openfeature/server-sdk @launchdarkly/openfeature-node-server
324+
325+
Then configure the provider...
326+
```
327+
328+
## Use Cases
329+
330+
### 1. Learning OpenFeature
331+
332+
AI assistants can provide contextual, accurate guidance when learning OpenFeature:
333+
- SDK installation steps
334+
- Provider configuration examples
335+
- Best practices for your specific language/framework
336+
337+
### 2. Rapid Prototyping
338+
339+
Quickly scaffold OpenFeature integrations:
340+
- Generate boilerplate code
341+
- Set up provider connections
342+
- Implement evaluation patterns
343+
344+
### 3. Feature Flag Debugging
345+
346+
Check flag values and targeting without leaving your editor:
347+
- Evaluate flags with different contexts
348+
- Verify targeting rules
349+
- Debug flag resolution issues
350+
351+
### 4. Migration Support
352+
353+
Get guidance when migrating between providers:
354+
- Compare provider configurations
355+
- Understand provider-specific features
356+
- Generate migration code
357+
358+
## Resources
359+
360+
- **GitHub Repository**: [open-feature/mcp](https://github.com/open-feature/mcp)
361+
- **NPM Package**: [@openfeature/mcp](https://www.npmjs.com/package/@openfeature/mcp)
362+
- **MCP Registry**: [dev.openfeature/mcp](https://registry.modelcontextprotocol.io)
363+
- **OFREP Documentation**: [OpenFeature Remote Evaluation Protocol](/docs/reference/other-technologies/ofrep)
364+
- **OpenFeature CLI**: [CLI Documentation](/docs/reference/other-technologies/cli)
365+
- **CNCF Slack**: Join [#openfeature](https://cloud-native.slack.com/archives/C0344AANLA1)
366+
367+
## Get Involved
368+
369+
The OpenFeature MCP Server is an open-source project maintained by the OpenFeature community. We welcome contributions:
370+
371+
- **Report Issues**: [GitHub Issues](https://github.com/open-feature/mcp/issues)
372+
- **Contribute Code**: [Contributing Guide](https://github.com/open-feature/mcp/blob/main/CONTRIBUTING.md)
373+
- **Suggest Features**: Share ideas in the CNCF Slack [#openfeature](https://cloud-native.slack.com/archives/C0344AANLA1) channel
374+
- **Improve Documentation**: Help us improve SDK installation guides and examples
375+
376+
Join the [CNCF Slack](https://communityinviter.com/apps/cloud-native/cncf) to get involved.

0 commit comments

Comments
 (0)