npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

optly-mcp-server

v2.0.4

Published

Enterprise-grade MCP server for Optimizely Feature and Web Experimentation platforms with AI-powered natural language interface, comprehensive security, and performance optimization

Readme

Optimizely MCP Server

Transform how you interact with Optimizely through AI-powered natural language queries

MCP Optimizely TypeScript Documentation Architecture

🎯 What is This?

The Optimizely MCP Server is an AI-powered interface that enables natural language interaction with your Optimizely experimentation platform. Instead of clicking through multiple UI screens, simply ask your AI assistant questions like:

  • "Show me all running experiments"
  • "Which feature flags changed this week?"
  • "Compare flag configurations between staging and production"
  • "What experiments are targeting mobile users?"

✨ Key Features

🚀 Unified Access

  • 27 MCP tools covering 100+ API endpoints with 100% Rest API coverage
  • Single interface for both Feature Experimentation and Web Experimentation platforms
  • Automatic platform detection and routing with smart routing system
  • Consistent commands across all entity types
  • Direct integration support - Use without MCP transport for custom AI models

🧠 AI-Powered Intelligence

  • Natural language queries - no need to learn APIs
  • Context-aware responses with mandatory workflow enforcement
  • Revolutionary Entity Relationship Documentation Matrix preventing common AI mistakes
  • Intelligent relationship mapping between entities with anti-pattern detection
  • Template-based creation with auto-detection and rollback capabilities
  • Intelligent Payload Parser - Automatic fixing of malformed API payloads

📊 Comprehensive Coverage

  • 25+ entity types: Flags, experiments, campaigns, audiences, collaborators, groups, and more
  • Cross-entity analysis: Connect flags to experiments to results
  • Real-time insights: Live data with automatic caching and change tracking
  • Built-in caching: SQLite-based cache with incremental sync support

🛡️ Production Considerations

  • Basic security: HTTPS API communication with token-based auth
  • Performance features: Built-in caching and incremental sync
  • Comprehensive documentation: Troubleshooting guides and best practices
  • Active development: Regular updates and community support

📊 Advanced Analytics Engine

  • Natural Language Queries: "Show flags with CDN settings in production"
  • Intelligent Query Engine: Multi-entity JOINs, aggregations, date functions
  • Query Result Caching: 90% performance improvement with smart invalidation
  • Structured Queries: Filter, group, aggregate, and transform your data
  • Pre-built Templates: Common analyses like variable usage, complexity detection
  • JSONata Transformations: Powerful data shaping and filtering
  • 🚀 Coming Soon: Dynamic JSON Query Engine - Query ANY field from the API schema without limitations

🎯 Entity Relationship Intelligence

  • Comprehensive entity documentation matrix - Prevents AI agent confusion about entity independence
  • Mandatory workflow enforcement - Ensures proper entity calls instead of embedded data extraction
  • Anti-pattern detection - Blocks common mistakes like confusing variable definitions with variable values
  • Context-aware error messages - Guides to correct entity operations
  • Prescriptive error handling - Step-by-step resolution for dependency issues

🔄 Entity Migration (NEW!)

  • Copy entities between projects - Migrate flags, experiments, audiences, and more
  • Intelligent dependency resolution - Automatically handles entity relationships
  • Reference transformation - Updates all IDs/keys for the destination project
  • Progress tracking - Real-time progress bars with checkpoint/resume capability
  • Flexible migration options - Dry-run, selective migration, conflict resolution
  • Complete Migration Guide - Step-by-step instructions

🚀 Quick Start

👉 GET STARTED - Complete Setup Guide

New to the Optimizely MCP Server? Start here for a complete walkthrough from zero to working in 15 minutes.

The GET STARTED guide provides:

  • Platform detection - Choose Cursor IDE or Claude Desktop
  • Step-by-step setup with validation checkpoints
  • Platform-specific configuration for your AI tool
  • First successful queries to verify everything works
  • Troubleshooting for common issues

Already familiar? Quick installation:

# 1. Clone and install
git clone https://github.com/anthropics/optly-mcp-server.git
cd optly-mcp-server && npm install

# 2. Configure your API token
# Configuration is handled via MCP client config (see setup guides)

# 3. Build and test
npm run build && npm start

Next: Configure your AI client using the GET STARTED guide

🛠️ Complete Tools Reference

👉 GET SUPPORTED TOOLS - Complete Reference

Discover what you can accomplish with the Optimizely MCP Server! The complete reference covers:

  • 27 MCP tools with natural language examples
  • Common workflows from discovery to analysis
  • Tool descriptions showing what each tool returns
  • Use case examples for real-world scenarios

