/ Diretório / 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 que usar

Principais recursos

Demo ao vivo

Como fica na prática

pronto

Instalar

Escolha seu 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`."
    }
  }
}

Abra Claude Desktop → Settings → Developer → Edit Config. Reinicie após salvar.

~/.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 o mesmo esquema mcpServers que o Claude Desktop. Config de projeto vence a 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`."
    }
  }
}

Clique no ícone MCP Servers na barra lateral do Cline, depois "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`."
    }
  }
}

Mesmo formato do Claude Desktop. Reinicie o Windsurf para aplicar.

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

O Continue usa um array de objetos de servidor em vez de um map.

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

Adicione em context_servers. Zed recarrega automaticamente ao salvar.

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

Uma linha só. Verifique com claude mcp list. Remova com claude mcp remove.

Casos de uso

Usos do mundo real: Laravel MCP

Expose Eloquent models as MCP tools

👤 Developers ⏱ ~15 min intermediate

Quando usar: You want Claude to query/update your domain data through your existing policies.

Fluxo
  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

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

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

Combinações

Combine com outros MCPs para 10× de alavancagem

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

Ferramentas

O que este MCP expõe

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

Custo e limites

O que custa rodar

Cota de API
Bound by your DB and rate limits
Tokens por chamada
Whatever your tool returns
Monetário
Free package; your hosting costs apply
Dica
Paginate model returns; large Eloquent dumps blow tokens fast

Segurança

Permissões, segredos, alcance

Escopos mínimos: app-defined gates/policies
Armazenamento de credenciais: Sanctum/Passport tokens via Laravel auth
Saída de dados: Local app only
Nunca conceda: skip your normal authorization checks in tools

Solução de problemas

Erros comuns e correções

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

AlternativaQuando usarTroca
fastmcp (Python)Stack is PythonNo Eloquent integration
csharp-sdkStack is .NETDifferent ecosystem

Mais

Recursos

📖 Leia o README oficial no GitHub

🐙 Ver issues abertas

🔍 Ver todos os 400+ servidores MCP e Skills