Laravel MCP

Official Laravel package for rapidly building Model Context Protocol (MCP) servers

Framework
Composer
vv1.0.0-beta.1
800stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
87/100Excellent
Development Activity100
Maintenance100
Community68
Maturity40
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture84
Code Quality85
Innovation88
Learning Curve75

Laravel MCP is the official package from the Laravel team for building Model Context Protocol servers directly inside a Laravel application. It provides a fluent, Artisan-driven way to register MCP tools, resources, and prompts so an AI client (Claude, an IDE agent, or any MCP-compatible host) can call into your application’s business logic.

Under the hood it handles the MCP transport layer (local/stdio and web/HTTP), request/response schema validation via illuminate/json-schema, and routing of MCP calls to plain PHP classes — meaning a Laravel developer can expose an existing application’s actions to an AI agent using patterns (controllers, facades, validation) already familiar from the rest of the framework.

What You Get

  • Artisan commands to scaffold new MCP servers, tools, resources, and prompts
  • A fluent Mcp::local()/Mcp::web() registration API mirroring Laravel’s routing conventions
  • Built-in local (stdio) and web (HTTP) transport implementations
  • Automatic JSON schema generation/validation for tool inputs via illuminate/json-schema
  • A test client (Client/WebClient) for asserting MCP server behavior in Pest/PHPUnit

Common Use Cases

  • Exposing an existing Laravel app’s business logic as callable tools for Claude or another MCP client
  • Building an internal AI assistant that can query and act on application data through defined MCP resources
  • Adding an MCP server to a SaaS product so customers can connect it to their own AI agents
  • Prototyping agentic workflows against a Laravel backend without hand-rolling the MCP transport/protocol layer

Under The Hood

Architecture - The package splits cleanly into Server (the MCP server definition and its registered tools/resources/prompts), Transport (local stdio and web HTTP implementations), Schema (JSON schema generation for tool arguments), and Client/WebClient (a first-party test harness that speaks the MCP protocol back to a server under test). Mcp::local()/Mcp::web() register server classes the same way Laravel registers route groups, and each server class declares its tools/resources/prompts as PHP classes rather than config arrays. Tech Stack - PHP 8.2+, layered directly on Laravel’s own illuminate/routing, illuminate/validation, illuminate/container, and the newer illuminate/json-schema package (used to derive JSON Schema from PHP method signatures/attributes for tool inputs), plus symfony/process for spawning local transport processes. Dev tooling includes Pest, PHPStan, Rector, and Laravel Pint, reflecting current first-party Laravel package conventions. Code Quality - 145 test files under tests/, a notably large suite for a package created in mid-2025, covering server registration, both transports, schema generation, and tool/resource/prompt dispatch; CI runs Pest, PHPStan, and Rector, and the codebase is exclusively PHP (96.9%) with a thin JS/Blade slice for developer tooling. API Design - Server, tool, resource, and prompt classes are generated via Artisan (make:mcp-server, etc.) and registered with route-like fluent calls, so a Laravel developer’s existing mental model of controllers and route registration transfers almost directly, minimizing the learning curve despite MCP itself being a newer protocol.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search