Skip to content

Commit e644db4

Browse files
committed
Updated readme
1 parent 09bc7b9 commit e644db4

File tree

1 file changed

+62
-6
lines changed

1 file changed

+62
-6
lines changed

README.md

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

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

5+
Laravel Loop uses [Prism](https://github.com/prism-ai/prism) behind the scenes to build the tools.
6+
7+
> [!IMPORTANT]
8+
> Laravel Loop is still in development and this is a beta version.
9+
510
## What It Does
611

712
Laravel Loop allows you to:
813

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

12-
It also ships with some pre-built tools:
17+
It also ships with some pre-built tools (we are planning to add more and refine the existing ones):
1318

1419
- Expose your data through Laravel Models using our pre-built toolkit (`LaravelModelToolkit`)
1520
- Expose your Filament Resources (`FilamentToolkit`)
@@ -72,17 +77,65 @@ Loop::tool(
7277
);
7378
```
7479

75-
You can also build your own tool classes by ...
80+
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.
7681

7782
```php
78-
use Kirschbaum\Loop\Loop;
83+
use Kirschbaum\Loop\Contracts\Tool;
84+
85+
class HelloTool implements Tool
86+
{
87+
use \Kirschbaum\Loop\Concerns\Makeable;
88+
89+
public function build(): \Prism\Prism\Tool
90+
{
91+
return app(\Prism\Prism\Tool::class)
92+
->as($this->getName())
93+
->for('Says hello to the user')
94+
->withStringParameter('name', 'The name of the user to say hello to.', required: true)
95+
->using(fn (string $name) => "Hello, $name!");
96+
}
7997

98+
public function getName(): string
99+
{
100+
return 'hello';
101+
}
102+
}
80103
```
81104

82-
## MCP (Model Context Protocol) Server
105+
If you want to provide multiple similar tools, you can build a toolkit which returns a collection of tools.
106+
107+
```php
108+
use Kirschbaum\Loop\Collections\ToolCollection;
109+
use Kirschbaum\Loop\Contracts\Toolkit;
110+
111+
class LaravelFactoriesToolkit implements Toolkit
112+
{
113+
use \Kirschbaum\Loop\Concerns\Makeable;
114+
115+
public function getTools(): ToolCollection
116+
{
117+
return new ToolCollection([
118+
HelloTool::make(),
119+
GoodbyeTool::make(),
120+
]);
121+
}
122+
}
123+
```
124+
125+
***
126+
127+
## Connecting to the MCP server
128+
129+
The MCP protocol has two main ways to connect: STDIO and Streamable HTTP.
83130

84131
### STDIO
85132

133+
To run the MCP server using STDIO, you must run the following command:
134+
135+
```bash
136+
php artisan loop:mcp:start
137+
```
138+
86139
To connect Laravel Loop MCP server to Claude Code, for example, you can use the following command:
87140

88141
```bash
@@ -95,9 +148,9 @@ claude mcp add laravel-loop-mcp php /your/full/path/to/laravel/artisan loop:mcp:
95148
claude mcp add laravel-loop-mcp php /your/full/path/to/laravel/artisan loop:mcp:start --debug
96149
```
97150

98-
To add to Cursor, or any (most?) MCP clients with a config file:
151+
To add to Cursor, or any MCP clients with a JSON config file:
99152

100-
```bash
153+
```json
101154
{
102155
"mcpServers": {
103156
"laravel-loop-mcp": {
@@ -116,6 +169,9 @@ To add to Cursor, or any (most?) MCP clients with a config file:
116169

117170
Laravel Loop supports the [streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports) for the MCP protocol, which includes SSE capabilities for client-initiated requests (POST).
118171

172+
> [!IMPORTANT]
173+
> NOTE: The Streamable HTTP transport is new and not yet supported by all MCP clients.
174+
119175
To enable the Streamable HTTP transport, update your `.env` file:
120176

121177
```bash

0 commit comments

Comments
 (0)