PHPackages                             ldkafka/yii3-mcp-server - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. ldkafka/yii3-mcp-server

ActiveLibrary[Framework](/categories/framework)

ldkafka/yii3-mcp-server
=======================

Model Context Protocol (MCP) server framework for Yii3 applications - enables AI assistants to interact with your app via custom tools

v1.0.6(5mo ago)014BSD-3-ClausePHPPHP ^8.1

Since Jan 14Pushed 5mo agoCompare

[ Source](https://github.com/ldkafka/yii3-mcp-server)[ Packagist](https://packagist.org/packages/ldkafka/yii3-mcp-server)[ Docs](https://github.com/ldkafka/yii3-mcp-server)[ RSS](/packages/ldkafka-yii3-mcp-server/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (7)Versions (2)Used By (0)

Yii3 MCP Server
===============

[](#yii3-mcp-server)

**Build AI-powered tools for your Yii3 application with Model Context Protocol**

[![License](https://camo.githubusercontent.com/6cb285b57819f8de0acfb34923298f4f569f962544e8fe35331da2d163f4e485/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d2d332d2d436c617573652d626c75652e737667)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/acffb6ae1962992d26e4466782832787e79504a6250f80d732c4283458b9f497/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d626c75652e737667)](https://www.php.net/)[![Yii Version](https://camo.githubusercontent.com/56cd8c93650e4ee5fe08fcd499375ea3b663db4a291012283cb8e3e4ae9b783c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7969692d332e782d627269676874677265656e2e737667)](https://www.yiiframework.com/)

A framework for building [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) servers in Yii3 applications. Enable AI assistants like GitHub Copilot to interact with your application through custom tools.

---

What is MCP?
------------

[](#what-is-mcp)

**Model Context Protocol** is an open protocol that enables AI assistants to interact with external tools and data sources. Think of it as an API for AI - instead of REST endpoints for humans, MCP provides a standardized way for AI to:

- Query your database
- Read project files
- Execute commands
- Analyze data
- Interact with your application

---

Features
--------

[](#features)

- **Framework, not an app** - Integrate into any Yii3 project
- **Tool-based architecture** - Build custom tools by implementing `McpToolInterface`
- **Simple API** - One interface (`McpToolInterface`) is all you need to create powerful AI tools
- **Type-safe** - Full PHP 8.1+ type declarations and PHPDoc
- **Production-ready** - Security patterns, error handling, validation
- **Easy integration** - Works with VS Code, Cursor, and other MCP clients
- **Well-documented** - Comprehensive guides and examples

Quick Start
-----------

[](#quick-start)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require ldkafka/yii3-mcp-server
```

### 2. Copy Configuration Templates

[](#2-copy-configuration-templates)

Configure based on your Yii3 app structure:

```
# For yiisoft/app template (uses config/console/ and config/common/di/):
cp vendor/ldkafka/yii3-mcp-server/config/commands.php config/console/commands.php
cp vendor/ldkafka/yii3-mcp-server/config/di/mcp-template.php config/common/di/mcp.php

# For custom Yii3 apps (uses config/ root level):
# cp vendor/ldkafka/yii3-mcp-server/config/commands.php config/commands.php
# cp vendor/ldkafka/yii3-mcp-server/config/di-console.php config/di-console.php
```

**Note**: The standard `yiisoft/app` template uses `config/console/` for console commands and `config/common/di/` for DI configuration.

Or manually edit `config/console/commands.php` (for yiisoft/app template):

```
use YiiMcp\McpServer\Command\McpCommand;

return [
    'hello' => Console\HelloCommand::class,
    'mcp:serve' => McpCommand::class, // Add this line
];
```

### 3. Configure DI Container

[](#3-configure-di-container)

Create `config/common/di/mcp.php` (for yiisoft/app template):

```
