Skip to content

Commit bcc3877

Browse files
CodeWithKyriangithub-actions[bot]
authored andcommitted
Update CHANGELOG
1 parent 7f02775 commit bcc3877

File tree

1 file changed

+102
-26
lines changed

1 file changed

+102
-26
lines changed

CHANGELOG.md

Lines changed: 102 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,86 @@
22

33
All notable changes to `php-mcp/laravel` will be documented in this file.
44

5+
## v2.0.0 - 2025-06-04
6+
7+
This release marks a **major overhaul**, bringing it into full alignment with `php-mcp/server` v2.1.0+ and introducing a significantly improved, more "Laravely" developer experience.
8+
9+
### Added
10+
11+
* **Fluent Manual Registration API:**
12+
* Introduced the `Mcp` Facade (`PhpMcp\Laravel\Facades\Mcp`).
13+
* Define Tools, Resources, Prompts, and Resource Templates fluently (e.g., `Mcp::tool(...)->description(...)`).
14+
* Definitions are typically placed in `routes/mcp.php` (configurable).
15+
* Handlers are resolved via Laravel's service container, allowing dependency injection.
16+
17+
* **Dedicated HTTP Server Transport via `mcp:serve`:**
18+
* The `php artisan mcp:serve --transport=http` command now launches a standalone, high-performance ReactPHP-based HTTP server using `\PhpMcp\Server\Transports\HttpServerTransport`.
19+
* Configuration for this dedicated server is in `config/mcp.php` under `transports.http_dedicated`.
20+
* CLI options (`--host`, `--port`, `--path-prefix`) can override config defaults.
21+
22+
* **`LaravelHttpTransport` for Integrated HTTP:**
23+
* New `PhpMcp\Laravel\Transports\LaravelHttpTransport` class implements `ServerTransportInterface` to bridge Laravel's HTTP request lifecycle with the core MCP `Protocol` handler.
24+
25+
* **Configurable Auto-Discovery:**
26+
* `config('mcp.discovery.auto_discover')` (default: `true`) now controls whether discovery runs automatically or not. You can set it to false in production..
27+
28+
* **Interactive Prompt for `mcp:serve`:** If `--transport` is not specified, the command now interactively prompts the user to choose between `stdio` and `http`.
29+
30+
### Changed
31+
32+
* **Core Server Integration:** Now uses `\PhpMcp\Server\Server::make()` (ServerBuilder) for all server instantiation, fully leveraging `php-mcp/server` v2.x architecture.
33+
* **Namespace:** Base package namespace changed from `PhpMcp\Laravel\Server` to **`PhpMcp\Laravel`**.
34+
* **Configuration (`config/mcp.php`):**
35+
* Significantly restructured and updated to align with `ServerBuilder` options.
36+
* Clearer separation of settings for `http_dedicated` vs. `http_integrated` transports.
37+
* Simplified cache TTL (`cache.ttl`) and discovery (`discovery.save_to_cache_on_discover`) keys.
38+
* Added `server.instructions` for the `initialize` MCP response.
39+
* Added `discovery.exclude_dirs` and `discovery.definitions_file`.
40+
41+
* **`McpServiceProvider`:**
42+
* Completely rewritten to correctly build and configure the `\PhpMcp\Server\Server` instance using Laravel's services for logging, caching (with fallback to core `FileCache`), container, and event loop.
43+
* Loads manual definitions from the configured `definitions_file` via `McpRegistrar`.
44+
* Sets up core `Registry` notifiers to dispatch Laravel events for list changes.
45+
46+
* **`McpController` (Integrated HTTP):** More robustly handles the integrated server behavior, working with a custom `LaravelHttpTransport`.
47+
* **Artisan Commands:**
48+
* `mcp:discover`: Now directly calls `Server::discover()` with configured/CLI parameters. `force` option behavior clarified.
49+
* `mcp:list`: Fetches elements from the live, fully configured `Registry` from the resolved `Server` instance.
50+
* `mcp:serve`: Refactored to use core `StdioServerTransport` or `HttpServerTransport` directly.
51+
52+
* **Dependency:** Updated `php-mcp/server` to `^2.2.0`
53+
54+
### Fixed
55+
56+
* More robust error handling and logging in Artisan commands and `McpController`.
57+
* Improved clarity and consistency in how core server components are resolved and used within the Laravel context.
58+
59+
### Removed
60+
61+
* `PhpMcp\Laravel\Server\Adapters\ConfigAdapter`: No longer needed due to changes in `php-mcp/server` v2.x.
62+
63+
### BREAKING CHANGES
64+
65+
* **Namespace Change:** The primary package namespace has changed from `PhpMcp\Laravel\Server` to `PhpMcp\Laravel`. Update all `use` statements and FQCN references in your application. You may have to uninstall and reinstall the package to avoid conflicts.
66+
* **Configuration File:** The `config/mcp.php` file has been significantly restructured. You **must** republish and merge your customizations:
67+
```bash
68+
php artisan vendor:publish --provider="PhpMcp\Laravel\McpServiceProvider" --tag="mcp-config" --force
69+
70+
```
71+
* **`mcp:serve` for HTTP:** The `--transport=http` option for `mcp:serve` now launches a *dedicated* ReactPHP-based server process. For serving MCP via your main Laravel application routes, ensure the `http_integrated` transport is enabled in `config/mcp.php` and your web server is configured appropriately.
72+
* **Event Handling:** If you were directly listening to internal events from the previous version, these may have changed. Rely on the documented Laravel events (`ToolsListChanged`, etc.).
73+
* **Removed Classes:** `PhpMcp\Laravel\Server\Adapters\ConfigAdapter` is removed.
74+
75+
**Full Changelog**: https://github.com/php-mcp/laravel/compare/1.1.1...2.0.0
76+
577
## v1.1.1 - 2025-05-12
678

