Get the FREE Ultimate OpenClaw Setup Guide →

yii2

A Model Context Protocol (MCP) server for Yii2 framework, providing database schema inspection, console command execution, and project management tools for Claude Code.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio artmin96-yii2-mcp-server node /path/to/yii2-mcp-server/dist/index.js

How to use

This Yii2 MCP Server provides a comprehensive set of tools to inspect and manage a Yii2 application. It exposes database utilities for listing and describing tables, analyzing indexes and relationships, and safely executing queries, along with advanced diagnostics for performance and optimization. In addition, it offers Yii2 console command tools, model and project analysis capabilities, module-level insights, asset and widget analysis, migration management, code generation helpers, and various caching, RBAC, queue, logging, and testing utilities. Once configured, you can invoke these capabilities through Claude Code to inspect your project, optimize database performance, manage migrations, generate code scaffolds, and monitor application health. The server is designed to auto-detect your Yii2 project structure and configuration, allowing you to focus on development rather than manual tooling integration.

How to install

Prerequisites:

  • Node.js and npm installed on your system
  • Access to Claude Code integration (as described in the README)
  • A Yii2 project to connect to

Option 1: NPM Install (Recommended)

npm install -g yii2-mcp-server

Then configure Claude Code from your Yii2 project directory:

cd /path/to/your/yii2/project
claude mcp add yii2 yii2-mcp-server

Option 2: Manual Installation

  1. Clone and install
git clone https://github.com/ArtMin96/yii2-mcp-server.git
cd yii2-mcp-server
npm install
npm run build
  1. Configure Claude Code

Using Claude CLI:

cd /path/to/your/yii2/project
claude mcp add yii2 node /path/to/yii2-mcp-server/dist/index.js

Manual JSON Configuration:

{
  "mcpServers": {
    "yii2": {
      "command": "node",
      "args": ["/path/to/yii2-mcp-server/dist/index.js"],
      "cwd": "/path/to/your/yii2/project"
    }
  }
}

Additional notes

Tips and considerations:

  • The MCP server auto-detects Yii2 project configuration by scanning common directories such as modules/, models/, and config/ while running from the project root that contains the yii console script.
  • Environment variables (for database and environment configuration) can be supplied via a .env file or the project’s config/db.php as described in the README. Common vars include DB_HOST, DB_DATABASE, DB_USER, DB_PASSWORD, and DB_PORT.
  • For sensitive operations (like executing console commands or performing migrations), ensure proper access controls and that Claude Code users have appropriate permissions.
  • When using database tools, you can target specific tables or queries; use db_list_tables, db_describe_table, db_table_relationships, db_execute_query, and the advanced tools (db_index_suggestions, db_query_profiler, etc.) to optimize and analyze performance.
  • If you ever change the server path or project path, update the mcp configuration accordingly to ensure Claude Code can locate the index.js and the project root.

Related MCP Servers

Sponsor this space

Reach thousands of developers