PHPackages                             muxtorov98/yii2-mcp - 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. [API Development](/categories/api)
4. /
5. muxtorov98/yii2-mcp

ActiveYii2-extension[API Development](/categories/api)

muxtorov98/yii2-mcp
===================

Model Context Protocol (MCP) server integration for Yii2 applications.

v0.1.0(2mo ago)10MITPHPPHP ^8.1

Since Apr 6Pushed 2mo agoCompare

[ Source](https://github.com/Muxtorov98/yii2-mcp)[ Packagist](https://packagist.org/packages/muxtorov98/yii2-mcp)[ RSS](/packages/muxtorov98-yii2-mcp/feed)WikiDiscussions main Synced 1w ago

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

yii2-mcp
========

[](#yii2-mcp)

MCP server integration for Yii2 applications on PHP `8.1+`.

This package exposes Yii2 classes as MCP tools and MCP resources so AI agents can discover and call them through a standard JSON-RPC endpoint.

Package: `muxtorov98/yii2-mcp`

What This Package Does
----------------------

[](#what-this-package-does)

- exposes Yii2 classes as MCP `tools`
- exposes read-only content as MCP `resources`
- generates JSON Schema from PHP classes and Yii models
- supports Yii2 validation for tool input
- provides an HTTP MCP endpoint for AI clients

What This Package Does Not Do
-----------------------------

[](#what-this-package-does-not-do)

This package is an MCP server. It is not an LLM provider SDK.

That means:

- `yii2-mcp` does not choose OpenAI, Claude, Gemini, or any other model
- `yii2-mcp` does not send prompts to an LLM by itself
- the AI client chooses the model

Typical setup:

- `Yii2 + yii2-mcp` = MCP server
- `ChatGPT / Claude Desktop / Cursor / other agent` = MCP client
- model selection = inside the client

If you also want Yii2 itself to call an LLM, add a separate AI client component such as `OpenAiClient`, `AnthropicClient`, or your own adapter.

Requirements
------------

[](#requirements)

- PHP `^8.1`
- Yii2 `^2.0`
- `ext-json`

Install
-------

[](#install)

```
composer require muxtorov98/yii2-mcp
```

How It Works
------------

[](#how-it-works)

1. You create PHP classes and mark them with `#[McpTool]` or `#[McpResource]`.
2. The `mcp` component scans configured folders.
3. The package builds MCP metadata and input schemas.
4. AI clients connect to your `/mcp` endpoint.
5. The client lists tools/resources and calls them when needed.

Minimal Working Setup
---------------------

[](#minimal-working-setup)

### 1. Configure the `mcp` component

[](#1-configure-the-mcp-component)

Example for `common/config/main.php` or another shared config:

```
