{"id":28723783,"url":"https://github.com/kirschbaum-development/laravel-loop","last_synced_at":"2026-03-13T12:32:24.786Z","repository":{"id":295882690,"uuid":"962565175","full_name":"kirschbaum-development/laravel-loop","owner":"kirschbaum-development","description":"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.","archived":false,"fork":false,"pushed_at":"2025-11-24T20:37:37.000Z","size":292,"stargazers_count":123,"open_issues_count":8,"forks_count":8,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-11-27T15:20:36.896Z","etag":null,"topics":["laravel","mcp","mcp-server"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kirschbaum-development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-08T10:47:22.000Z","updated_at":"2025-10-19T03:27:19.000Z","dependencies_parsed_at":"2025-06-04T15:11:52.248Z","dependency_job_id":"2610ea86-927b-4e48-8e3f-8346dd1ff68a","html_url":"https://github.com/kirschbaum-development/laravel-loop","commit_stats":null,"previous_names":["kirschbaum-development/laravel-loop"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/kirschbaum-development/laravel-loop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Flaravel-loop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Flaravel-loop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Flaravel-loop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Flaravel-loop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirschbaum-development","download_url":"https://codeload.github.com/kirschbaum-development/laravel-loop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Flaravel-loop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30467383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T11:00:43.441Z","status":"ssl_error","status_checked_at":"2026-03-13T11:00:23.173Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","mcp","mcp-server"],"created_at":"2025-06-15T09:38:23.941Z","updated_at":"2026-03-13T12:32:24.764Z","avatar_url":"https://github.com/kirschbaum-development.png","language":"PHP","funding_links":[],"categories":["📚 Projects (1974 total)"],"sub_categories":["MCP Servers"],"readme":"# Laravel Loop\n\n![](images/laravel-loop.png)\n\n![Laravel Supported Versions](https://img.shields.io/badge/laravel-10.x/11.x/12.x-green.svg)\n[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/kirschbaum-development/laravel-loop.svg?style=flat-square)](https://packagist.org/packages/kirschbaum-development/laravel-loop)\n\nLaravel 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.\n\nLaravel Loop uses [Prism](https://github.com/prism-php/prism) behind the scenes to build the tools.\n\n\u003e [!IMPORTANT]\n\u003e Laravel Loop and its pre-built tools are still in development and this is a beta version.\n\n![](images/claude-desktop.png)\n\n## What It Does\n\nLaravel Loop allows you to:\n\n- Create and expose your own tools directly integrated with your Laravel application\n- Connect with MCP clients like Claude Code, Cursor, Windsurf, and more\n\n**Pre-built tools:**\n\n* [Filament MCP Server](https://github.com/kirschbaum-development/laravel-loop-filament).\n* Laravel Model Tools (Interact with your models data): `Kirschbaum\\Loop\\Toolkits\\LaravelModelToolkit` (Write operations to come)\n* Laravel Factories Tools (Create test data from your MCP Client): `Kirschbaum\\Loop\\Toolkits\\LaravelFactoriesToolkit`\n* Stripe Tool (Interact with the Stripe API): `Kirschbaum\\Loop\\Tools\\StripeTool`\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require kirschbaum-development/laravel-loop\n```\n\nPublish the configuration file:\n\n```bash\nphp artisan vendor:publish --tag=\"loop-config\"\n```\n\n## Usage\n\nFirst, you must register your tools (If you don't know where to put, put in `app/Providers/AppServiceProvider`).\n\n```php\nuse Illuminate\\Support\\ServiceProvider;\nuse Kirschbaum\\Loop\\Facades\\Loop;\nuse Kirschbaum\\Loop\\Toolkits;\nuse Kirschbaum\\Loop\\Tools;\n\nLoop::toolkit(Kirschbaum\\Loop\\Filament\\FilamentToolkit::make());\n```\n\n### Custom Tools\n\nTo build your own tools, you can use the `Loop::tool` method.\n\n```php\nuse Kirschbaum\\Loop\\Facades\\Loop;\nuse Kirschbaum\\Loop\\Tools\\CustomTool;\n\nLoop::tool(\n    CustomTool::make(\n        name: 'custom_tool',\n        description: 'This is a custom tool',\n    )\n        -\u003ewithStringParameter(name: 'name', description: 'The name of the user', required: true)\n        -\u003ewithNumberParameter(name: 'age', description: 'The age of the user')\n        -\u003eusing(function (string $name, ?int $age = null) {\n            return sprintf('Hello, %s! You are %d years old.', $name, $age ?? 'unknown');\n        }),\n    );\n);\n```\n\nThe available parameters types can be found in the [Prism Tool Documentation](https://prismphp.com/core-concepts/tools-function-calling.html#parameter-definition).\n\n### Custom Tool Objects\n\nYou 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.\n\n```php\nuse Kirschbaum\\Loop\\Contracts\\Tool;\n\nclass HelloTool implements Tool\n{\n    use \\Kirschbaum\\Loop\\Concerns\\Makeable;\n\n    public function build(): \\Prism\\Prism\\Tool\n    {\n        return app(\\Prism\\Prism\\Tool::class)\n            -\u003eas($this-\u003egetName())\n            -\u003efor('Says hello to the user')\n            -\u003ewithStringParameter('name', 'The name of the user to say hello to.', required: true)\n            -\u003eusing(fn (string $name) =\u003e \"Hello, $name!\");\n    }\n\n    public function getName(): string\n    {\n        return 'hello';\n    }\n}\n```\n\nIf you want to provide multiple similar tools, you can build a toolkit which returns a collection of tools.\n\n```php\nuse Kirschbaum\\Loop\\Collections\\ToolCollection;\nuse Kirschbaum\\Loop\\Contracts\\Toolkit;\n\nclass LaravelFactoriesToolkit implements Toolkit\n{\n    use \\Kirschbaum\\Loop\\Concerns\\Makeable;\n\n    public function getTools(): ToolCollection\n    {\n        return new ToolCollection([\n            HelloTool::make(),\n            GoodbyeTool::make(),\n        ]);\n    }\n}\n```\n\n***\n\n## Connecting to the MCP server\n\nFor this to be really useful, you need to connect your MCP client (Claude Code, Claude Desktop, Cursor, Windsurf, etc) to the Laravel LoopMCP server.\n\nThe MCP protocol has two main transports to connect: STDIO and Streamable HTTP, and the deprecated HTTP+SSE transport. Laravel Loop supports all of them.\n\nThe easiest way to configure your MCP client is to use the `php artisan loop:mcp:config` command. This will guide you through the process of configuring your MCP client.\n\n```bash\nphp artisan loop:mcp:generate-config\n```\n\n### STDIO\n\nTo run the MCP server using STDIO, we provide the following artisan command:\n\n```bash\nphp artisan loop:mcp:start [--user-id=1 [--user-model=] [--auth-guard=] [--debug]\n```\n\nTo connect Laravel Loop MCP server to Claude Code, for example, you can use the following command:\n\n```bash\nclaude mcp add laravel-loop-mcp php /your/full/path/to/laravel/artisan loop:mcp:start\n\n# with an authenticated user\nclaude mcp add laravel-loop-mcp php /your/full/path/to/laravel/artisan loop:mcp:start --user-id=1 --user-model=App\\Models\\User\n\n# with debug mode\nclaude mcp add laravel-loop-mcp php /your/full/path/to/laravel/artisan loop:mcp:start --debug\n```\n\nTo configure Laravel Loop in Cursor, Claude or any MCP clients with a JSON config file:\n\n```json\n{\n  \"mcpServers\": {\n    \"laravel-loop-mcp\": {\n      \"command\": \"php\",\n      \"args\": [\n        \"/your/full/path/to/laravel/artisan\",\n        \"loop:mcp:start\",\n        \"--user-id=1\"\n      ]\n    }\n  }\n}\n```\n\n### Streamable HTTP \u0026 SSE\n\nHaving to run PHP or Node to run the MCP server can be annoying. To avoid this, you can use the Streamable HTTP or SSE transport, which connects the MCP client directly to your application via HTTP.\n\nLaravel Loop also supports the [streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports) and the deprecated [HTTP+SSE transport](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse).\n\n\u003e [!IMPORTANT]\n\u003e NOTE: The Streamable HTTP transport is new and not yet supported by all MCP clients, while the SSE (supported by most MCP clients) is deprecated.\n\nThe following docs are for both transports. Please note you only need to enable one of them.\n\n#### 1. Enable and configure the transport\n\nTo enable the Streamable HTTP transport, update your `.env` file:\n\n```bash\n# streamable http\nLOOP_STREAMABLE_HTTP_ENABLED=true\n\n# sse\nLOOP_SSE_ENABLED=true\n```\n\n**Note:** When using SSE, the default driver is `file`, which is the simplest and most convenient for local development. However, for production, we recommend using `redis` to avoid issues with file locking. You can change the driver and additional options in the `config/loop.php` file.\n\nThis will expose two MCP endpoints:\n- `/mcp` that supports the new Streamable HTTP transport.\n- `/mcp/sse` that supports the deprecated HTTP+SSE transport.\n\n**Note:** If you are running your application locally with **https**, most clients will fail due to the self-signed certificates. To avoid this, use the STDIO transport or use the **http** protocol locally.\n\n#### 2. Configure authentication (optional)\n\nBe aware that if you are exposing your endpoint publicly, you are exposing your data to the world. To ensure your MCP endpoints are secure, make sure to configure the `streamable_http.middleware` or `sse.middleware` config options. We recommend using something like Sanctum (configured by default) to protected the endpoint.\n\n```php\n[\n    'streamable_http' =\u003e [\n        'middleware' =\u003e ['auth:sanctum'],\n    ],\n    \n    'sse' =\u003e [\n        'middleware' =\u003e ['auth:sanctum'],\n    ],\n]\n```\n\n#### 3. Add the MCP server to your client\n\nThen, you just need to configure the MCP server endpoint in your client:\n\n**Claude Code**\n\n```bash\nclaude mcp add laravel-loop-mcp http://your-url.test/mcp/sse -t sse\n```\n\n**From JSON config file**\n\n```json\n{\n  \"mcpServers\": {\n    \"laravel-loop-mcp\": {\n      \"url\": \"http://your-url.test/mcp/sse\",\n    }\n  }\n}\n```\n\nPlease note that not all clients support direct SSE connections. For those situations, you can proxy it through the `mcp-remote` package. This requires you to have Node.js (\u003e 20) installed. Below an example using the [mcp-remote](https://github.com/geelen/mcp-remote) package.\n\n```json\n{\n  \"mcpServers\": {\n    \"laravel-loop-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"mcp-remote\",\n        \"https://your-remote-url.com/mcp\",\n        \"--header\",\n        \"Authorization: Bearer ${AUTH_TOKEN}\"\n      ]\n    }\n  }\n}\n```\n\n***\n\n## Troubleshooting\n\n**Connection failed: MCP error -32000: Connection closed**\n\nIf you get this error, it likely means there's some error happening in your application. Check your applicationlogs for more details.\n\n**Error: spawn php ENOENT**\n\nThis can happen when your \"php\" binary is not in the PATH. This can be solved in a few ways:\n\n- Add the path to your `.bashrc` or `.zshrc` file. Sometimes it can be only in the `.zshrc` file but applications like Claude use `.bashrc`.\n- Use the full path of the PHP binary. You can get it by running `which php` in your terminal.\n    * This can be a good option to ensure you always use the proper version of PHP for a given project. If you use Herd, for example, your `php` will change depending on the selected version.\n\n**Manually call tools and verify output**\n\nSometimes when building tools, you may be getting unexpected results and debugging from the MCP client can be difficult. You can manually call tools and verify the output by running the following command:\n\n```bash\nphp artisan loop:mcp:call\n```\n\n**Make sure to check your application logs**\n\nIf you are getting an unkown error, check your application logs for more details.\n\n***\n\n## Roadmap\n\n- [ ] Add a chat component to the package, so you can use the tools inside the application without an MCP client.\n- [ ] Refine the existing tools\n- [ ] Add write capabilities to the existing tools\n\n## Security\n\nIf you discover any security related issues, please email security@kirschbaumdevelopment.com instead of using the issue tracker.\n\n## Sponsorship\n\nDevelopment of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com?utm_source=github) or [join us](https://careers.kirschbaumdevelopment.com?utm_source=github)!\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirschbaum-development%2Flaravel-loop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirschbaum-development%2Flaravel-loop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirschbaum-development%2Flaravel-loop/lists"}