Laravel MCP Server

A Laravel and Lumen package that adds an MCP endpoint to your app's routes and attaches your own tools to it

  • 330 ★ on the repository
  • Last commit
  • MIT
MCP server

Extended access

Why this level

  • The package opens an HTTP address with your app's tools, and without middleware it is open to everyone
  • Tools execute your application's code, so the agent's access equals what you build into them
All reasons and checks

opgginc/laravel-mcp-server

Install

Manual install

composer require opgginc/laravel-mcp-server

Run it in the root of a Laravel project on PHP 8.2 or later.

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The package opens an HTTP address with your app's tools, and without middleware it is open to everyone
  • Tools execute your application's code, so the agent's access equals what you build into them

This is third-party code. Review the repository files before installing.

What it does

Laravel MCP Server from OP.GG turns a Laravel application into an MCP server. You register the endpoint in routes with a `Route::mcp('/mcp')` call. You attach tools, resources, resource templates and prompts to it, and the transport is streamable HTTP. The package installs with `composer require opgginc/laravel-mcp-server`. Five commands create scaffolds: for a tool, a resource, a resource template, a prompt and a notification, for example `php artisan make:mcp-tool`. The `php artisan mcp:test-tool` command lists tools and calls the one you need on a chosen endpoint. A Laravel-style JsonSchema builder sets argument schemas. Existing APIs can be wired up without hand-written code. The `php artisan make:swagger-mcp-tool` command reads an OpenAPI spec from a URL or a file and creates tool and resource classes, grouping them by tag or path. The reverse command `php artisan mcp:export-openapi` exports a description of your tools to OpenAPI. One address can serve different tool sets to different clients through a dynamic query-string filter.

Who it is for. For PHP developers who want to expose their Laravel app's features to AI agents through MCP.

Good fit when

  • You want Claude Code or Cursor to reach your Laravel app's data and actions through a protected MCP address
  • You have a REST API with an OpenAPI description and want it turned into MCP tools quickly
  • You need to serve different tool sets to different clients at one address based on query parameters
  • You want a description of your MCP tools exported to OpenAPI for documentation
  • You want to protect the MCP endpoint with ordinary Laravel means: Sanctum, rate limiting, route groups

Not a fit when

  • The app is not on PHP: the package works only with Laravel and Lumen
  • You need version 1.x with config setup or the SSE transport: both were removed in 2.0.0, and there is a migration guide
  • You want a ready server for an agent without development: the package is a base and you write the tools
  • You need the official Laravel package: the framework has its own laravel/mcp, and this one is made by OP.GG

Example request

Add an MCP endpoint /mcp with `auth:sanctum` middleware to my Laravel project, create a tool that searches orders and check it with the `php artisan mcp:test-tool` command.

MCP

Transport
http
Authentication
not required

Limitations

PHP 8.2 or later and Laravel 9 or later are required, with Lumen optional. Version 2.0.0 breaks compatibility: endpoint setup moved from config to routes, and streamable HTTP is the only transport. Server info is now set through one method, and the legacy tool transport methods were removed. The docs/migrations/v2.0.0-migration.md guide and the `php artisan mcp:migrate-tools` command help with the move. The package adds no authentication of its own.

How to disable. Remove the `Route::mcp` call from your routes and run `composer remove opgginc/laravel-mcp-server`. The tool classes created in `app/MCP` stay in the project and must be deleted by hand.

FAQ

How do I add Laravel MCP Server to a project?

Run `composer require opgginc/laravel-mcp-server` and add a `Route::mcp('/mcp')` call to routes with server info and a list of tools through tools. Check the result with `php artisan route:list` and the tool list with `php artisan mcp:test-tool --list --endpoint=/mcp`.

How do I protect the MCP endpoint?

Wrap `Route::mcp` in a group with ordinary Laravel middleware, for example `auth:sanctum` and `throttle:100,1`. The package does not force authentication, so without middleware the route is available to anyone who knows the address.

How do I turn OpenAPI into MCP tools?

Run `php artisan make:swagger-mcp-tool` with a URL or a path to the spec. The `--group-by` option takes tag, path or none, `--prefix` sets the class prefix and `--test-api` checks that the endpoints respond before generating. In non-interactive mode GET methods become resources and the rest become tools.

What if a client does not support protocol 2025-11-25?

Set the protocol version on the route explicitly: `ProtocolVersion::V2025_06_18`. Older clients then connect to the same endpoint.

How does this package differ from laravel/mcp?

laravel/mcp is released by Laravel itself, while OP.GG develops this package separately, with its own feature set and release schedule.

Discussion

No questions or reviews yet.

Laravel MCP

laravel-mcp

Official

The official Laravel package for building MCP servers inside an application: AI clients work with your Laravel project through MCP

MCP serverExtended access861Repository stars
Official

Laravel's official MCP server, guidelines and skills: the agent sees the DB schema, logs and package versions and searches ecosystem docs

MCP serverExtended access3.7KRepository stars
Official

Apollo's MCP server: turns chosen GraphQL operations into tools the agent uses to work with your API

MCP serverBroad access317Repository stars

Two GraphQL tools for MCP clients: the agent fetches your API schema and runs queries against a single endpoint

MCP serverExtended access407Repository stars
Official

Official WordPress package that turns Abilities API abilities into MCP tools, resources and prompts

MCP serverBroad access1.9KRepository stars
Russian stack

A MoySklad MCP server with two write gates: stock, profit, reports and draft documents over JSON API 1.2

MCP serverBroad access

README in short

The documentation exists in eight languages, including Russian. It walks through example classes for a tool, a prompt and a resource and lists the test and quality commands: Pest, PHPStan and Pint.

README badge

Report a problem

Foxx AILaravel MCP Server
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.