PHP MCP Server for Laravel is an MCP server that exposes Laravel application functionality as standardized Model Context Protocol tools, resources, resource templates, and prompts. It connects Laravel applications to AI clients such as Anthropic Claude, Cursor IDE, and OpenAI ChatGPT. Backend developers and Laravel engineers use this SDK to bridge existing PHP business logic, database queries, and internal services directly into AI interfaces without writing external glue code. The package provides native integration with Laravel service containers, database configurations, caching layers, sessions, and Artisan console utilities. Developers can define server capabilities either manually using a fluent Facade in dedicated route files or declaratively using PHP 8 attributes. The SDK supports multiple transport mechanisms including STDIO for local execution, integrated HTTP routes, and standalone ReactPHP servers, enabling secure agentic workflows across local developer environments and production Laravel infrastructure.
Category: AI & LLM Tooling
Tags: backend, framework, laravel, php
Visit PHP MCP Server for Laravel
bash composer require php-mcp/laravel:^3.0 -W 2. Publish the configuration file: bash php artisan vendor:publish --provider="PhpMcp\Laravel\McpServiceProvider" --tag="mcp-config" 3. If using database sessions, publish migrations and run them: bash php artisan vendor:publish --provider="PhpMcp\Laravel\McpServiceProvider" --tag="mcp-migrations" php artisan migrate 4. Discover your tools and prompts: bash php artisan mcp:discover 5. Configure your MCP client (such as Cursor IDE) using the STDIO transport: json { "mcpServers": { "my-laravel-app": { "command": "php", "args": ["artisan", "mcp:serve", "--transport=stdio"] } } }Part of MCP Servers
You install the package using Composer by executing composer require php-mcp/laravel:^3.0 -W. Afterwards, publish the configuration file with the vendor:publish Artisan command, optionally publish and run session migrations, and use php artisan mcp:discover to register your elements.
It wraps your Laravel application logic into standard Model Context Protocol components. It allows AI clients to run PHP functions as tools, inspect dynamic application data via resource URIs, and utilize predefined prompt templates, integrating deeply with Laravel sessions, logging, and caching.
It works with any client that implements the Model Context Protocol, including Cursor IDE, Anthropic Claude Desktop, and OpenAI ChatGPT. It supports local execution through the STDIO transport as well as integrated and dedicated HTTP network transports.
The package requires PHP 8.1 or higher, Laravel 10.0 or higher, and the standard PHP json, mbstring, and pcre extensions. It is designed to work with both manual route definitions and PHP 8 attribute discovery.
Yes, it is open source and distributed under an open-source license available on GitHub via the php-mcp organization repository.