Perfect for understanding the full capabilities before starting.

🔄 Schema Generation & Modern Defaults

The server includes an intelligent schema generation system that solves the jQuery 1.11.3 problem by providing modern defaults for entity creation.

Problem Solved

When creating projects through Optimizely's API, the default settings include jQuery 1.11.3 and other legacy configurations. Our schema system:

  • Extracts live schemas from Optimizely's API specification
  • Provides modern defaults that override legacy settings
  • Allows user customization via configuration files or chat
  • Maintains up-to-date schemas as Optimizely evolves their API

Key Commands

# Generate schema from live API (discovers 25+ entity types)
npm run generate-fields

# Update everything (Swagger + schema + build)
npm run build:clean

# Test the jQuery problem solution
npm run test-defaults

# Direct execution (for debugging)
npx tsx scripts/gen-fields.ts

Generated Files

| File | Purpose | Auto-Generated | |------|---------|----------------| | scripts/gen-fields.ts | Generator script | ❌ Manual | | src/generated/fields.generated.ts | Schema output | ✅ Auto | | docs/schema-generation-guide.md | Full documentation | ❌ Manual |

Maintenance Schedule

  • Update weekly with npm run generate-fields
  • Before releases run npm run build:clean
  • Commit changes to src/generated/fields.generated.ts

Modern vs Legacy Defaults

// ❌ Optimizely's Legacy Default (causes jQuery 1.11.3)
{ platform: "web" }

// ✅ Our Modern Default (Feature Experimentation)
{ 
  platform: "feature",
  settings: {
    web: {
      snippet: {
        include_jquery: false,
        library: "none"
      }
    }
  }
}

📖 Complete Schema Generation Guide

🔧 Direct Integration Options

REST API Server (Available Now! 🚀)

We provide a full REST API server that exposes all MCP functionality via HTTP endpoints. Perfect for Python, Ruby, or any language that can make HTTP requests.

📍 Location: ../optimizely-rest-api

Quick Start:

# 1. Build the main MCP server first
cd optly-mcp-server && npm run build

# 2. Start the REST API server
cd ../optimizely-rest-api
npm install
npm start

# Server runs on http://localhost:3000

Example Usage (Python):

import requests

# List all flags in a project
response = requests.get("http://localhost:3000/api/v1/projects/12345/flags")
flags = response.json()

# Create a new entity
response = requests.post("http://localhost:3000/api/v1/entities/flag", 
    json={"key": "new_feature", "name": "New Feature Flag"})

📖 REST API Documentation

Future: Direct NPM Package

Status: PLANNED - We plan to extract the business logic into a standalone NPM package that can be used programmatically without the MCP layer.

📖 Current Implementation Guide

🖥️ Command Line Interface (CLI)

The Optimizely MCP Server includes a comprehensive CLI for direct interaction with your Optimizely data:

Installation

# Build the project
npm run build

# Run the CLI directly from the project
node bin/optly --help

# Or use npm scripts (recommended)
npm run optly -- --help

# For development (without building)
npm run optly:dev -- --help

Usage Examples

# First, ensure the project is built
npm run build

# Sync data with filtering
node bin/optly sync --project 12345 --entities flags,audiences --environments production

# Query with SQL
node bin/optly query --sql "SELECT * FROM flags WHERE enabled = 1"

# Search across entities
node bin/optly search "checkout" --type flag

# Export/Import data
node bin/optly export flags --format yaml --output flags.yaml
node bin/optly import flags.yaml --dry-run

# Or use npm scripts (recommended)
npm run optly -- sync --project 12345
npm run optly -- query --sql "SELECT * FROM flags WHERE enabled = 1"

CLI Features:

  • Entity & Environment Filtering - Sync only what you need
  • SQL Queries - Full SQLite with JSON support
  • Multiple Output Formats - JSON, CSV, YAML
  • Watch Mode - Monitor changes in real-time
  • Interactive REPL - Advanced operations
  • Automation Ready - Scriptable with webhooks

📖 Complete CLI User Guide | 🤖 AI Agent CLI Reference

📖 Documentation

🚨 CRITICAL: Start Here for Success

🚀 For Immediate Use

🤖 For AI Agents & Tools

🔧 For Developers & Architects

🛡️ For Operations & Security

📤 Response Standards & AI Agent Engineering

📚 Complete Documentation Index

💬 Example Interactions

Discovery

You: "Show me all my Optimizely projects"
AI: Here are your projects:
    - Project 12345 (Web Experimentation)
    - Project 20224828075 (Feature Experimentation) 
    - Project 67890 (Web Experimentation)

Feature Flags

