Skip to content

Laravel Loop

Laravel Loop is a powerful Model Context Protocol (MCP) server designed specifically for Laravel applications. It connects your Laravel application with AI assistants using the…

Install

$claude mcp add laravel-loop-mcp php /your/full/path/to/laravel/artisan loop:mcp:start

Install command taken from the project's README or registry entry. Always review code before running it.

Laravel Loop

Laravel Loop is a powerful Model Context Protocol (MCP) server designed specifically for Laravel applications. It connects your Laravel application with AI assistants using the MCP protocol.

Laravel Loop uses Prism behind the scenes to build the tools.

[!IMPORTANT] Laravel Loop and its pre-built tools are still in development and this is a beta version.

What It Does

Laravel Loop allows you to:

  • Create and expose your own tools directly integrated with your Laravel application
  • Connect with MCP clients like Claude Code, Cursor, Windsurf, and more

Pre-built tools:

  • Filament MCP Server.
  • Laravel Model Tools (Interact with your models data): Kirschbaum\Loop\Toolkits\LaravelModelToolkit (Write operations to come)
  • Laravel Factories Tools (Create test data from your MCP Client): Kirschbaum\Loop\Toolkits\LaravelFactoriesToolkit
  • Stripe Tool (Interact with the Stripe API): Kirschbaum\Loop\Tools\StripeTool

Installation

You can install the package via composer:

composer require kirschbaum-development/laravel-loop

Publish the configuration file:

php artisan vendor:publish --tag="loop-config"

Usage

First, you must register your tools (If you don't know where to put, put in app/Providers/AppServiceProvider).

use Illuminate\Support\ServiceProvider;
use Kirschbaum\Loop\Facades\Loop;
use Kirschbaum\Loop\Toolkits;
use Kirschbaum\Loop\Tools;

Loop::toolkit(Kirschbaum\Loop\Filament\FilamentToolkit::make());

Custom Tools

To build your own tools, you can use the Loop::tool method.

use Kirschbaum\Loop\Facades\Loop;
use Kirschbaum\Loop\Tools\CustomTool;

Loop::tool(
    CustomTool::make(
        name: 'custom_tool',
        description: 'This is a custom tool',
    )
        ->withStringParameter(name: 'name', description: 'The name of the user', required: true)
        ->withNumberParameter(name: 'age', description: 'The age of the user')
        ->using(function (string $name, ?int $age = null) {
            return sprintf('Hello, %s! You are %d years old.', $name, $age ?? 'unknown');
        }),
    );
);

The available parameters types can be found in the Prism Tool Documentation.

Custom Tool Objects

You can also build your own tool classes. Each tool must implement the Tool contract, and return a Prism\Prism\Tool instance in the build method.

use Kirschbaum\Loop\Contracts\Tool;

class HelloTool implements Tool
{
    use \Kirschbaum\Loop\Concerns\Makeable;

    public function build(): \Prism\Prism\Tool
    {
        return app(\Prism\Prism\Tool::class)
            ->as($this->getName())
            ->for('Says hello to the user')
            ->withStringParameter('name', 'The name of the user to say hello to.', required: true)
            ->using(fn (string $name) => "Hello, $name!");
    }

    public function getName(): string
    {
        return 'hello';
    }
}

If you want to provide multiple similar tools, you can build a toolkit which returns a collection of tools.

use Kirschbaum\Loop\Collections\ToolCollection;
use Kirschbaum\Loop\Contracts\Toolkit;

class LaravelFactoriesToolkit implements Toolkit
{
    use \Kirschbaum\Loop\Concerns\Makeable;

Similar plugs

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

Explore related