cboxdk / statamic-mcp
Requires
- laravel/mcp: ^0.1.1
- statamic/cms: ^5.0
- symfony/yaml: ^7.3
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.17
- orchestra/testbench: ^9.0
- pestphp/pest: ^4.0@dev
- pestphp/pest-plugin-laravel: ^4.0@dev
README
A comprehensive MCP (Model Context Protocol) server for Statamic CMS that provides AI assistants with structured access to Statamic's content management capabilities through a clean, organized tool architecture.
๐ Requirements
- PHP 8.2+
- Laravel 11+
- Statamic 5.0+
- Laravel MCP Server (
laravel/mcp
^0.1.1)
๐ Installation
# Install via Composer composer require cboxdk/statamic-mcp # Run the installation command to set up MCP php artisan mcp:statamic:install # The addon automatically registers with Laravel's MCP server
๐ฏ Recommended: Laravel Boost Integration
We strongly recommend installing Laravel Boost alongside this Statamic MCP server for the best development experience:
composer require laravel/boost --dev
Why use both?
- Laravel Boost and Statamic MCP Server run in parallel, complementing each other perfectly
- Laravel Boost provides Laravel-specific tools (Eloquent, database, debugging, Artisan commands)
- Statamic MCP Server provides Statamic-specific tools (blueprints, collections, entries, assets)
- Together, they give you complete AI-assisted development capabilities for your Statamic/Laravel application
With both installed, your AI assistant can:
- Use Laravel Boost for database queries, debugging, and Laravel framework operations
- Use Statamic MCP for content management, blueprint operations, and Statamic-specific tasks
- Seamlessly work across both the Laravel framework and Statamic CMS layers
Development Installation
For local development or contributing:
# Clone the repository into your Statamic project's addons folder mkdir -p addons/cboxdk cd addons/cboxdk git clone https://github.com/cboxdk/statamic-mcp.git # Add to composer.json repositories section "repositories": [ { "type": "path", "url": "addons/cboxdk/statamic-mcp" } ] # Install the addon composer require cboxdk/statamic-mcp:@dev # Install dependencies cd addons/cboxdk/statamic-mcp composer install
โจ Features
The MCP server is organized into five logical categories that mirror Statamic's architecture:
๐ Blueprint Tools
Purpose: Manage blueprint definitions and schema
statamic.blueprints.list
- List blueprints with optional details and filteringstatamic.blueprints.get
- Get specific blueprint with full field definitionsstatamic.blueprints.create
- Create new blueprints from field definitionsstatamic.blueprints.update
- Update existing blueprint fields and configurationstatamic.blueprints.delete
- Delete blueprints with safety checksstatamic.blueprints.scan
- Blueprint scanning with performance optimizationstatamic.blueprints.generate
- Generate blueprints from templates and field definitionsstatamic.blueprints.types
- Blueprint type analysis and TypeScript/PHP type generation
๐ Collection Tools
Purpose: Manage collection structures and configuration
statamic.collections.list
- List all collections with configuration detailsstatamic.collections.get
- Get specific collection with full configurationstatamic.collections.create
- Create new collections with blueprint associationsstatamic.collections.update
- Update collection settings and structurestatamic.collections.delete
- Delete collections with safety checks
๐ Taxonomy Tools
Purpose: Manage taxonomies and their terms
statamic.taxonomies.list
- List all taxonomies with filtering and metadatastatamic.taxonomies.get
- Get specific taxonomy with detailed informationstatamic.taxonomies.create
- Create new taxonomies with configurationstatamic.taxonomies.update
- Update taxonomy settings and associationsstatamic.taxonomies.delete
- Delete taxonomies with safety checksstatamic.taxonomies.analyze
- Analyze taxonomy usage and term relationshipsstatamic.taxonomies.terms
- List and manage terms within taxonomies
๐๏ธ Structure Tools
Purpose: Manage structural configurations and scanning
statamic.structures.fieldsets.scan
- Fieldset analysis and parsingstatamic.structures.fieldsets
- Fieldset configuration managementstatamic.structures.navigations
- Navigation structure managementstatamic.structures.forms
- Form configuration managementstatamic.structures.globals
- Global set configuration managementstatamic.structures.assets
- Asset container configurationstatamic.structures.groups
- User group structure managementstatamic.structures.permissions
- Permission structure analysis
๐ Entry Tools
Purpose: Manage entries across all collections
statamic.entries.list
- List entries with filtering, search, and paginationstatamic.entries.get
- Get specific entry with full data and relationshipsstatamic.entries.create
- Create new entries with validation and blueprint compliancestatamic.entries.update
- Update existing entries with merge options and validationstatamic.entries.delete
- Delete entries with safety checks and relationship validationstatamic.entries.publish
- Publish draft entries with validationstatamic.entries.unpublish
- Unpublish entries with safety checks
๐ท๏ธ Term Tools
Purpose: Manage taxonomy terms across all taxonomies
statamic.terms.list
- List terms with filtering, search, and paginationstatamic.terms.get
- Get specific term with full data and related entriesstatamic.terms.create
- Create new terms with validation and slug conflict checkingstatamic.terms.update
- Update existing terms with merge options and validationstatamic.terms.delete
- Delete terms with safety checks and dependency validation
๐ Global Tools
Purpose: Manage global set values
statamic.globals.list
- List all global sets with metadatastatamic.globals.get
- Get specific global set with full datastatamic.globals.update
- Update global set values with validation
๐งญ Navigation Tools
Purpose: Manage navigation structures
statamic.navigation.list
- List navigation trees with full structure
๐ Sites Management Tools
Purpose: Multi-site Statamic configuration and management
statamic.sites.list
- List all configured sites with settings and statusstatamic.sites.create
- Create new site configurations with validationstatamic.sites.update
- Update existing site configurations with backup optionsstatamic.sites.delete
- Delete sites with content analysis and cleanup optionsstatamic.sites.switch
- Switch default site with impact analysisstatamic.sites.analyze
- Analyze site configuration and detect potential issues
๐ฅ User Management Tools
Purpose: Comprehensive user management with RBAC support
statamic.users.list
- List users with filtering, roles, and metadatastatamic.users.get
- Get specific user with detailed role and permission informationstatamic.users.create
- Create new users with role assignment and validationstatamic.users.update
- Update users with granular role managementstatamic.users.delete
- Delete users with content reassignment optionsstatamic.users.analyze
- Analyze user activity and permission usage patterns
๐ Role & Permission Tools
Purpose: Role-based access control and security management
statamic.roles.list
- List all roles with permissions and user countsstatamic.roles.get
- Get specific role with detailed permission analysisstatamic.roles.create
- Create new roles with permission validationstatamic.roles.update
- Update roles with impact analysis on affected usersstatamic.roles.delete
- Delete roles with user impact assessmentstatamic.permissions.list
- List all available permissions with descriptionsstatamic.permissions.analyze
- Analyze permission usage and security implications
๐๏ธ Other Content Tools
Purpose: Additional content management capabilities
statamic.content.assets
- Asset CRUD operations (coming soon)statamic.content.submissions
- Form submission management (coming soon)
๐ท๏ธ Tag Tools
Purpose: Manage Statamic tags for both Antlers and Blade
statamic.tags.list
- Tag discovery, creation, and management for both Antlers and Blade
๐ง Modifier Tools
Purpose: Manage template modifiers
statamic.modifiers.list
- Modifier discovery, creation, and usage examples
๐๏ธ Field Type Tools
Purpose: Manage custom field types
statamic.fieldtypes.list
- Field type discovery, creation, and configuration options
๐ Scope Tools
Purpose: Manage query scopes
statamic.scopes.list
- Query scope discovery and creation
๐๏ธ Filter Tools
Purpose: Manage collection filters
statamic.filters.list
- Filter discovery and creation
โ Blueprint Validation Tools
Purpose: Blueprint integrity and field validation
statamic.blueprints.validate
- Validate blueprint structure and field configurationstatamic.blueprints.dependencies
- Analyze field dependencies and conditional logicstatamic.blueprints.conflicts
- Detect cross-blueprint field conflicts and naming issues
โ๏ธ Development Tools
Purpose: Enhanced developer experience and tooling
statamic.development.templates
- Template hints, validation, and optimization for Antlers/Bladestatamic.development.addons
- Addon development, analysis, and scaffoldingstatamic.development.addon.discovery
- Addon discovery and recommendationsstatamic.development.types
- TypeScript/PHP type generation from blueprintsstatamic.development.console
- Artisan command execution and managementstatamic.development.antlers.validate
- Antlers template validation and syntax checkingstatamic.development.blade.hints
- Blade template hints and suggestionsstatamic.development.blade.lint
- Blade template linting and best practicesstatamic.development.widgets
- Widget development and managementstatamic.development.performance.analyze
- Comprehensive template performance analysis with N+1 detectionstatamic.development.templates.unused
- Detect unused templates, partials, and layoutsstatamic.development.templates.variables
- Extract variables from templates with type analysisstatamic.development.templates.optimize
- Suggest specific template optimizations with examples
๐ง System Tools
Purpose: System management and operations
statamic.system.info
- Comprehensive system analysis and health checksstatamic.system.cache
- Advanced cache management with selective clearing and warmingstatamic.system.docs
- Statamic documentation search with AI relevance scoringstatamic.system.license
- License management (solo/pro, addon licensing, key configuration)statamic.system.preferences
- Multi-level preferences management (global/role/user)statamic.system.stache
- Advanced Stache cache operations (clear/warm/analyze/optimize)statamic.system.search.index
- Search index performance analysis and optimizationstatamic.system.discover
- Dynamically discover all available MCP tools with examplesstatamic.system.schema
- Get detailed schema information for specific toolsstatamic.system.health
- Comprehensive system health check with security analysisstatamic.system.monitor
- Performance analysis with sample operations and bottleneck detection
๐๏ธ Architecture & Design
Clean MCP Tool Architecture
The addon follows a single-purpose tool pattern where each tool performs exactly ONE action:
- No action conditionals: Each tool has a focused responsibility
- Predictable schemas: Clear input/output contracts
- Better performance: Reduced token overhead for AI assistants
- Easier testing: Isolated, testable components
Security & Reliability
- Path traversal protection: All file operations validated against allowed directories
- Input sanitization: Sensitive data redacted from logs
- Structured error handling: Standardized error codes and responses
- Type safety: PHPStan Level 8 compliance with strict typing
Developer-Focused Design
- Local development first: Optimized for development workflows
- Smart caching: Expensive operations cached with dependency tracking
- Comprehensive logging: Structured logs with correlation IDs for debugging
- No unnecessary complexity: No rate limiting or emergency logging in dev tools
๐ฏ New Features & Performance
โก Automatic Cache Purging
All structural and content changes automatically clear relevant caches:
- Blueprint/fieldset changes: Clears stache, static, views
- Content operations: Clears stache, static caches
- Structure changes: Comprehensive cache clearing
- Transparent reporting: All responses include cache status
๐ Performance Optimizations
- Pagination support: Use
limit
andfilter
parameters for large datasets - Field filtering:
include_fields: false
for blueprint scanning performance - Response limits: Automatic limits to prevent token overflow (< 25,000 tokens)
- Smart defaults: Optimized for AI assistant token limits
- Smart caching: Discovery operations cached with file modification tracking
๐ค AI Assistant Setup
Claude Code (Anthropic) - Recommended
Add to your Claude Code MCP configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
{ "mcpServers": { "statamic": { "command": "php", "args": [ "/absolute/path/to/your/project/artisan", "mcp:serve", "statamic" ], "env": { "APP_ENV": "local" } } } }
Other AI Assistants
For Cursor, Cline, Copilot, and other AI assistant setups, see docs/AI_ASSISTANT_SETUP.md.
๐ก Example Usage with AI
Once configured, you can ask your AI assistant:
"What version of Statamic is installed and is it Pro or Solo?"
"Show me all my blueprint structures and generate TypeScript types"
"List all global sets and their current values across all sites"
"Create a new global set for company contact information with phone, email, and address fields"
"Update the footer global values for the Danish site"
"What modifiers and filters are available in my project?"
"Analyze this Antlers template for performance issues and security vulnerabilities"
"Lint this Blade template and detect N+1 query problems"
"Validate this template against my blueprint and check for edge cases"
"Create a new blog entry with proper field validation"
"Search for documentation about collections and how they work"
"Check my templates for XSS vulnerabilities and recursive partial issues"
"What global sets exist and what's their blueprint structure?"
"Clear all Statamic caches and show me the status"
"Analyze template performance and suggest optimizations"
"Check for missing pagination in large collection loops"
"Find templates with excessive complexity and suggest refactoring"
"Show me user preferences and configure global settings"
๐ฏ Key Capabilities
System Intelligence & Management
- Installation Analysis: Version, edition (Pro/Solo), licensing status, multi-site configuration
- Storage Detection: File-based, database (Runway), or mixed storage patterns
- Content Extraction: Dynamic analysis of modifiers, globals, taxonomies, users, permissions
- Cache Management: Clear, warm, and monitor all Statamic caches (Stache, static, images, views)
Content Operations
- CRUD Operations: Create, edit, delete, reorder entries, taxonomy terms, navigation items
- Content Discovery: Extract all content types with filtering and metadata
- Bulk Operations: Mass content management and organization
- Data Integrity: Safe operations with proper validation and error handling
Blueprint Intelligence
- Complete Analysis: Blueprint and fieldset scanning with relationship mapping
- Type Generation: TypeScript, PHP classes, JSON Schema from blueprints
- Field Categories: 25+ supported field types with validation patterns
- Dynamic Discovery: On-demand field type and configuration analysis
Documentation Intelligence
- Dynamic Search: Live content from statamic.dev with sitemap parsing
- Relevance Scoring: Intelligent content ranking and suggestions
- Addon Coverage: Third-party documentation and community resources
- Comprehensive Coverage: All modifiers, tags, and constantly updated content
Template Development
- Language-Aware Hints: Context-appropriate suggestions for Antlers vs Blade
- Syntax Validation: Blueprint-driven template validation with error reporting
- Best Practices: Anti-pattern detection with auto-fix suggestions
- Template Separation: Clear guidance on when to use Antlers vs Blade
Code Quality & Security
- Policy Enforcement: Configurable linting rules for both Antlers and Blade
- Security Detection: Template vulnerability scanning and prevention
- Accessibility: Compliance checks and automated improvements
- Performance: Template optimization suggestions and cache-aware development
๐ Project Structure
statamic-mcp/
โโโ src/Mcp/Tools/ # 50+ specialized MCP tools
โ โโโ Blueprints/ # Blueprint management and analysis
โ โ โโโ ListBlueprintsTool.php
โ โ โโโ GetBlueprintTool.php
โ โ โโโ CreateBlueprintTool.php
โ โ โโโ UpdateBlueprintTool.php
โ โ โโโ DeleteBlueprintTool.php
โ โ โโโ ScanBlueprintsTool.php
โ โ โโโ GenerateBlueprintTool.php
โ โ โโโ TypesBlueprintTool.php
โ โ โโโ ValidateBlueprintTool.php
โ โ โโโ CheckFieldDependenciesTool.php
โ โ โโโ DetectFieldConflictsTool.php
โ โโโ Collections/ # Collection management
โ โ โโโ ListCollectionsTool.php
โ โ โโโ GetCollectionTool.php
โ โ โโโ CreateCollectionTool.php
โ โ โโโ UpdateCollectionTool.php
โ โ โโโ DeleteCollectionTool.php
โ โโโ Taxonomies/ # Taxonomy management
โ โ โโโ ListTaxonomyTool.php
โ โ โโโ GetTaxonomyTool.php
โ โ โโโ CreateTaxonomyTool.php
โ โ โโโ UpdateTaxonomyTool.php
โ โ โโโ DeleteTaxonomyTool.php
โ โ โโโ AnalyzeTaxonomyTool.php
โ โ โโโ ListTermsTool.php
โ โโโ Entries/ # Entry management
โ โ โโโ ListEntresTool.php
โ โ โโโ GetEntryTool.php
โ โ โโโ CreateEntryTool.php
โ โ โโโ UpdateEntryTool.php
โ โ โโโ DeleteEntryTool.php
โ โ โโโ PublishEntryTool.php
โ โ โโโ UnpublishEntryTool.php
โ โโโ Terms/ # Term management
โ โ โโโ ListTermsTool.php
โ โ โโโ GetTermTool.php
โ โ โโโ CreateTermTool.php
โ โ โโโ UpdateTermTool.php
โ โ โโโ DeleteTermTool.php
โ โโโ Globals/ # Global sets and values management
โ โ โโโ ListGlobalSetsTool.php
โ โ โโโ GetGlobalSetTool.php
โ โ โโโ CreateGlobalSetTool.php
โ โ โโโ DeleteGlobalSetTool.php
โ โ โโโ ListGlobalValuesTool.php
โ โ โโโ GetGlobalValuesTool.php
โ โ โโโ UpdateGlobalValuesTool.php
โ โโโ Navigation/ # Navigation management
โ โ โโโ ListNavigationTool.php
โ โโโ Content/ # Other content operations
โ โ โโโ AssetsContentTool.php
โ โ โโโ SubmissionsContentTool.php
โ โ โโโ UsersContentTool.php
โ โโโ Tags/ # Tag management
โ โ โโโ ListTagsTool.php
โ โโโ Modifiers/ # Modifier management
โ โ โโโ ListModifiersTool.php
โ โโโ FieldTypes/ # Field type management
โ โ โโโ ListFieldTypesTool.php
โ โโโ Scopes/ # Scope management
โ โ โโโ ListScopesTool.php
โ โโโ Filters/ # Filter management
โ โ โโโ ListFiltersTool.php
โ โโโ Sites/ # Multi-site management
โ โ โโโ ListSitesTool.php
โ โ โโโ CreateSiteTool.php
โ โ โโโ UpdateSiteTool.php
โ โ โโโ DeleteSiteTool.php
โ โ โโโ SwitchSiteTool.php
โ โ โโโ AnalyzeSitesTool.php
โ โโโ Users/ # User management and RBAC
โ โ โโโ ListUsersTool.php
โ โ โโโ GetUserTool.php
โ โ โโโ CreateUserTool.php
โ โ โโโ UpdateUserTool.php
โ โ โโโ DeleteUserTool.php
โ โ โโโ AnalyzeUsersTool.php
โ โโโ Roles/ # Role management
โ โ โโโ ListRolesTool.php
โ โ โโโ GetRoleTool.php
โ โ โโโ CreateRoleTool.php
โ โ โโโ UpdateRoleTool.php
โ โ โโโ DeleteRoleTool.php
โ โ โโโ ListPermissionsTool.php
โ โ โโโ AnalyzePermissionsTool.php
โ โโโ Development/ # Advanced developer tools
โ โ โโโ TemplatesDevelopmentTool.php
โ โ โโโ AddonsDevelopmentTool.php
โ โ โโโ AddonDiscoveryTool.php
โ โ โโโ TypesDevelopmentTool.php
โ โ โโโ ConsoleDevelopmentTool.php
โ โ โโโ AntlersValidateTool.php
โ โ โโโ BladeLintTool.php
โ โ โโโ OptimizedTemplateAnalyzer.php # Advanced template analysis
โ โ โโโ AnalyzeTemplatePerformanceTool.php
โ โ โโโ DetectUnusedTemplatesTool.php
โ โ โโโ ExtractTemplateVariablesTool.php
โ โ โโโ SuggestTemplateOptimizationsTool.php
โ โ โโโ WidgetsDevelopmentTool.php
โ โโโ Structures/ # Structure management
โ โ โโโ FieldsetsScanStructuresTool.php
โ โ โโโ FieldsetsStructureTool.php
โ โ โโโ NavigationsStructureTool.php
โ โ โโโ FormsStructureTool.php
โ โ โโโ GlobalsStructureTool.php
โ โ โโโ AssetsStructureTool.php
โ โ โโโ GroupsStructureTool.php
โ โ โโโ PermissionsStructureTool.php
โ โโโ System/ # System operations
โ โโโ InfoSystemTool.php
โ โโโ CacheSystemTool.php
โ โโโ DocsSystemTool.php
โ โโโ GetLicenseStatusTool.php
โ โโโ VerifyLicenseTool.php
โ โโโ PreferencesManagementTool.php
โ โโโ StacheManagementTool.php
โ โโโ SearchIndexAnalyzerTool.php
โ โโโ SitesTool.php
โ โโโ DiscoverToolsTool.php
โ โโโ GetToolSchemaTool.php
โ โโโ SystemHealthCheckTool.php
โ โโโ PerformanceMonitorTool.php
โโโ tests/ # Comprehensive test suite
โโโ docs/ # Detailed documentation
โโโ config/statamic_mcp.php # Configuration options
๐ Documentation
Tool Discovery
Use the built-in discovery tools to explore available capabilities:
# Discover all available tools with their schemas "Use the statamic.system.tools.discover tool to show me all available tools" # Get detailed schema for a specific tool "Show me the schema for statamic.entries.create" # Find tools by domain "What blueprint management tools are available?"
Additional Documentation
- Installation Guide: See Installation section above
- AI Assistant Setup: See AI Assistant Setup section
- Tool Examples: Use discovery tools for live examples
โ๏ธ Configuration
Publish and customize the configuration:
php artisan vendor:publish --tag=statamic-mcp-config
Configure blueprint paths, linting rules, cache settings, and more in config/statamic_mcp.php
.
๐งช Development & Testing
Running Tests
# Run all tests with Pest ./vendor/bin/pest composer test # Run with coverage report ./vendor/bin/pest --coverage composer test:coverage # Development watch mode ./vendor/bin/pest --watch # Run specific test file ./vendor/bin/pest tests/BlueprintsScanToolTest.php
Code Quality
# Format code with Laravel Pint ./vendor/bin/pint composer pint # Check formatting without fixing ./vendor/bin/pint --test composer pint:test # Run PHPStan Level 8 analysis ./vendor/bin/phpstan analyse composer stan # Run complete quality check (format + analysis + tests) composer quality
Quality Standards
This project maintains the highest code quality standards:
- PHPStan Level 8: Strict type checking with zero tolerance for errors
- Laravel Pint: Consistent code formatting following Laravel conventions
- Type Safety: All methods have explicit parameter and return types
- Test Coverage: Comprehensive test suite with 92+ passing tests
- Strict Types: All PHP files declare
strict_types=1
๐ง Troubleshooting
Common Issues
MCP server not connecting in Claude:
- Ensure absolute paths in config file
- Check
APP_ENV
is set tolocal
- Verify PHP path:
which php
- Test manually:
php artisan mcp:serve statamic
Tools not appearing:
- Clear Laravel cache:
php artisan cache:clear
- Check service provider registration
- Verify
laravel/mcp
is installed:composer show laravel/mcp
PHPStan errors:
- Run
composer update
to ensure latest dependencies - Check PHP version: minimum 8.2 required
- Clear PHPStan cache:
./vendor/bin/phpstan clear-result-cache
Test failures:
- Ensure Statamic is properly installed
- Check test database configuration
- Run
composer dump-autoload
๐ค Contributing
- Fork the repository
- Install:
composer install
- Test:
./vendor/bin/pest
- Ensure quality checks pass:
composer quality
- Submit pull request
๐ License
MIT License
Enhanced Statamic development with AI assistance ๐