PHPackages                             leady/laravel-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. leady/laravel-mcp-server

ActiveLibrary

leady/laravel-mcp-server
========================

This is my package laravel-mcp-server

1.3.7(11mo ago)05MITPHPPHP ^8.2

Since May 23Pushed 11mo agoCompare

[ Source](https://github.com/Yz-Leady/laravel-mcp-server)[ Packagist](https://packagist.org/packages/leady/laravel-mcp-server)[ Docs](https://github.com/opgginc/laravel-mcp-server)[ RSS](/packages/leady-laravel-mcp-server/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)DependenciesVersions (7)Used By (0)

Laravel MCP Server by OP.GG
===========================

[](#laravel-mcp-server-by-opgg)

 A powerful Laravel package to build a Model Context Protocol Server seamlessly

[![Build Status](https://github.com/opgginc/laravel-mcp-server/actions/workflows/tests.yml/badge.svg)](https://github.com/opgginc/laravel-mcp-server/actions)[![Total Downloads](https://camo.githubusercontent.com/038632a1212e4ec60f77e9adafc97e808666937e7455d825d9eb98ecae80234c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f706767696e632f6c61726176656c2d6d63702d736572766572)](https://packagist.org/packages/opgginc/laravel-mcp-server)[![Latest Stable Version](https://camo.githubusercontent.com/343348be789df6c41bc0824a3646900850d1438e06cbb5573e25dd5528b09772/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f706767696e632f6c61726176656c2d6d63702d736572766572)](https://packagist.org/packages/opgginc/laravel-mcp-server)[![License](https://camo.githubusercontent.com/712385ebb07b2b6700d954992de65068ae705f5c88aeab217a690582cbb5ae94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f706767696e632f6c61726176656c2d6d63702d736572766572)](https://packagist.org/packages/opgginc/laravel-mcp-server)

[Official Website](https://op.gg/open-source/laravel-mcp-server)

 [English](README.md) | [Português do Brasil](README.pt-BR.md) | [한국어](README.ko.md) | [Русский](README.ru.md) | [简体中文](README.zh-CN.md) | [繁體中文](README.zh-TW.md) | [Polski](README.pl.md) | [Español](README.es.md)

 [![Laravel MCP Server Demo](docs/watch.gif)](docs/watch.gif)

⚠️ Version Information &amp; Breaking Changes
---------------------------------------------

[](#️-version-information--breaking-changes)

### v1.3.0 Changes (Current)

[](#v130-changes-current)

Version 1.3.0 introduces improvements to the `ToolInterface` for better communication control:

**New Features:**

- Added `isStreaming(): bool` method for clearer communication pattern selection
- Improved migration tools supporting upgrades from v1.1.x, v1.2.x to v1.3.0
- Enhanced stub files with comprehensive v1.3.0 documentation

**Deprecated Features:**

- `messageType(): ProcessMessageType` method is now deprecated (will be removed in v2.0.0)
- Use `isStreaming(): bool` instead for better clarity and simplicity

### Breaking Changes in v1.1.0

[](#breaking-changes-in-v110)

Version 1.1.0 introduced a significant and breaking change to the `ToolInterface`. If you are upgrading from v1.0.x, you **must** update your tool implementations to conform to the new interface.

**Key Changes in `ToolInterface`:**

The `OPGG\LaravelMcpServer\Services\ToolService\ToolInterface` has been updated as follows:

1. **New Method Added:**

    - `messageType(): ProcessMessageType`
        - This method is crucial for the new HTTP stream support and determines the type of message being processed.
2. **Method Renames:**

    - `getName()` is now `name()`
    - `getDescription()` is now `description()`
    - `getInputSchema()` is now `inputSchema()`
    - `getAnnotations()` is now `annotations()`

**How to Update Your Tools:**

### Automated Tool Migration for v1.1.0

[](#automated-tool-migration-for-v110)

To assist with the transition to the new `ToolInterface` introduced in v1.1.0, we've included an Artisan command that can help automate the refactoring of your existing tools:

```
php artisan mcp:migrate-tools {path?}
```

**What it does:**

This command will scan PHP files in the specified directory (defaults to `app/MCP/Tools/`) and attempt to:

1. **Identify old tools:** It looks for classes implementing the `ToolInterface` with the old method signatures.
2. **Create Backups:** Before making any changes, it will create a backup of your original tool file with a `.backup` extension (e.g., `YourTool.php.backup`). If a backup file already exists, the original file will be skipped to prevent accidental data loss.
3. **Refactor the Tool:**
    - Rename methods:
        - `getName()` to `name()`
        - `getDescription()` to `description()`
        - `getInputSchema()` to `inputSchema()`
        - `getAnnotations()` to `annotations()`
    - Add the new `messageType()` method, which will default to returning `ProcessMessageType::SSE`.
    - Ensure the `use OPGG\LaravelMcpServer\Enums\ProcessMessageType;` statement is present.

**Usage:**

After updating the `opgginc/laravel-mcp-server` package to v1.1.0 or later, if you have existing tools written for v1.0.x, it is highly recommended to run this command:

```
php artisan mcp:migrate-tools
```

If your tools are located in a directory other than `app/MCP/Tools/`, you can specify the path:

```
php artisan mcp:migrate-tools path/to/your/tools
```

The command will output its progress, indicating which files are being processed, backed up, and migrated. Always review the changes made by the tool. While it aims to be accurate, complex or unusually formatted tool files might require manual adjustments.

This tool should significantly ease the migration process and help you adapt to the new interface structure quickly.

### Manual Migration

[](#manual-migration)

If you prefer to migrate your tools manually, here's a comparison to help you adapt your existing tools:

**v1.0.x `ToolInterface`:**

```
