Laravel MCP Framework: expose Laravel tools, resources, and business workflows to AI agents using a Laravel-native developer experience.
Turn any Laravel application into an AI-native application in minutes.
- MCP runtime manager with discovery and execution APIs.
- HTTP transport with JSON and streaming endpoint support.
- Built-in Eloquent integration to expose models as MCP resources.
- Tool and resource abstractions with JSON schema generation.
- FormRequest and Validator integration for argument validation.
- Laravel authorization integration for per-tool and per-resource checks.
- Tenant context resolver for multi-tenant SaaS workloads.
- Queue-backed async tool execution.
- Security module with API keys, rate limiting, and execution audit logs.
- Operational endpoints for dashboard, agent monitoring, and analytics.
- Artisan generators and operational diagnostics.
- Extension architecture for marketplace-ready MCP packages.
- Architecture: docs/architecture.md
- API reference: docs/api-reference.md
- Tools guide: docs/tools.md
- Resources guide: docs/resources.md
- Security guide: docs/security.md
- Testing guide: docs/testing.md
- Use cases: docs/use-cases.md
- End-to-end use cases: docs/use-cases-e2e.md
- Product roadmap: docs/roadmap.md
- Contribution guide: docs/contributing.md
laravel-mcp-server is positioned as the Laravel MCP Framework for teams that want to make existing Laravel applications AI-native without rewriting core domain logic.
It maps naturally to Laravel patterns:
- Laravel routes -> MCP endpoints
- Laravel controllers/services -> MCP tools
- Laravel resources/models -> MCP resources
- Laravel jobs -> async MCP execution
This lets teams keep business logic in familiar Laravel structures while exposing capabilities to AI agents through MCP.
- MCP protocol implementation
- Tools
- Resources
- Authentication
Status:
- Implemented in current release.
- Eloquent auto discovery
- Policies integration
- Events
Status:
- Implemented baseline support with auto-discovery service, policy-aware Eloquent authorization, and extended runtime events.
- Additional auto-discovery depth can continue in minor releases.
- Filament dashboard
- Agent monitoring
- Analytics
Status:
- Implemented baseline with MCP operational dashboard, execution monitoring, and analytics endpoints.
- Optional Filament integration endpoint is included and activates when Filament is installed.
- Laravel 11/12/13 support
- Pest tests
- GitHub Actions
- PHPStan level 9
- Documentation website
- Demo application
- Docker environment
- Packagist release
Status:
- In progress.
- Current release includes Laravel 11/12 support, Pest tests, GitHub Actions, and Packagist publication path.
- Laravel 13, PHPStan level 9, documentation website, demo app, and Docker environment are planned upgrades.
This package follows Laravel package development guidance:
- clear service provider bootstrapping
- publishable config and migrations
- framework-aligned testing setup
- clean package structure with contracts and abstractions
Building it as a standalone package from the beginning ensures maintainability, upgrade safety, and reusable adoption across multiple Laravel applications.
- PHP 8.2+
- Laravel 11.x or 12.x
composer require yoosuf/laravel-mcp-serverPublish config and migrations:
php artisan vendor:publish --tag=mcp-config
php artisan vendor:publish --tag=mcp-migrations
php artisan migrateRegister classes in a service provider:
use Yoosuf\LaravelMcpServer\Facades\MCP;
MCP::resource(\App\MCP\Resources\CustomerResource::class);
MCP::tool(\App\MCP\Tools\CreateInvoiceTool::class);
MCP::async(\App\MCP\Tools\GenerateReportTool::class);
MCP::tenantResolver(fn () => tenant());Discover MCP metadata:
- GET /.well-known/mcp/discovery
Execute over HTTP:
- POST /.well-known/mcp/execute
- POST /.well-known/mcp/stream
php artisan make:mcp-tool CreateInvoiceToolclass CreateInvoiceTool extends MCPTool
{
public function name(): string { return 'create_invoice'; }
public function description(): string { return 'Creates customer invoice'; }
public function schema(): array
{
return [
'customer_id' => 'integer',
'items' => 'array',
];
}
public function rules(): array
{
return [
'customer_id' => ['required', 'integer'],
'items' => ['required', 'array'],
];
}
public function authorize(McpContext $context, array $arguments): bool
{
return $context->user?->can('create', \App\Models\Invoice::class) ?? false;
}
public function execute(array $arguments, McpContext $context): mixed
{
// Implement domain operation
}
}php artisan make:mcp-resource CustomerResourceclass CustomerResource extends MCPResource
{
public function name(): string { return 'customers'; }
public function schema(): array
{
return [
'id' => 'integer',
'name' => 'string',
'email' => 'string',
];
}
public function actions(): array
{
return ['list', 'find'];
}
}- Laravel guards (Sanctum, Passport-compatible architecture).
- API key auth via mcp_api_keys table and X-MCP-Key header.
- Rate limiting for MCP execution endpoints.
- Per-execution audit logs in mcp_executions and mcp_logs.
Set a global tenant resolver:
MCP::tenantResolver(function () {
return tenant();
});Every execution context includes user_id, tenant_id, permissions, and roles.
- php artisan make:mcp-tool
- php artisan make:mcp-resource
- php artisan make:mcp-server
- php artisan mcp:list
- php artisan mcp:test
- php artisan mcp:cli
- php artisan mcp:stdio
Use the built-in trait on your model:
use Yoosuf\LaravelMcpServer\Eloquent\Support\HasMcpExposure;
class Customer extends Model
{
use HasMcpExposure;
}
Customer::mcp()->allow(['list', 'search', 'find']);- CRM assistants that read customer data and trigger workflows.
- Invoice automation with async report generation.
- Tenant-safe SaaS operations for subscriptions and billing.
- Support desk actions with policy-controlled write operations.
- Internal compliance workflows with audit-friendly execution logs.
See detailed implementation patterns in docs/use-cases.md. For complete operational walkthroughs, see docs/use-cases-e2e.md.
composer lint
composer analyse
composer test
composer coverageThis package follows semantic versioning. Current stable line: 1.x.
MIT