/ Directory / Playground / Laravel MCP
● Official laravel ⚡ Instant

Laravel MCP

by laravel · laravel/mcp

Laravel's official MCP package — define MCP tools as classes, expose Eloquent models and Artisan commands to Claude with first-party auth/middleware.

Laravel MCP turns any Laravel app into an MCP server. Tools are PHP classes you register in a service provider; the package handles JSON-RPC, schema generation, and transport. You get to reuse your auth, policies, and middleware.

Why use it

Key features

Live Demo

What it looks like in practice

ready

Install

Pick your client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "laravel-mcp": {
      "command": "php",
      "args": [
        "artisan",
        "mcp:start"
      ],
      "_doc": "Run inside a Laravel project after `composer require laravel/mcp` and `php artisan mcp:install`."
    }
  }
}

Open Claude Desktop → Settings → Developer → Edit Config. Restart after saving.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "laravel-mcp": {
      "command": "php",
      "args": [
        "artisan",
        "mcp:start"
      ],
      "_doc": "Run inside a Laravel project after `composer require laravel/mcp` and `php artisan mcp:install`."
    }
  }
}

Cursor uses the same mcpServers schema as Claude Desktop. Project config wins over global.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "laravel-mcp": {
      "command": "php",
      "args": [
        "artisan",
        "mcp:start"
      ],
      "_doc": "Run inside a Laravel project after `composer require laravel/mcp` and `php artisan mcp:install`."
    }
  }
}

Click the MCP Servers icon in the Cline sidebar, then "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "laravel-mcp": {
      "command": "php",
      "args": [
        "artisan",
        "mcp:start"
      ],
      "_doc": "Run inside a Laravel project after `composer require laravel/mcp` and `php artisan mcp:install`."
    }
  }
}

Same shape as Claude Desktop. Restart Windsurf to pick up changes.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "laravel-mcp",
      "command": "php",
      "args": [
        "artisan",
        "mcp:start"
      ]
    }
  ]
}

Continue uses an array of server objects rather than a map.

~/.config/zed/settings.json
{
  "context_servers": {
    "laravel-mcp": {
      "command": {
        "path": "php",
        "args": [
          "artisan",
          "mcp:start"
        ]
      }
    }
  }
}

Add to context_servers. Zed hot-reloads on save.

claude mcp add laravel-mcp -- php artisan mcp:start

One-liner. Verify with claude mcp list. Remove with claude mcp remove.

Use Cases

Real-world ways to use Laravel MCP

Expose Eloquent models as MCP tools

👤 Developers ⏱ ~15 min intermediate

When to use: You want Claude to query/update your domain data through your existing policies.

Flow
  1. Install
    composer require laravel/mcp; php artisan mcp:install✓ Copied
    → Service provider + config published
  2. Define tool
    Create OrderLookupTool extends McpTool, type-hint $orderId; return Order::findOrFail($orderId).✓ Copied
    → Tool registered
  3. Run
    php artisan mcp:start; connect Claude.✓ Copied
    → Claude lists your tool and can call it

Outcome: Claude reads/writes your domain data via your existing authorization.

Wrap Artisan commands as MCP tools

👤 Developers ⏱ ~15 min intermediate

When to use: You want Claude to run safe maintenance tasks (cache clear, queue retry).

Flow
  1. Whitelist
    In config/mcp.php, list the Artisan commands you allow.✓ Copied
    → Whitelist saved
  2. Call
    From Claude: "Run artisan queue:retry all".✓ Copied
    → Command runs; output streamed back

Outcome: Operational tasks become Claude-callable, scoped to a whitelist.

Combinations

Pair with other MCPs for X10 leverage

laravel-mcp + github

Deploy MCP server alongside your Laravel app via Forge/Vapor

Combine laravel-mcp with github: Deploy MCP server alongside your Laravel app via Forge/Vapor✓ Copied
laravel-mcp + sentry

Errors raised inside tools surface in your existing Sentry pipeline

Combine laravel-mcp with sentry: Errors raised inside tools surface in your existing Sentry pipeline✓ Copied

Tools

What this MCP exposes

ToolInputsWhen to callCost
php-class tools (see docs) Each tool you register is dispatched via Laravel container with normal middleware 1 call

Cost & Limits

What this costs to run

API quota
Bound by your DB and rate limits
Tokens per call
Whatever your tool returns
Monetary
Free package; your hosting costs apply
Tip
Paginate model returns; large Eloquent dumps blow tokens fast

Security

Permissions, secrets, blast radius

Minimum scopes: app-defined gates/policies
Credential storage: Sanctum/Passport tokens via Laravel auth
Data egress: Local app only
Never grant: skip your normal authorization checks in tools

Troubleshooting

Common errors and fixes

Tool not appearing in client

Restart mcp:start; tools register at boot. Check service provider is loaded.

JSON Schema wrong

Ensure PHP type hints — int $id, not $id. Use attributes for descriptions.

Alternatives

Laravel MCP vs others

AlternativeWhen to use it insteadTradeoff
fastmcp (Python)Stack is PythonNo Eloquent integration
csharp-sdkStack is .NETDifferent ecosystem

More

Resources

📖 Read the official README on GitHub

🐙 Browse open issues

🔍 Browse all 400+ MCP servers and Skills