Overview
How the WPZylos MCP server turns framework source code into AI-powered code generation.
What is MCP?
The Model Context Protocol (MCP) is an open standard that lets AI editors communicate with external tool servers over a structured JSON-RPC channel. Instead of pasting documentation into chat, the editor discovers tools, resources, and prompts automatically -- and the AI calls them as needed.
WPZylos MCP implements an MCP server that exposes the entire WPZylos framework as a set of callable tools. The AI can inspect packages, read architecture guides, generate code from stubs, and validate the result -- all without the developer writing boilerplate.
Transport
The server uses STDIO transport -- the AI editor launches the server as a child process and communicates via stdin/stdout. No HTTP, no ports, no network configuration.
AI Editor (Cursor / VS Code / Claude Desktop)
|
| stdin/stdout (JSON-RPC)
|
WPZylos MCP Server (Node.js)
|
+-- Engine Layer (analysis, stubs, docs)
|
+-- WPZYLOS_ROOT (framework source)
Engine Layer
Four core engines power the server:
| Engine | File | Purpose |
|---|---|---|
| Package Registry | package-registry.ts | Discovers all framework packages from the monorepo. Reads composer.json files, maps namespaces, and builds a searchable package catalog. |
| File Analyzer | file-analyzer.ts | Extracts PHP class structure using regex-based parsing. Pulls class names, methods, properties, constants, docblocks, and type hints without requiring a PHP runtime. |
| Stub Registry | stub-registry.ts | Compiles .stub template files with variable substitution. Handles conditionals, loops, and nested stub includes for complex generation. |
| Docs Indexer | docs-indexer.ts | Indexes markdown documentation across all packages. Provides full-text search and section-level retrieval for framework guides. |
How They Connect
Framework Source (PHP files)
|
v
package-registry.ts --> discovers packages, namespaces
|
v
file-analyzer.ts --> extracts classes, methods, types
|
v
stub-registry.ts --> compiles stubs with extracted data
|
v
Generated Code (PHP, JSON, JS files)
The docs-indexer runs in parallel, feeding framework knowledge into resource queries and prompt context.
Tool Categories
79 tools organized into 10 categories:
| Category | Count | Tools | Purpose |
|---|---|---|---|
| Core | 6 | set_project_target, recommend_package, inspect_package, inspect_class, search_framework, find_pattern | Framework discovery and inspection |
| Scaffolding | 6 | scaffold_plugin, scaffold_crud_module, scaffold_cpt_module, scaffold_rest_module, scaffold_settings_page, build_from_blueprint | Full component scaffolding |
| Generation | 16 | generate_from_stub + 15 shortcuts (generate_provider, generate_model, generate_controller, generate_middleware, generate_migration, generate_seeder, generate_request, generate_policy, generate_event, generate_listener, generate_command, generate_shortcode, generate_widget, generate_hook, generate_view) | Individual file generation from stubs |
| Enhancement | 7 | scaffold_ajax_handler, scaffold_cron_job, scaffold_admin_notice, scaffold_custom_table, scaffold_meta_box, scaffold_update_checker, validate_rest_schema | WordPress-specific feature additions |
| Validation | 4 | validate_conventions, validate_security, validate_structure, validate_composer | Code quality and correctness checks |
| Gutenberg | 8 | scaffold_block, scaffold_block_pattern, scaffold_block_style, scaffold_block_variation, scaffold_block_category, scaffold_block_template, scaffold_block_widget, scaffold_sidebar | Block editor components |
| WooCommerce | 10 | scaffold_woo_product_type, scaffold_woo_gateway, scaffold_woo_shipping, scaffold_woo_discount, scaffold_woo_email, scaffold_woo_widget, scaffold_woo_tab, scaffold_woo_endpoint, scaffold_woo_status, scaffold_woo_data_store | WooCommerce extension scaffolding |
| Multisite | 5 | scaffold_network_admin, scaffold_site_switcher, scaffold_network_option, scaffold_blog_template, scaffold_network_role | WordPress Multisite support |
| Niche | 6 | scaffold_wp_cli_command, scaffold_test_suite, scaffold_phpstan_config, scaffold_github_actions, scaffold_docker_config, scaffold_release_workflow | DevOps and tooling |
| Advanced | 5 | scaffold_plugin, inspect_hook_map, inspect_provider_map, analyze_dependencies, generate_documentation | Deep analysis and inspection |
Resource Types
16 resources across 5 categories:
| Type | Description |
|---|---|
| Architecture | Framework design docs -- service container, lifecycle, provider pattern |
| Stubs | Template listings and variable reference for all stub files |
| Packages | Package catalog with descriptions, dependencies, and namespace maps |
| Guides | Step-by-step walkthroughs for common tasks (CRUD, REST, settings) |
| Cookbook | API recipe collection -- "how to register a post type", "how to add a menu page", etc. |
Prompts
14 guided prompts that walk the AI through multi-step workflows:
- Plugin creation -- Full plugin from spec to generated code
- Module addition -- Add CRUD, CPT, or REST modules to existing plugins
- Code audit -- Review generated code for conventions, security, structure
- Migration -- Convert legacy WordPress plugins to WPZylos framework
- Blueprint -- Build a JSON blueprint and generate everything at once
Knowledge Flow
The MCP does not rely on static documentation alone. It reads the actual framework source code at runtime:
1. AI asks: "What methods does BaseModel expose?"
|
v
2. inspect_class("BaseModel")
|
v
3. package-registry finds the package containing BaseModel
|
v
4. file-analyzer parses the PHP file
|
v
5. Returns: class name, namespace, methods (with signatures),
properties, traits, parent class, interfaces
|
v
6. AI uses real data to generate correct code
This means generated code stays accurate even as the framework evolves -- no stale documentation problem.
Next Steps
- Installation -- Get the server running
- Usage -- Learn the workflows
- API Reference -- Browse all tools