一键导入
create-mcp
Creates a Laravel MCP server with tools, resources and prompts using laravel/mcp.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Creates a Laravel MCP server with tools, resources and prompts using laravel/mcp.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generates a complete CRUD module following the boilerplate conventions.
Enforces Spanish Conventional Commits and branch naming for this project.
Creates a domain or a module within an existing domain following the boilerplate conventions.
Develops reactive Livewire 4 components. Activates when creating, updating, or modifying Livewire components; working with wire:model, wire:click, wire:loading, or any wire: directives; adding real-time updates, loading states, or reactivity; debugging component behavior; or when the user mentions Livewire, component, or reactive UI.
| name | create-mcp |
| description | Creates a Laravel MCP server with tools, resources and prompts using laravel/mcp. |
| license | MIT |
| compatibility | claude_code, codex, cursor, opencode |
Activate when the user wants to expose app functionality to AI clients via MCP. Trigger phrases: "crear servidor mcp", "nuevo mcp", "exponer al agente", "create mcp", "mcp tool".
| Variable | Description | Example |
|---|---|---|
{Server} | PascalCase server name | ProductsServer |
{server-slug} | kebab-case (URL / artisan) | products |
{Tools} | Tools to include | ListProductsTool, CreateProductTool |
routes/ai.phpddev exec php artisan make:mcp-server {Server}
ddev exec php artisan make:mcp-tool {Tool}
# ddev exec php artisan make:mcp-resource {Resource}
# ddev exec php artisan make:mcp-prompt {Prompt}
Publish routes file if missing:
ddev exec php artisan vendor:publish --tag=ai-routes
app/Mcp/Servers/{Server}.php<?php
namespace App\Mcp\Servers;
use App\Mcp\Tools\{Tool};
use Laravel\Mcp\Server;
use Laravel\Mcp\Server\Attributes\Instructions;
use Laravel\Mcp\Server\Attributes\Name;
use Laravel\Mcp\Server\Attributes\Version;
#[Name('{Server}')]
#[Version('1.0.0')]
#[Instructions('Describe what this server does and what tools are available.')]
class {Server} extends Server
{
protected array $tools = [
{Tool}::class,
];
protected array $resources = [];
protected array $prompts = [];
}
app/Mcp/Tools/{Tool}.php<?php
namespace App\Mcp\Tools;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Mcp\Request;
use Laravel\Mcp\Response;
use Laravel\Mcp\Server\Attributes\Description;
use Laravel\Mcp\Server\Tool;
#[Description('Describe what this tool does.')]
class {Tool} extends Tool
{
public function handle(Request $request): Response
{
$validated = $request->validate([
'param' => 'required|string',
]);
// business logic here...
return Response::text('Result');
}
public function schema(JsonSchema $schema): array
{
return [
'param' => $schema->string()
->description('Description of the parameter.')
->required(),
];
}
}
return Response::text('Plain text result');
return Response::structured(['key' => 'value']);
return Response::error('Something went wrong.');
return Response::fromStorage('path/to/file.png'); // image/audio
public function shouldRegister(Request $request): bool
{
return $request?->user()?->subscribed() ?? false;
}
routes/ai.phpuse App\Mcp\Servers\{Server};
use Laravel\Mcp\Facades\Mcp;
// Web (HTTP) — for remote AI clients
Mcp::web('/mcp/{server-slug}', {Server}::class)
->middleware(['auth:sanctum', 'throttle:mcp']);
// Local (stdio) — for Claude Code / CLI agents
Mcp::local('{server-slug}', {Server}::class);
<?php
namespace App\Mcp\Resources;
use Laravel\Mcp\Request;
use Laravel\Mcp\Response;
use Laravel\Mcp\Server\Attributes\Description;
use Laravel\Mcp\Server\Attributes\MimeType;
use Laravel\Mcp\Server\Attributes\Uri;
use Laravel\Mcp\Server\Resource;
#[Uri('{server-slug}://resources/data')]
#[MimeType('text/plain')]
#[Description('Exposes static context for AI clients.')]
class {Resource} extends Resource
{
public function handle(Request $request): Response
{
return Response::text('Context data here...');
}
}
feat: MCP server {Server}
- Server `{Server}` con herramientas: {Tools}
- Rutas en routes/ai.php (web + local)
#[Description('...')] — the AI uses this to decide which tool to call.handle() using $request->validate([...]).Response::error() for recoverable errors; throw exceptions for unrecoverable ones.Mcp::local() for CLI agents (Claude Code), Mcp::web() for remote HTTP clients.Response::structured() when returning structured data — it's more reliable than parsing text.