php-mcp/server
PHP implementation of the Model Context Protocol server, letting Laravel and PHP apps expose tools, resources, and prompts to MCP clients like Claude and other AI assistants through a clean, framework-friendly API.
Architecture fit. php-mcp/server implements the server side of the Model Context Protocol — the transport/handshake layer, tool/resource/prompt registration, JSON-RPC message handling, and capability negotiation. It is a framework-agnostic core, meaning it slots underneath Laravel rather than replacing anything in your existing HTTP stack. From a TPM lens, this is an additive dependency: it creates a new surface (an MCP endpoint) rather than modifying request lifecycle, ORM, queue, or auth internals. That is the ideal shape for a new integration — low blast radius, reversible, and independently deployable.
Integration feasibility. The package is mature enough to evaluate seriously (874 stars, MIT, active releases through mid-2025) but it is early-stage relative to Laravel ecosystem norms. Expect to write a thin adapter for transport (stdio vs. HTTP/SSE), auth (MCP has no built-in auth; you bolt on Laravel Sanctum or signed tokens), and tool registration (mapping Laravel actions/services to MCP tool schemas). The core protocol work is done for you; the framework plumbing is yours. That is a reasonable trade — protocol correctness is the risky part, and delegating it to a maintained package is the right call.
Technical risk. Three risks dominate. First, protocol churn: MCP is young and the spec has moved (transport changes, auth additions). Pin versions and budget upgrade work. Second is security surface: an MCP endpoint exposes your application's capabilities to an LLM client. Every tool is effectively a public API method with an autonomous caller. Authorization, input validation, and rate limiting must be designed intentionally, not inherited. Third is observability: MCP traffic is JSON-RPC over a non-standard transport, so your existing Laravel logging, tracing, and APM may not capture it cleanly out of the box. Plan to instrument explicitly.
Key questions. Which transport do we need — stdio (local/CLI-adjacent) or HTTP/SSE (remote clients)? Who are the MCP clients (Claude Desktop, IDE agents, internal tools)? What is the auth model for the endpoint? Which existing Laravel services become tools, and what is the permission boundary per tool? Do we need multi-tenant isolation (one MCP server per tenant vs. shared with scoped credentials)? What is our fallback if the package stalls — is the protocol simple enough to fork or reimplement?
Stack fit. Excellent for Laravel 10/11+ on PHP 8.1+, especially where the app already owns domain logic worth exposing to an LLM (CRM data, internal APIs, search, workflow triggers). The package's framework-agnostic core means it composes cleanly with Laravel's service container: register an MCP service provider, bind tool classes, and let the container resolve dependencies. This matches Laravel's idioms rather than fighting them.
Migration path. There is no migration in the traditional sense — nothing is being replaced. The path is additive: stand up a minimal MCP server exposing one read-only tool against a non-production data source, validate end-to-end with a real client, then expand tool surface incrementally. Treat the first tool as a spike, not a feature.
Compatibility. Verify PHP version support against your fleet, confirm the transport you need is implemented in the pinned version, and check for conflicts with existing HTTP middleware (CSRF, session, CORS) — MCP clients are non-browser and will trip standard Laravel web middleware. Plan to isolate the MCP route group with custom middleware. Also confirm compatibility with your queue/cache drivers if tools are long-running.
Sequencing. (1) Feasibility spike: one tool, one client, staging only. (2) Auth and route isolation design. (3) Observability instrumentation. (4) Expand tool catalog with per-tool authorization. (5) Document client onboarding. (6) Harden and load-test. Don't invert steps 1 and 2.
Maintenance. Low-to-moderate steady-state cost, with periodic spikes at MCP spec revisions. Budget an owner — this is not a "set and forget" dependency. Track upstream releases and security advisories; MIT licensing means no vendor SLA, so maintainership continuity is a real (if modest) risk given the package's youth.
Support. Community-supported via GitHub issues. No commercial backing assumed. For production exposure, that means your team is the escalation path; plan internal documentation and a runbook for the MCP endpoint specifically (auth failures, malformed JSON-RPC, tool timeouts).
Scaling. Stateless HTTP/SSE transport scales horizontally like any Laravel endpoint — put it behind the same load balancer and autoscaling group. Stdio transport is per-process and does not scale the same way; if clients are remote, prefer HTTP. Watch for long-running tool calls (LLM clients may hold connections); set explicit timeouts and offload heavy work to Laravel queues where tool semantics allow.
Failure modes. (a) Protocol version mismatch — client and server disagree, silent degradation. Mitigate with capability negotiation tests. (b) Auth bypass on a tool — highest-severity risk; require per-tool authorization, not just endpoint auth. (c) Unbounded tool invocation causing cost or rate-limit blowups; add quotas per client/token. (d) Observability blindness — JSON-RPC errors won't surface in standard Laravel logs; instrument explicitly. (e) Upstream package abandonment — mitigate by keeping the adapter layer thin so a fork is feasible.
Ramp-up. Moderate. A Laravel-fluent engineer can stand up a trivial server in a day; production-grade requires understanding MCP semantics (capabilities, tool schemas, lifecycle), OAuth/signed-token patterns for non-browser clients, and JSON-RPC error handling. Estimate one to two engineer-weeks for a competent team to reach a defensible first release, plus ongoing ownership. The knowledge is not yet common in the Laravel world — assume you are training the team, not hiring for it.
How can I help you explore Laravel packages today?