779
### What's Changed
80+
881
* McpServiceProvider File And loadElements function are not found by @tsztodd in https://github.com/php-mcp/laravel/pull/2
982

1083
### New Contributors
84+
1185
* @tsztodd made their first contribution in https://github.com/php-mcp/laravel/pull/2
1286

1387
**Full Changelog**: https://github.com/php-mcp/laravel/compare/1.1.0...1.1.1
@@ -18,13 +92,13 @@ This release updates the package for compatibility with `php-mcp/server` v1.1.0.
1892

1993
### What Changed
2094

21-
* Updated dependency requirement to `php-mcp/server: ^1.1.0`.
22-
* Modified `McpServiceProvider` to correctly provide `ConfigurationRepositoryInterface`, `LoggerInterface`, and `CacheInterface` bindings to the underlying `Server` instance when resolved from the Laravel container.
23-
* Updated `ServeCommand` and `McpController` to inject the `Server` instance and instantiate `TransportHandler` classes according to `php-mcp/server` v1.1.0 constructor changes.
95+
* Updated dependency requirement to `php-mcp/server: ^1.1.0`.
96+
* Modified `McpServiceProvider` to correctly provide `ConfigurationRepositoryInterface`, `LoggerInterface`, and `CacheInterface` bindings to the underlying `Server` instance when resolved from the Laravel container.
97+
* Updated `ServeCommand` and `McpController` to inject the `Server` instance and instantiate `TransportHandler` classes according to `php-mcp/server` v1.1.0 constructor changes.
2498

2599
### Fixed
26100

27-
* Ensures compatibility with the refactored dependency injection and transport handler instantiation logic in `php-mcp/server` v1.1.0.
101+
* Ensures compatibility with the refactored dependency injection and transport handler instantiation logic in `php-mcp/server` v1.1.0.
28102

29103
**Full Changelog**: https://github.com/php-mcp/laravel/compare/1.0.0...1.1.0
30104

@@ -36,14 +110,14 @@ Welcome to the first release of `php-mcp/laravel`! This package provides seamles
36110

37111
## Key Features
38112

39-
* **Effortless Integration:** Automatically wires up Laravel's Cache, Logger, and Service Container for use by the MCP server.
40-
* **Attribute-Based Definition:** Define MCP tools, resources, and prompts using PHP attributes (`#[McpTool]`, `#[McpResource]`, etc.) within your Laravel application structure. Leverage Laravel's Dependency Injection within your MCP element classes.
41-
* **Configuration:** Provides a publishable configuration file (`config/mcp.php`) for fine-grained control over discovery, transports, caching, and capabilities.
42-
* **Artisan Commands:** Includes commands for element discovery (`mcp:discover`), listing discovered elements (`mcp:list`), and running the server via stdio (`mcp:serve`).
43-
* **HTTP+SSE Transport:** Sets up routes (`/mcp/message`, `/mcp/sse` by default) and a controller for handling MCP communication over HTTP, enabling browser-based clients and other HTTP consumers.
44-
* **Automatic Discovery (Dev):** Automatically discovers MCP elements in development environments on first use, improving developer experience (no need to manually run `mcp:discover` after changes).
45-
* **Manual Discovery (Prod):** Requires manual discovery (`mcp:discover`) for production environments, ensuring optimal performance via caching (integrates well with deployment workflows).
46-
* **Event Integration:** Dispatches Laravel events (`ToolsListChanged`, `ResourcesListChanged`, `PromptsListChanged`) when element lists change, allowing for custom integrations or notifications.
113+
* **Effortless Integration:** Automatically wires up Laravel's Cache, Logger, and Service Container for use by the MCP server.
114+
* **Attribute-Based Definition:** Define MCP tools, resources, and prompts using PHP attributes (`#[McpTool]`, `#[McpResource]`, etc.) within your Laravel application structure. Leverage Laravel's Dependency Injection within your MCP element classes.
115+
* **Configuration:** Provides a publishable configuration file (`config/mcp.php`) for fine-grained control over discovery, transports, caching, and capabilities.
116+
* **Artisan Commands:** Includes commands for element discovery (`mcp:discover`), listing discovered elements (`mcp:list`), and running the server via stdio (`mcp:serve`).
117+
* **HTTP+SSE Transport:** Sets up routes (`/mcp/message`, `/mcp/sse` by default) and a controller for handling MCP communication over HTTP, enabling browser-based clients and other HTTP consumers.
118+
* **Automatic Discovery (Dev):** Automatically discovers MCP elements in development environments on first use, improving developer experience (no need to manually run `mcp:discover` after changes).
119+
* **Manual Discovery (Prod):** Requires manual discovery (`mcp:discover`) for production environments, ensuring optimal performance via caching (integrates well with deployment workflows).
120+
* **Event Integration:** Dispatches Laravel events (`ToolsListChanged`, `ResourcesListChanged`, `PromptsListChanged`) when element lists change, allowing for custom integrations or notifications.
47121

