Install
$ agentstack add mcp-codechap-mcp-server-yii2-ai-boost ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Yii2 AI Boost - MCP Server for Yii2 Applications
Yii2 AI Boost is a Model Context Protocol (MCP) server that provides AI assistants (like Claude Code) with comprehensive tools and guidelines for faster Yii2 application development.
Features
- 16 MCP Tools - Database inspection and queries, config access, route analysis, component introspection, model and validation inspection, console command discovery, migration inspection, widget inspection, performance profiling, PHP tinker, environment inspection, logging, and FTS5-powered semantic search
- Semantic Search - BM25-ranked full-text search over bundled guidelines + Yii2 definitive guide (section-level results, not full files)
- Framework Guidelines - Comprehensive Yii2 patterns covering controllers, models, migrations, caching, auth, and more
- IDE Integration - Works with Claude Code, Cursor, Zed, and other MCP-compatible editors
Quick Start
For experienced developers:
# 1. Install
composer require codechap/yii2-ai-boost:^1.3 --dev
# 2. Run installation
php yii boost/install
# 3. (Optional) Sync guidelines to your editor (Cursor/Zed)
php yii boost/sync-rules
That's it! Claude Code and other AI tools now have access to your application context.
Installation
Step 1: Require the Package
cd /path/to/yii2/application
composer require codechap/yii2-ai-boost:^1.3 --dev
Step 2: Run Installation Wizard
php yii boost/install
The installation runs automatically and:
- Detects your Yii2 environment
- Generates configuration files (
.mcp.json,boost.json) - Copies framework guidelines to
.ai/guidelines/
If installation fails, please open an issue or reach out on X.
Step 3: Connect Claude Code and or your IDE
__Claude Code integration__
After running php yii boost/install, a .mcp.json file will be generated in your project root. Claude Code will automatically detect and use this configuration to connect to the MCP server.
__Codex CLI Configuration__ @todo
__Gemini CLI Configuration__ @todo
__Zed Configuration__
For Zed create or open your settings file in .zed/settings.json
{
"context_servers": {
"yii2-ai-boost": {
"enabled": true,
"command": "php",
"args" : [
"yii", "boost/mcp"
]
}
}
}
Generated Files
After installation, you'll have:
.mcp.json- MCP server configuration for Claude Codeboost.json- Package configuration and tool list.ai/guidelines/- Framework and ecosystem guidelines (Markdown).cursor/rules/yii2-boost.mdc- (Optional) Generated rules for Cursor.rules- (Optional) Generated rules for Zed
Usage
View Yii2 information
php yii boost/info
Displays:
- Package version and configuration
- List of available MCP tools
- Status of guidelines and configuration files
Sync Editor Rules
php yii boost/sync-rules
Automatically generates:
- Cursor:
.cursor/rules/yii2-boost.mdc - Zed:
.rules(in project root)
These files contain the core Yii2 guidelines and structural references, giving your AI editor "X-Ray vision" into Yii2 best practices without manual prompting.
Start MCP Server (Manual Testing)
php yii boost/mcp
> ⚠️ Note: This command is invoked automatically by Cluade Code or your editor. You don't need to run it manually.
The server listens on STDIN for JSON-RPC requests and outputs responses to STDOUT.
Update Guidelines
php yii boost/update
Updates guidelines, downloads Yii2 guide from GitHub, and rebuilds the FTS5 search index.
Guidelines & Editor Integration
Yii2 AI Boost comes with a rich library of "Context Anchors" in .ai/guidelines/. These are Markdown files that define exact structures for Yii2 components (Controllers, Models, Migrations, etc.), preventing AI hallucinations.
1. Active Search (MCP Tool)
The MCP server includes a semantic_search tool powered by SQLite FTS5. AI agents (like Claude or Gemini) can use this to "look up" how to do things in Yii2.
- User: "How do I create a migration?"
- AI: Calls
semantic_search(query="migration")-> Gets BM25-ranked sections -> Writes perfect code.
2. Passive Context (Editor Rules)
Run php yii boost/sync-rules to bake these guidelines directly into your editor's context.
- Cursor: Creates a
.mdcrule file. - Zed: Creates a
.rulesfile.
This means when you open a file in Zed or Cursor, the AI already knows it should use yii\web\Controller and not Illuminate\Routing\Controller.
What is MCP?
The Model Context Protocol (MCP) is an open standard that enables AI assistants to interact with tools and data sources. MCP allows Claude Code and other AI tools to securely access your application's context—database schemas, configuration, routes, and logs—without exposing sensitive data.
Yii2 AI Boost implements MCP v2025-11-25 using JSON-RPC 2.0 over STDIO transport. This means Claude Code communicates with your application through standard input/output, with no need for network configuration.
Available Tools
1. application_info - Application Info
Get comprehensive information about your Yii2 application:
- Yii2 and PHP versions
- Application environment and debug status
- Installed modules and extensions
2. database_schema - Database Schema
Inspect your database structure:
- List all tables with row counts
- View detailed table schemas (columns, types, constraints)
- Discover Active Record models
- View indexes and foreign keys
3. database_query - Database Query
Execute SQL queries against your database:
- Run SELECT queries with automatic row limiting
- Support for bound parameters
- Returns execution time and row count
- Works with any configured database connection
4. config_access - Config Access
Access application configuration safely:
- Component configurations
- Module configurations
- Application parameters (with sensitive data redaction)
5. route_inspector - Route Inspector
Analyze your application routes:
- URL rules and patterns
- Module routes with prefixes
- Controller and action mappings
- RESTful API endpoints
6. component_inspector - Component Inspector
Introspect application components:
- List all registered components
- View component classes and configurations
- Check singleton vs new instance behavior
- Inspect component properties
7. log_inspector - Log Inspector
Inspect application logs from all configured sources:
- Read logs from FileTarget (text files)
- Read logs from DbTarget (database table)
- Access in-memory logs (current request)
- Filter by log level (error, warning, info, trace, profile)
- Filter by category with wildcard patterns
- Search logs by keywords
- Filter by time range
- View stack traces (for in-memory logs)
8. semantic_search - Semantic Search (FTS5)
Search Yii2 guidelines and documentation with full-text search:
- BM25-ranked results using SQLite FTS5 (replaces grep-based search)
- Section-level results (relevant sections, not full files)
- Supports phrases ("active record"), boolean (migration AND database), prefix (migrat*)
- Indexes bundled guidelines + Yii2 definitive guide from GitHub
- Porter stemming ("migrating" matches "migration")
- Grep fallback if FTS5 index not built yet
9. model_inspector - Model Inspector
Inspect Active Record models at runtime:
- Attributes with database types, labels, and hints
- Relations (hasOne/hasMany) with link details and junction tables
- Attached behaviors with class names and properties
- Scenarios with active and safe attributes
- Fields and extra fields for API serialization
- Automatic model discovery from
@app/models
10. validation_rules - Validation Rules
Inspect model validation rules and constraints:
- All validation rules with parameters and scenario filters
- Built-in vs custom validator classification
- Error messages per validator grouped by attribute
- Constraint summary (required, unique, string length, number range, email, etc.)
- Safe attributes per scenario
- Supports filtering by specific scenario
11. console_command_inspector - Console Command Inspector
Discover and inspect Yii2 console commands (./yii commands):
- List all discoverable console controllers with class and description
- Inspect individual commands with actions, options, and help text
- Drill into specific actions for arguments, types, and defaults
- Discovers from controllerMap, namespace directory, and modules
- Option aliases and PHPDoc-based help extraction
12. migration_inspector - Migration Inspector
Inspect database migrations and their status:
- Status summary with applied/pending counts and last applied migration
- Applied migration history with timestamps (sorted most recent first)
- Pending migration discovery from configured migration paths
- View individual migration source code and apply status
- Supports
@app/migrationsand additional configured paths
13. widget_inspector - Widget Inspector
Discover and inspect Yii2 widgets:
- List available widgets grouped by source (framework core, grid, application)
- Inspect widget properties with types, defaults, and PHPDoc descriptions
- Public methods with parameter signatures and return types
- Event constants (EVENT_*) with declaring class
- Class hierarchy chain up to yii\base\Widget
- Short name resolution (e.g., "ActiveForm" resolves to yii\widgets\ActiveForm)
- Discovers widgets from @app/widgets/, @app/components/, and modules//widgets/ + modules//components/
- Note: Yii2 allows widgets anywhere in the codebase. Auto-discovery scans the directories above; widgets in other locations can still be inspected by passing the full class name (e.g.,
widget: "app\\custom\\MyWidget")
14. performance_profiler - Performance Profiler
Analyze query performance and index coverage:
- EXPLAIN query plans with driver-specific formatting (MySQL, PostgreSQL, SQLite)
- Automatic detection of full table scans, missing index usage, filesort, and temporary tables
- Per-table index analysis with foreign key column coverage
- Missing index detection for FK-like columns (*_id naming convention)
- Table statistics (row counts, data/index sizes for MySQL, scan counts for PostgreSQL)
- Overview mode with per-table summary and missing-index report across all tables
- Supports bound parameters for parameterized query analysis
15. tinker - Tinker
Execute arbitrary PHP code in the Yii2 application context:
- Run any PHP expression or statement with full access to
\Yii::$app - Automatic return value capture (tries expression first, falls back to statement)
- Output capture for
echo/printstatements - Configurable timeout (default 5s, max 30s)
- Dangerous function blocking (exit, die, shell_exec, system, exec, etc.)
- Return values formatted with
VarDumperfor objects - Output truncated at 100KB, sensitive data automatically redacted
16. env_inspector - Environment Inspector
Inspect environment variables, PHP extensions, and system configuration:
- Environment variables with automatic sensitive value redaction
- Prefix filter for environment variables (e.g., "DB", "APP")
- Loaded PHP extensions sorted alphabetically with count
- Key PHP configuration values (memorylimit, maxexecution_time, upload sizes, etc.)
- System info: OS, architecture (32/64-bit), working directory
- Configurable sections via
includeparameter
Core Tools Architecture
All 16 tools provide deep introspection into your Yii2 application. They follow a consistent architecture based on the BaseTool abstract class, which provides:
- Automatic Sanitization: Sensitive data (passwords, tokens, keys) is automatically redacted from all tool outputs
- Database Discovery: Tools automatically detect and access configured database connections
- JSON Schema Validation: Input parameters are validated against defined schemas
- Error Handling: Graceful error responses without exposing sensitive details
How the Log Inspector Works
The Log Inspector features a multi-reader architecture supporting three log storage methods:
| Reader | Source | Best For | Features | |--------|--------|----------|----------| | InMemoryLogReader | Current request logs (Yii::getLogger()->messages) | Real-time debugging during development | Full stack traces, microsecond timestamps | | FileLogReader | FileTarget text logs (@runtime/logs/app.log) | Reviewing logs from previous requests/sessions | Efficient file handling (5MB+ files), auto-detects rotation | | DbLogReader | DbTarget database table ({{%log}}) | Production logging & log aggregation | Fast indexed queries, precise time-range filtering |
Tools Roadmap
| Phase | Tool | Status | Description | |:-----:|------|--------|-------------| | 1 | applicationinfo | ✓ Complete | Yii2 version, environment, modules, extensions | | 1 | databaseschema | ✓ Complete | Tables, columns, indexes, models, foreign keys | | 1 | configaccess | ✓ Complete | Component, module, and parameter configurations | | 1 | routeinspector | ✓ Complete | URL rules, routes, REST endpoints | | 1 | componentinspector | ✓ Complete | Component listing, classes, configurations | | 1 | loginspector | ✓ Complete | File, database, and in-memory logs with filtering | | 1 | semanticsearch | ✓ Complete | FTS5-powered search over guidelines + Yii2 guide | | 1 | databasequery | ✓ Complete | Execute database queries (limited rows) | | 2 | modelinspector | ✓ Complete | Active Record model analysis, properties, relations | | 2 | validationrules | ✓ Complete | Model validation rules, error messages, constraints | | 2 | consolecommandinspector | ✓ Complete | Console command discovery, actions, options, arguments | | 3 | migrationinspector | ✓ Complete | Migration status, history, pending, source viewing | | 3 | widgetinspector | ✓ Complete | Available widgets, properties, methods, events, hierarchy | | 3 | performanceprofiler | ✓ Complete | EXPLAIN plans, index analysis, missing index detection | | 4 | tinker | ✓ Complete | Execute arbitrary PHP code in Yii2 application context | | 4 | envinspector | ✓ Complete | Environment variables, PHP extensions, system configuration | | 5 | semantic_search | ✓ Complete | SQLite FTS5 search over Yii2 guide + guidelines sourced from GitHub |
MCP Protocol
Yii2 AI Boost implements the Model Context Protocol (MCP) v2025-11-25:
- Transport: STDIO (local) - reads from stdin, writes to stdout
- Format: JSON-RPC 2.0
- Tools: Expose functionality to AI assistants
- Resources: Provide static content (guidelines, configuration)
Example JSON-RPC Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "application_info",
"arguments": {
"include": ["version", "environment", "modules"]
}
}
}
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"version": {
"yii2_version": "2.0.45",
"php_version": "8.1.2",
"php_sapi": "cli"
},
"environment": {
"yii_env": "dev",
"yii_debug": true,
"base_path": "/path/to/app",
"runtime_path": "/path/to/app/runtime"
},
"modules": {
"site": {
"class": "app\\modules\\site\\Module",
"basePath": "/path/to/app/modules/site"
}
}
}
}
Response Structure:
jsonrpc: Always"2.0"per JSON-RPC specid: Echoes the request ID for request/response matchingresult: The actual tool out
…
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: codeChap
- Source: codeChap/mcp-server-yii2-ai-boost
- License: BSD-3-Clause
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.