laravel-mcp-server
A Laravel package for implementing secure Model Context Protocol servers using Streamable HTTP and SSE transport, providing real-time communication and a scalab
What is laravel-mcp-server?
A Laravel package for implementing secure Model Context Protocol servers using Streamable HTTP and SSE transport, providing real-time communication and a scalable tool system for enterprise environments.
Overview of laravel-mcp-server
What it is
Laravel MCP Server is a Laravel package for implementing secure Model Context Protocol servers using Streamable HTTP transport. It provides route-based MCP endpoint registration for Laravel and Lumen, enabling real-time communication and a scalable tool system for enterprise environments. The package is developed by OP.GG and is open source under the MIT license. It requires PHP >= 8.2 and Laravel (Illuminate) >= 9.x or Lumen >= 9.x.
Key features
- Route-first configuration using
Route::mcp(...)orMcpRoute::register(...) - Streamable HTTP transport (the only supported transport in v2.0.0)
- Tool, resource, resource template, and prompt registration per endpoint - Route cache compatible endpoint metadata - Dynamic tool filtering by query string via a resolver - Swagger/OpenAPI to MCP tool generation with
make:swagger-mcp-tool - Artisan commands for creating tools, resources, resource templates, prompts, and notifications - Export tools to OpenAPI with
mcp:export-openapi
Use cases
- Building secure MCP servers within Laravel or Lumen applications - Exposing dynamic tool sets based on incoming URL query parameters (e.g., game phase)
- Generating MCP tools and resources from existing OpenAPI specifications - Integrating with AI clients that support the Model Context Protocol for real-time communication
Getting started
Install via Composer: bash composer require opgginc/laravel-mcp-server Register an endpoint in Laravel: php use IlluminateSupportFacadesRoute; use OPGGLaravelMcpServerEnumsProtocolVersion; use OPGGLaravelMcpServerServicesToolServiceExamplesHelloWorldTool; use OPGGLaravelMcpServerServicesToolServiceExamplesVersionCheckTool; Route::mcp('/mcp') ->setServerInfo( name: 'OP.GG MCP Server', version: '2.0.0', ) ->setConfig( compactEnumExampleCount: 3, ) ->setProtocolVersion(ProtocolVersion::V2025_11_25) ->enabledApi() ->tools([ HelloWorldTool::class, VersionCheckTool::class, ]); Verify with: bash php artisan route:list | grep mcp php artisan mcp:test-tool --list --endpoint=/mcp For Lumen setup, see the repository README.
License and pricing
The package is open source under the MIT license. Pricing is not stated beyond the open source license.
Based on the project's public README and repository metadata.