From deff7341ca8d7d458595123f8ebaf1040c4f2c20 Mon Sep 17 00:00:00 2001 From: Sangrak Choi Date: Sun, 12 Oct 2025 05:51:38 +0900 Subject: [PATCH] Expand Lumen support --- README.md | 4 ++-- composer.json | 4 ++-- src/LaravelMcpServerServiceProvider.php | 2 +- tests/Lumen/TestCase.php | 4 ++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b49e6d7..f717a0a 100644 --- a/README.md +++ b/README.md @@ -270,7 +270,7 @@ The MCP protocol also defines a "Streamable HTTP SSE" mode, but this package doe ## Requirements - PHP >=8.2 -- Laravel >=10.x or Lumen >=11.x +- Laravel >=10.x or Lumen >=9.x ## Installation @@ -287,7 +287,7 @@ The MCP protocol also defines a "Streamable HTTP SSE" mode, but this package doe ### Lumen Setup -The package also supports Lumen 11.x applications. After installing the dependency via Composer: +The package also supports Lumen 9.x and newer applications. After installing the dependency via Composer: 1. Enable the optional helpers you need inside `bootstrap/app.php`: ```php diff --git a/composer.json b/composer.json index 0710302..e6632ea 100644 --- a/composer.json +++ b/composer.json @@ -11,11 +11,11 @@ "require": { "php": "^8.2", "spatie/laravel-package-tools": "^1.16", - "illuminate/contracts": "^10.0||^11.0||^12.0" + "illuminate/contracts": "^9.0||^10.0||^11.0||^12.0" }, "require-dev": { "laravel/pint": "^1.14", - "laravel/lumen-framework": "^11.0", + "laravel/lumen-framework": "^9.0||^10.0||^11.0", "nunomaduro/collision": "^8.1.1||^7.10.0", "larastan/larastan": "^2.9||^3.0", "orchestra/testbench": "^9.0.0||^8.22.0", diff --git a/src/LaravelMcpServerServiceProvider.php b/src/LaravelMcpServerServiceProvider.php index 6cbde19..0725874 100644 --- a/src/LaravelMcpServerServiceProvider.php +++ b/src/LaravelMcpServerServiceProvider.php @@ -76,7 +76,7 @@ protected function registerRoutes(): void } // Skip route registration if MCPServer instance doesn't exist - if (! app()->has(MCPServer::class)) { + if (! $this->app->bound(MCPServer::class)) { return; } diff --git a/tests/Lumen/TestCase.php b/tests/Lumen/TestCase.php index bfdeea4..2b95b58 100644 --- a/tests/Lumen/TestCase.php +++ b/tests/Lumen/TestCase.php @@ -16,6 +16,10 @@ protected function setUp(): void { parent::setUp(); + if (! class_exists(\Laravel\Lumen\Application::class)) { + $this->markTestSkipped('Laravel Lumen is not installed.'); + } + $this->app = new TestingApplication($this->basePath()); $this->app->instance('path.config', $this->basePath('config')); $this->app->instance('config', new ConfigRepository);