48122
## Installation
49123

@@ -55,27 +129,29 @@ composer require php-mcp/laravel
55129
56130
# 2. Publish the configuration file (optional but recommended)
57131
php artisan vendor:publish --provider="PhpMcp\Laravel\Server\McpServiceProvider" --tag="mcp-config"
58-
```
59132
133+
```
60134
## Getting Started
61135

62-
1. **Define Elements:** Create PHP classes with methods annotated with `#[McpTool]`, `#[McpResource]`, etc., within directories specified in `config/mcp.php` (e.g., `app/Mcp`). Inject dependencies as needed. See [Defining MCP Elements](https://github.com/php-mcp/laravel/blob/main/README.md#defining-mcp-elements).
63-
2. **Discovery:**
64-
* In development, discovery runs automatically when needed.
65-
* In production, run `php artisan mcp:discover` during your deployment process. See [Automatic Discovery vs. Manual Discovery](https://github.com/php-mcp/laravel/blob/main/README.md#automatic-discovery-development-vs-manual-discovery-production).
66-
3. **Run the Server:**
67-
* For **Stdio Transport:** Use `php artisan mcp:serve` and configure your client to execute this command (using the full path to `artisan`).
68-
* For **HTTP+SSE Transport:** Ensure `transports.http.enabled` is true, run your Laravel app on a suitable web server (Nginx+FPM, Octane, etc. - **not** `php artisan serve`), exclude the MCP route from CSRF protection, and configure your client with the SSE URL (e.g., `http://your-app.test/mcp/sse`). See [Running the Server](https://github.com/php-mcp/laravel/blob/main/README.md#running-the-server) for critical details.
136+
1. **Define Elements:** Create PHP classes with methods annotated with `#[McpTool]`, `#[McpResource]`, etc., within directories specified in `config/mcp.php` (e.g., `app/Mcp`). Inject dependencies as needed. See [Defining MCP Elements](https://github.com/php-mcp/laravel/blob/main/README.md#defining-mcp-elements).
137+
2. **Discovery:**
138+
* In development, discovery runs automatically when needed.
139+
* In production, run `php artisan mcp:discover` during your deployment process. See [Automatic Discovery vs. Manual Discovery](https://github.com/php-mcp/laravel/blob/main/README.md#automatic-discovery-development-vs-manual-discovery-production).
140+
141+
3. **Run the Server:**
142+
* For **Stdio Transport:** Use `php artisan mcp:serve` and configure your client to execute this command (using the full path to `artisan`).
143+
* For **HTTP+SSE Transport:** Ensure `transports.http.enabled` is true, run your Laravel app on a suitable web server (Nginx+FPM, Octane, etc. - **not** `php artisan serve`), exclude the MCP route from CSRF protection, and configure your client with the SSE URL (e.g., `http://your-app.test/mcp/sse`). See [Running the Server](https://github.com/php-mcp/laravel/blob/main/README.md#running-the-server) for critical details.
144+
69145

70146
## Important Notes
71147

72-
* **HTTP Transport Server Requirement:** The standard `php artisan serve` development server is **not suitable** for the HTTP+SSE transport due to its single-process nature. Use a proper web server setup like Nginx/Apache + PHP-FPM or Laravel Octane.
73-
* **CSRF Exclusion:** If using the default `web` middleware group for the HTTP transport, you **must** exclude the MCP message route (default: `mcp` or `mcp/*`) from CSRF protection in your application to avoid `419` errors.
74-
* **Dependencies:** Requires PHP >= 8.1 and Laravel >= 10.0.
148+
* **HTTP Transport Server Requirement:** The standard `php artisan serve` development server is **not suitable** for the HTTP+SSE transport due to its single-process nature. Use a proper web server setup like Nginx/Apache + PHP-FPM or Laravel Octane.
149+
* **CSRF Exclusion:** If using the default `web` middleware group for the HTTP transport, you **must** exclude the MCP message route (default: `mcp` or `mcp/*`) from CSRF protection in your application to avoid `419` errors.
150+
* **Dependencies:** Requires PHP >= 8.1 and Laravel >= 10.0.
75151

76152
## Links
77153

78-
* **GitHub Repository:** https://github.com/php-mcp/laravel
79-
* **Packagist:** https://packagist.org/packages/php-mcp/laravel
154+
* **GitHub Repository:** https://github.com/php-mcp/laravel
155+
* **Packagist:** https://packagist.org/packages/php-mcp/laravel
80156

81-
Please report any issues or provide feedback on the GitHub repository.
157+
Please report any issues or provide feedback on the GitHub repository.

0 commit comments

Comments
 (0)