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
Mcp
Facade (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=http
command now launches a standalone, high-performance ReactPHP-based HTTP server using\PhpMcp\Server\Transports\HttpServerTransport
. - Configuration for this dedicated server is in
config/mcp.php
undertransports.http_dedicated
. - CLI options (
--host
,--port
,--path-prefix
) can override config defaults.
- The
LaravelHttpTransport
for Integrated HTTP:- New
PhpMcp\Laravel\Transports\LaravelHttpTransport
class implementsServerTransportInterface
to bridge Laravel's HTTP request lifecycle with the core MCPProtocol
handler.
- 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--transport
is not specified, the command now interactively prompts the user to choose betweenstdio
andhttp
.
Changed
- Core Server Integration: Now uses
\PhpMcp\Server\Server::make()
(ServerBuilder) for all server instantiation, fully leveragingphp-mcp/server
v2.x architecture. - Namespace: Base package namespace changed from
PhpMcp\Laravel\Server
toPhpMcp\Laravel
. - Configuration (
config/mcp.php
):- Significantly restructured and updated to align with
ServerBuilder
options. - Clearer separation of settings for
http_dedicated
vs.http_integrated
transports. - Simplified cache TTL (
cache.ttl
) and discovery (discovery.save_to_cache_on_discover
) keys. - Added
server.instructions
for theinitialize
MCP response. - Added
discovery.exclude_dirs
anddiscovery.definitions_file
.
- Significantly restructured and updated to align with
McpServiceProvider
:- Completely rewritten to correctly build and configure the
\PhpMcp\Server\Server
instance using Laravel's services for logging, caching (with fallback to coreFileCache
), container, and event loop. - Loads manual definitions from the configured
definitions_file
viaMcpRegistrar
. - Sets up core
Registry
notifiers 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.force
option behavior clarified.mcp:list
: Fetches elements from the live, fully configuredRegistry
from the resolvedServer
instance.mcp:serve
: Refactored to use coreStdioServerTransport
orHttpServerTransport
directly.
- Dependency: Updated
php-mcp/server
to^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/server
v2.x.
BREAKING CHANGES
- Namespace Change: The primary package namespace has changed from
PhpMcp\Laravel\Server
toPhpMcp\Laravel
. Update alluse
statements and FQCN references in your application. You may have to uninstall and reinstall the package to avoid conflicts. - Configuration File: The
config/mcp.php
file has been significantly restructured. You must republish and merge your customizations:php artisan vendor:publish --provider="PhpMcp\Laravel\McpServiceProvider" --tag="mcp-config" --force
mcp:serve
for HTTP: The--transport=http
option formcp:serve
now launches a dedicated ReactPHP-based server process. For serving MCP via your main Laravel application routes, ensure thehttp_integrated
transport is enabled inconfig/mcp.php
and 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\ConfigAdapter
is removed.
Full Changelog: 1.1.1...2.0.0