v2.0.0
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.
Added
- Fluent Manual Registration API:
- Introduced the
McpFacade (PhpMcp\Laravel\Facades\Mcp). - Define Tools, Resources, Prompts, and Resource Templates fluently (e.g.,
Mcp::tool(...)->description(...)). - Definitions are typically placed in
routes/mcp.php(configurable). - Handlers are resolved via Laravel's service container, allowing dependency injection.
- Introduced the
- Dedicated HTTP Server Transport via
mcp:serve:- The
php artisan mcp:serve --transport=httpcommand now launches a standalone, high-performance ReactPHP-based HTTP server using\PhpMcp\Server\Transports\HttpServerTransport. - Configuration for this dedicated server is in
config/mcp.phpundertransports.http_dedicated. - CLI options (
--host,--port,--path-prefix) can override config defaults.
- The
LaravelHttpTransportfor Integrated HTTP:- New
PhpMcp\Laravel\Transports\LaravelHttpTransportclass implementsServerTransportInterfaceto bridge Laravel's HTTP request lifecycle with the core MCPProtocolhandler.
- New
- Configurable Auto-Discovery:
config('mcp.discovery.auto_discover')(default:true) now controls whether discovery runs automatically or not. You can set it to false in production..
- Interactive Prompt for
mcp:serve: If--transportis not specified, the command now interactively prompts the user to choose betweenstdioandhttp.
Changed
- Core Server Integration: Now uses
\PhpMcp\Server\Server::make()(ServerBuilder) for all server instantiation, fully leveragingphp-mcp/serverv2.x architecture. - Namespace: Base package namespace changed from
PhpMcp\Laravel\ServertoPhpMcp\Laravel. - Configuration (
config/mcp.php):- Significantly restructured and updated to align with
ServerBuilderoptions. - Clearer separation of settings for
http_dedicatedvs.http_integratedtransports. - Simplified cache TTL (
cache.ttl) and discovery (discovery.save_to_cache_on_discover) keys. - Added
server.instructionsfor theinitializeMCP response. - Added
discovery.exclude_dirsanddiscovery.definitions_file.
- Significantly restructured and updated to align with
McpServiceProvider:- Completely rewritten to correctly build and configure the
\PhpMcp\Server\Serverinstance using Laravel's services for logging, caching (with fallback to coreFileCache), container, and event loop. - Loads manual definitions from the configured
definitions_fileviaMcpRegistrar. - Sets up core
Registrynotifiers to dispatch Laravel events for list changes.
- Completely rewritten to correctly build and configure the
McpController(Integrated HTTP): More robustly handles the integrated server behavior, working with a customLaravelHttpTransport.- Artisan Commands:
mcp:discover: Now directly callsServer::discover()with configured/CLI parameters.forceoption behavior clarified.mcp:list: Fetches elements from the live, fully configuredRegistryfrom the resolvedServerinstance.mcp:serve: Refactored to use coreStdioServerTransportorHttpServerTransportdirectly.
- Dependency: Updated
php-mcp/serverto^2.2.0
Fixed
- More robust error handling and logging in Artisan commands and
McpController. - Improved clarity and consistency in how core server components are resolved and used within the Laravel context.
Removed
PhpMcp\Laravel\Server\Adapters\ConfigAdapter: No longer needed due to changes inphp-mcp/serverv2.x.
BREAKING CHANGES
- Namespace Change: The primary package namespace has changed from
PhpMcp\Laravel\ServertoPhpMcp\Laravel. Update allusestatements and FQCN references in your application. You may have to uninstall and reinstall the package to avoid conflicts. - Configuration File: The
config/mcp.phpfile has been significantly restructured. You must republish and merge your customizations:php artisan vendor:publish --provider="PhpMcp\Laravel\McpServiceProvider" --tag="mcp-config" --force
mcp:servefor HTTP: The--transport=httpoption formcp:servenow launches a dedicated ReactPHP-based server process. For serving MCP via your main Laravel application routes, ensure thehttp_integratedtransport is enabled inconfig/mcp.phpand your web server is configured appropriately.- 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.). - Removed Classes:
PhpMcp\Laravel\Server\Adapters\ConfigAdapteris removed.
Full Changelog: 1.1.1...2.0.0