You: "What feature flags are in project 20224828075?"
AI: Found 15 feature flags:
    - checkout-redesign (85% rollout in production)
    - new-pricing-engine (testing in staging)
    - mobile-navigation (100% rolled out)
    ...

Experiments

You: "Show running experiments targeting mobile users"
AI: Found 3 experiments targeting mobile users:
    1. Mobile Checkout Flow (running for 7 days, 2,341 visitors)
    2. App Onboarding Test (running for 3 days, 892 visitors)
    3. Mobile Navigation (reached significance! +12% conversion)

Analysis

You: "Compare the checkout-redesign flag between staging and production"
AI: Differences found:
    - Rollout: Staging 100% vs Production 85%
    - Targeting: Staging includes internal users, Production excludes
    - Variables: Button color differs (blue vs green)

🏗️ Architecture

The server uses a parametric tool architecture with sophisticated routing and caching:

┌─────────────────────────────────────────────────────────┐
│                    AI Assistant (Claude, etc.)           │
├─────────────────────────────────────────────────────────┤
│                    MCP Protocol Layer                    │
├─────────────────────────────────────────────────────────┤
│              27 Parametric Tools                        │
│   list_entities • get_entity_details • manage_lifecycle │
├─────────────────────────────────────────────────────────┤
│                Smart Routing System                      │
│         Platform detection • Error handling              │
├─────────────────────────────────────────────────────────┤
│              Multi-Level Cache Architecture              │
│        L1 Memory • L2 SQLite • L3 API                   │
├─────────────────────────────────────────────────────────┤
│   Feature Experimentation  │  Web Experimentation       │
│   🚩 Flags API            │  🌐 Experiments API       │
└─────────────────────────────────────────────────────────┘

Key Architecture Components

  • EntityRouter: 2,409 lines of sophisticated routing logic
  • IncrementalSyncManager: 1,027 lines of fully implemented sync
  • ChangeHistoryTracker: 447 lines of production-ready tracking
  • Multi-level caching: Memory, SQLite, and API layers
  • Smart routing: Automatic platform detection and error handling

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Current Priorities

  • Entity Relationship Documentation Matrix - Completed comprehensive entity documentation
  • Security Hardening - Comprehensive security implementation completed
  • Performance Optimization - Multi-level cache architecture implemented
  • Testing Strategy - Comprehensive testing approach documented
  • Additional entity type support (Variable Definitions endpoints)
  • Enhanced analytics capabilities

📊 Supported Entities

Feature Experimentation (100% Complete!)

  • ✅ Flags (full CRUD)
  • ✅ Environments
  • ✅ Rulesets (full management)
  • ✅ Rules
  • ✅ Variations (full CRUD)
  • ✅ Variable Definitions (full CRUD)
  • ✅ Experiments

Web Experimentation (100% Complete!)

  • ✅ Campaigns (full CRUD)
  • ✅ Experiments (full CRUD)
  • ✅ Pages (full CRUD)
  • ✅ Audiences (full CRUD)
  • ✅ Attributes (full CRUD)
  • ✅ Events (full CRUD)
  • ✅ Experiment Results
  • ✅ Collaborators (full management)
  • ✅ Extensions (full CRUD)
  • ✅ Environments (full CRUD)
  • ✅ Webhooks (full CRUD)
  • ✅ List Attributes (full CRUD)

Cross-Platform (100% Complete!)

  • ✅ Projects
  • ✅ Groups (full CRUD)
  • ✅ Change History
  • ✅ Analytics - Advanced Query Engine with natural language support
  • ✅ Diagnostics
  • ✅ User Management

🚀 Roadmap

See our Expansion Roadmap for the vision of transforming from a configuration tool to a complete experimentation intelligence platform.

Completed Major Milestones

  • Technical Design Audit - 23/28 tasks completed (82%)
  • Security Hardening - Comprehensive threat model and protection
  • Performance Optimization - Multi-level cache architecture
  • Documentation Overhaul - Complete documentation matrix
  • Testing Strategy - Comprehensive testing approach
  • Operational Readiness - Troubleshooting and migration guides

🚀 Universal Data Democratization Platform

Separate Project: The architecture/ folder contains comprehensive technical documentation for a Universal Data Democratization Platform - a vision for transforming how small businesses interact with their data through collaborative intelligence.

Key Documents:

This represents a separate initiative from the MCP server, focused on universal data access across any API.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📞 Support


Built with ❤️ for the experimentation community #� �T�e�s�t� �c�o�m�m�e�n�t� �f�o�r� �h�o�o�k� �v�e�r�i�f�i�c�a�t�i�o�n� � �