/ Directorio / Playground / Laravel MCP
● Oficial laravel ⚡ Instantáneo

Laravel MCP

por 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.

Por qué usarlo

Características clave

Demo en vivo

Cómo se ve en la práctica

listo

Instalar

Elige tu cliente

~/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`."
    }
  }
}

Abre Claude Desktop → Settings → Developer → Edit Config. Reinicia después de guardar.

~/.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 usa el mismo esquema mcpServers que Claude Desktop. La configuración del proyecto prevalece sobre la 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`."
    }
  }
}

Haz clic en el icono MCP Servers de la barra lateral de Cline y luego en "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`."
    }
  }
}

Mismo formato que Claude Desktop. Reinicia Windsurf para aplicar.

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

Continue usa un array de objetos de servidor en lugar de un mapa.

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

Añádelo a context_servers. Zed recarga en caliente al guardar.

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

Un solo comando. Verifica con claude mcp list. Quita con claude mcp remove.

Casos de uso

Usos del mundo real: Laravel MCP

Expose Eloquent models as MCP tools

👤 Developers ⏱ ~15 min intermediate

Cuándo usarlo: You want Claude to query/update your domain data through your existing policies.

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

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

Wrap Artisan commands as MCP tools

👤 Developers ⏱ ~15 min intermediate

Cuándo usarlo: You want Claude to run safe maintenance tasks (cache clear, queue retry).

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

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

Combinaciones

Combínalo con otros MCPs para multiplicar por 10

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✓ Copiado
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✓ Copiado

Herramientas

Lo que expone este MCP

HerramientaEntradasCuándo llamarCoste
php-class tools (see docs) Each tool you register is dispatched via Laravel container with normal middleware 1 call

Coste y límites

Lo que cuesta ejecutarlo

Cuota de API
Bound by your DB and rate limits
Tokens por llamada
Whatever your tool returns
Monetario
Free package; your hosting costs apply
Consejo
Paginate model returns; large Eloquent dumps blow tokens fast

Seguridad

Permisos, secretos, alcance

Ámbitos mínimos: app-defined gates/policies
Almacenamiento de credenciales: Sanctum/Passport tokens via Laravel auth
Salida de datos: Local app only
No conceder nunca: skip your normal authorization checks in tools

Resolución de problemas

Errores comunes y soluciones

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.

Alternativas

Laravel MCP vs otros

AlternativaCuándo usarlaContrapartida
fastmcp (Python)Stack is PythonNo Eloquent integration
csharp-sdkStack is .NETDifferent ecosystem

Más

Recursos

📖 Lee el README oficial en GitHub

🐙 Ver issues abiertas

🔍 Ver todos los 400+ servidores MCP y Skills