- What is Laravel MCP used for?
- Laravel MCP is for rapidly building Model Context Protocol servers inside Laravel applications so AI clients can interact with your app through a standardized protocol. It is aimed at AI agent integration, interactive tools, and multi-modal data exposure rather than traditional REST or gRPC APIs. It leans on Laravel routing, the service container, and Eloquent to expose domain models as MCP tools with minimal boilerplate.
- How do I install Laravel MCP?
- Install it as a Composer package with composer require laravel/mcp, then follow the official Laravel MCP documentation to register the service provider, routes, and your MCP servers or tools. The package is designed around Laravel conventions, so configuration and tool registration live in your application rather than in a separate service. Check the installed version and pin it explicitly because the package is still pre-1.0.
- Which PHP and Laravel versions does Laravel MCP support?
- Laravel MCP requires PHP 8.2 or newer; PHP 8.1 support was dropped in v0.5.4. It is designed for Laravel 10 and 11, with Laravel 13 support noted as added in v0.5.4, and you should confirm the exact matrix for your pinned release. Treat v0.9.x as the current line rather than older v0.5.x behaviour references.
- How do I expose an Eloquent model as an MCP tool?
- Laravel MCP can auto-convert Eloquent models into MCP tools, including relationships such as hasMany and belongsTo. You register the model or tool through the package's MCP route and tool setup, then an AI client can call it through the protocol. Expect to add MCP-specific error handling for cases like ModelNotFound exceptions so clients get structured errors instead of raw failures.
- Does Laravel MCP support OAuth and secure client authentication?
- Yes, Laravel MCP includes an OAuth2 layer with session management and structured error handling for AI client authentication. As of v0.9.6, loopback redirect URIs for native and CLI clients are validated by parsed host, hardening RFC 8252 loopback flows against prefix or parse-bypass misconfigurations. You still need to govern client registration policy and redirect allowlists on your side.
- What transports can a Laravel MCP server use?
- Laravel MCP supports transport layers including HTTP, WebSocket, and STDIO, which lets you target browser-based and CLI AI agents differently. HTTP fits web-facing integrations, while STDIO is common for local CLI clients. Choose the transport based on your client type and deployment model, and test session handling for that transport.
- How do I test a Laravel MCP server?
- Test the underlying Laravel actions and Eloquent behaviour with your normal PHPUnit or Pest tests, then exercise the registered MCP routes with Laravel's HTTP testing utilities or an MCP-compliant client. Pay attention to MCP-specific route registration, session headers such as MCP-Session-Id, and structured error responses. Because MCP is not RESTful, do not assume your existing REST route tests will cover it.
- Is Laravel MCP ready for production?
- It can be deployed, but it is pre-1.0 on the 0.9.x line, so pin an exact version and review changelogs before minor upgrades. Production concerns include correct session and MCP-Session-Id handling, OAuth client registration and redirect allowlisting, and client compatibility with recent MCP specifications. v0.9.6 improved deployability by hardening loopback redirect validation and fixing embedded app sizing, but residual security policy remains your responsibility.
- What changed in Laravel MCP v0.9.6?
- v0.9.6 includes two low-blast-radius changes: MCP App body measurement for size notifications so embedded UI resources report actual body height and the host can shrink or grow the iframe, and loopback redirect URI validation by parsed host for OAuth native and CLI flows. Neither change is announced as breaking or deprecated. The net effect is a more deployable package, and teams should treat v0.9.x as the current line.
- Can I use Laravel MCP alongside an existing REST API?
- Yes, but MCP is not backward-compatible with REST or gRPC, so you will register MCP-specific routes alongside your existing API rather than reusing REST routes directly. This makes MCP suitable for AI agent access while your REST API continues to serve traditional clients. If you only need conventional APIs, MCP is likely overkill; for AI-specific integrations it offers Laravel-native tool exposure that custom JSON-RPC servers would have to rebuild.