Model Context Protocol server for AB Tasty Feature Experimentation & Rollouts platform
npm install @abtasty/mcp-serverA Model Context Protocol (MCP) server that integrates AB Tasty's Feature Experimentation & Rollouts platform with AI assistants. This server provides tools for feature flag management, campaign retrieval, and guided SDK integration through the MCP protocol.
- Decision API Integration: Retrieve campaigns and feature flags for visitors
- decision_api_get_campaigns: Get all campaigns for a visitor with context
- decision_api_get_campaign: Get a specific campaign by ID for a visitor
- decision_api_get_flags: Get all feature flags for a visitor
- decision_api_activate_campaign: Activate a campaign for a visitor
- Resource Loader API: Extract and analyze campaign configurations (v0.2.0+)
- resource_loader_api_load_webexp_resources: Load Web Experimentation & Personalization resources (use with we_resource_extractor prompt)
- resource_loader_api_load_featexp_resources: Load Feature Experimentation & Rollout resources (use with fear_resource_extractor prompt)
- _Note: In v0.2.0, the Resource Loader API was split into platform-specific tools for better clarity_
- Quick Start Guides: Interactive prompts for AB Tasty SDK installation
- Node.js SDK installation guide
- Resource Extractors: AI-powered resource configuration generators
- we_resource_extractor: Converts natural language campaign briefs into Web Experimentation resource configurations
- fear_resource_extractor: Converts natural language campaign briefs into Feature Experimentation resource configurations
- These prompts generate the JSON needed for the Resource Loader API tools
- Documentation: Access to AB Tasty Feature Experimentation & Rollout documentation directly through MCP
- Node.js 18+
- npm or yarn
- AB Tasty credentials:
- Environment ID
- API Key
- (Optional) Account ID and token for Resource Loader features for Web Experimentation
1. Clone the repository:
``bash`
git clone https://github.com/flagship-io/mcp-server.git
cd mcp-server
2. Install dependencies:
`bash`
yarn install
3. Build the project:
`bash`
yarn build
The easiest way to use the MCP server is through npx without any installation:
`json`
{
"mcpServers": {
"ABTasty": {
"command": "npx",
"args": [
"-y",
"@abtasty/mcp-server",
"--fear-env-id",
"YOUR_FEAR_ENV_ID",
"--fear-api-key",
"YOUR_FEAR_API_KEY",
"--resource-loader-fear-account-id",
"YOUR_FEAR_ACCOUNT_ID",
"--resource-loader-fear-account-environment-id",
"YOUR_FEAR_ACCOUNT_ENVIRONMENT_ID",
"--resource-loader-fear-rca-token",
"YOUR_FEAR_RCA_TOKEN",
"--resource-loader-we-account-id",
"YOUR_WE_ACCOUNT_ID",
"--resource-loader-we-token",
"YOUR_WE_TOKEN"
]
}
}
}
Replace the placeholder values with your actual credentials:
- YOUR_FEAR_ENV_ID: Your AB Tasty Feature Experimentation account environment IDYOUR_FEAR_API_KEY
- : Your AB Tasty Feature Experimentation API keyYOUR_FEAR_ACCOUNT_ID
- : Your AB Tasty Feature Experimentation Account IDYOUR_FEAR_ACCOUNT_ENVIRONMENT_ID
- : Your AB Tasty Feature Experimentation account Environment IDYOUR_FEAR_RCA_TOKEN
- : Your AB Tasty Feature Experimentation RCA TokenYOUR_WE_ACCOUNT_ID
- : Your AB Tasty Web Experimentation Account IDYOUR_WE_TOKEN
- : Your AB Tasty Web Experimentation token
Alternative: Environment Variables
You can also set credentials via environment variables instead of command-line arguments:
`bashFeature Experimentation & Rollout
export FEAR_ENV_ID="your_fear_env_id"
export FEAR_API_KEY="your_fear_api_key"
Then use a simpler npx command:
`json
{
"mcpServers": {
"ABTasty": {
"command": "npx",
"args": ["-y", "@abtasty/mcp-server"]
}
}
}
`$3
Start the server on the default port (3000):
`bash
yarn start
`Or specify a custom port:
`bash
PORT=8080 yarn start
`The server will be available at
http://localhost:3000/mcp (or your custom port).$3
The server accepts configuration through HTTP headers for each session:
#### Feature Experimentation & Rollout (FEAR) Headers:
-
x-fear-env-id: Your AB Tasty Feature Experimentation & Rollout environment ID
- x-fear-api-key: Your AB Tasty Feature Experimentation & Rollout API key#### Resource Loader Headers (optional):
For Web Experimentation & Personalization:
-
x-resource-loader-we-account-id: Your AB Tasty Web Experimentation account ID
- x-resource-loader-we-token: Your Web Experimentation resource loader authentication tokenFor Feature Experimentation & Rollout:
-
x-resource-loader-fear-account-id: Your AB Tasty Feature Experimentation & Rollout account ID
- x-resource-loader-fear-account-environment-id: Your AB Tasty Feature Experimentation & Rollout environment ID
- x-resource-loader-fear-rca-token: Your Feature Experimentation & Rollout (Remote Control API) resource loader authentication token$3
The server supports two modes of operation:
#### 1. Stdio Mode (for Claude Desktop and similar clients)
Use the npx command shown above for stdio-based MCP clients like Claude Desktop.
#### 2. HTTP Mode (Streamable HTTP transport)
For HTTP-based clients, the server uses the Streamable HTTP transport protocol. Configure your MCP client to connect to the server endpoint:
`json
{
"mcpServers": {
"ABTasty": {
"url": "http://localhost:3000/mcp",
"headers": {
"x-fear-env-id": "your_env_id",
"x-fear-api-key": "your_api_key"
}
}
}
}
`$3
Once connected through an MCP client, you can use the available tools:
Get campaigns for a visitor:
`typescript
decision_api_get_campaigns({
visitor_id: "user123",
context: {
age: 25,
country: "US"
},
trigger_hit: true
});
`Get feature flags:
`typescript
decision_api_get_flags({
visitor_id: "user123",
context: {
age: 25,
country: "US"
},
trigger_hit: false
});
`Create and load Web Experimentation resources:
Step 1: Use the
we_resource_extractor prompt to convert your campaign brief into a resource configuration:`text
User: Create an A/B test on https://example.com/pricing.
Show a red button for 50% of traffic.Prompt Output:
{
"needs_clarification": false,
"questions": [],
"resources": [
{
"type": "campaign",
"$_ref": "c1",
"action": "create",
"payload": {...}
}
]
}
`Step 2: Load the resources using the tool:
`typescript
resource_loader_api_load_webexp_resources({
resourceLoaderContent: {
"needs_clarification": false,
"questions": [],
"resources": [...]
},
dryrun: false,
});
`Create and load Feature Experimentation resources:
Step 1: Use the
fear_resource_extractor prompt to convert your campaign brief:`text
User: Create a feature flag 'new-checkout' for 25% of usersPrompt Output:
{
"version": 1,
"needs_clarification": false,
"questions": [],
"resources": [
{
"type": "project",
"$_ref": "p1",
"action": "create",
"payload": {...}
},
{
"type": "campaign",
"$_ref": "c1",
"action": "create",
"payload": {...}
}
]
}
`Step 2: Load the resources using the tool:
`typescript
resource_loader_api_load_featexp_resources({
resourceLoaderContent: {
"version": 1,
"needs_clarification": false,
"questions": [],
"resources": [...]
},
dryrun: false,
});
`Development
$3
`
├── src/
│ ├── index.ts # Main HTTP server entry point
│ ├── cli.ts # CLI entry point for stdio mode
│ ├── tools/ # MCP tool implementations
│ │ ├── decision-api.ts # Feature flag tools
│ │ └── resource-loader-api.ts
│ ├── prompts/ # Interactive prompt definitions
│ │ ├── quickstart-guide.ts
│ │ └── resource-loader-prompts.ts
│ └── resources/ # Resource providers
│ └── documentation.ts
├── helpers/ # Utility functions
│ ├── abtasty-fear.ts # AB Tasty Feature Experimentation SDK wrapper
│ └── resource-loader.ts # Campaign extraction utilities
├── types/ # TypeScript type definitions
├── assistant-prompts/ # Markdown prompt templates
└── build/ # Compiled output
`$3
`bash
Generate prompt files
yarn generate:promptsBuild the project
yarn buildBuild and run
yarn dev
`$3
The build process:
1. Generates TypeScript files from markdown prompts
2. Bundles the application with esbuild
3. Copies assistant prompt files to the build directory
`bash
yarn build
`Architecture
$3
The server maintains isolated sessions for each client connection:
- Each session has its own credentials (provided via headers)
- Sessions are identified by unique UUIDs
- Sessions are cleaned up when connections close
$3
Uses the Streamable HTTP transport from the MCP SDK:
- Supports JSON-RPC 2.0 over HTTP
- Session-based connection management
- Automatic session initialization and cleanup
Security Notes
- Credentials are session-scoped and not shared between sessions
- Always use HTTPS in production environments
- Store credentials securely and never commit them to version control
API Documentation
$3
####
decision_api_get_campaignsRetrieves all campaigns for a visitor.
Parameters:
-
visitor_id (string): Unique visitor identifier
- context (object): Key-value pairs for targeting (optional)
- trigger_hit (boolean): Send analytics hit (default: false)Returns: Array of campaigns with variations and modifications
####
decision_api_get_campaignRetrieves a specific campaign by its ID for a visitor.
Parameters:
-
visitor_id (string): Unique visitor identifier
- campaign_id (string): Campaign ID to retrieve
- context (object): Key-value pairs for targeting (optional)
- trigger_hit (boolean): Send analytics hit (default: false)Returns: Campaign with variation and modifications
####
decision_api_get_flagsRetrieves all feature flags for a visitor.
Parameters:
-
visitor_id (string): Unique visitor identifier
- context (object): Key-value pairs for targeting (optional)
- trigger_hit (boolean): Send analytics hit (default: false)Returns: Object with flag keys and their values
####
decision_api_activate_campaignActivates a campaign for a visitor.
Parameters:
-
visitor_id (string): Unique visitor identifier
- variation_group_id (string): Variation group ID to activate
- variation_id (string): Variation ID to activateReturns: Activation confirmation
####
resource_loader_api_load_webexp_resourcesLoads Web Experimentation & Personalization resources via the Resource Loader API.
Workflow: Use the
we_resource_extractor prompt to generate the resourceLoaderContent from a natural language campaign brief, then pass it to this tool.Parameters:
-
resourceLoaderContent (object): JSON containing resource loader content with needs_clarification, questions, and resources array
- dryrun (boolean): Whether to simulate the request without sending itReturns: Loaded resources results
####
resource_loader_api_load_featexp_resourcesLoads Feature Experimentation & Rollout resources via the Resource Loader API.
Workflow: Use the
fear_resource_extractor prompt to generate the resourceLoaderContent from a natural language campaign brief, then pass it to this tool.Parameters:
-
resourceLoaderContent (object): JSON containing resource loader content with version, needs_clarification, questions, and resources array
- dryrun (boolean): Whether to simulate the request without sending itReturns: Loaded resources results
Troubleshooting
$3
- Check if port 3000 is already in use
- Verify Node.js version (18+ required)
- Ensure dependencies are installed:
yarn install`- Verify your environment ID and API key are correct
- Check that headers are properly set in your MCP client configuration
- Ensure credentials have the necessary permissions in AB Tasty
For issues related to:
- This MCP server: Open an issue on GitHub
- AB Tasty platform: Contact AB Tasty support
- MCP protocol: See Model Context Protocol documentation
- AB Tasty SDK: See AB Tasty SDK