Let your AI agent run Laravel snippets, save code, and read logs
Most AI coding work on a Laravel app is still copy-paste: you run a snippet or check a log, then paste the output back into Claude Code, Codex, or Cursor. An MCP server closes that loop. LaraBench can act as one, so your agent works in the real app instead of guessing from pasted text.
If you use an AI agent on a Laravel project, you already know the friction. The model suggests a Tinker snippet. You run it. You paste the output back. It asks for a log line. You copy that in too. The agent is reasoning about your app through a keyhole, and you are the one carrying messages back and forth.
The Model Context Protocol (MCP) is a standard way for an AI client to call tools directly. LaraBench uses it to put your real Laravel app behind a small set of tools the agent can call itself: read the logs, run a snippet, check recent runs, save the fix. You stay in control of what each connection allows.
What an MCP server does for Laravel work
An MCP server exposes tools that an AI client can call during a conversation. Instead of describing a snippet for you to run, the agent runs it, reads the structured result, and keeps going. The LaraBench MCP server does this for a Laravel app: it can see your connections, your saved library, your run history, and your logs, and, if you allow it, run Tinker snippets and Artisan commands in the real app context.
The server is part of the desktop app. It is on by default and listens only on a local socket restricted to your own user account. Nothing is exposed to the network, and you can switch it off entirely from the MCP Server page if you would rather nothing listened.
The tools your agent can call
Eight tools cover the whole surface. Four are reads, free on any plan. Four are writes that need Premium. The list is kept deliberately short, because a large tool surface measurably hurts how well a model picks the right one.
| Tool | Plan | What it does |
|---|---|---|
list_connections | free | See which projects LaraBench can reach, and how much of each is exposed. |
list_saved_items | free | Browse saved snippets and Artisan commands by folder, tag, or search. |
get_run_history | free | Read recent runs with their output, exit codes, and query counts. |
read_logs | free | List and read Laravel log files, filtered by level. |
run_snippet | Premium | Run a Tinker snippet in your app context and get back output and query analysis. |
run_artisan | Premium | Run an Artisan command against a connection. |
run_saved_item | Premium | Run something from your library, filling in any {placeholder} values it needs. |
save_snippet | Premium | Save a snippet or Artisan command back to your library for next time. |
Folders and tags are filters on list_saved_items, not separate tools. That keeps the surface small enough for the agent to use well.
A real loop: debugging a failing job
Here is the kind of task where this earns its place. A queued job is failing in staging and you are not sure why. With the MCP server connected, the agent can work the problem instead of asking you to.
It starts by reading the logs with read_logs, filtered to errors, and finds the exception. It forms a hypothesis: a model lookup is returning null for a specific tenant. It checks that with a snippet, run through Run Code on a dry-run connection, so nothing is written:
$tenant = Tenant::query()
->where('slug', 'acme')
->first();
$tenant?->activeSubscription()?->exists(); The result comes back with output and query analysis attached, so the agent sees not just the value but the SQL behind it. Once the fix is clear, it can save_snippet the reproduction to your library so the next person who hits this starts from the answer, not the logs. Throughout, you are reading the agent's reasoning, not shuttling text between two windows.
read_logs gives the agent the same log files you read in the log viewer, filtered by level. Safety: what the agent can and cannot touch
Giving an agent a shell into your app would be reckless. The MCP server is not that. Every connection has an AI access level you set yourself, and the defaults assume you want to be careful.
- Off: hidden from AI tools entirely. Production connections start here, and turning one on asks you to confirm first.
- Read only: run history and logs are readable, but no code runs.
- Dry run: code runs for real inside a database transaction that is always rolled back, and schema changes are blocked. This is the default for local and staging. It is a database guard, not a full sandbox: HTTP calls, file writes, and mail your snippet triggers still happen.
- Full: code runs normally and writes stick. Never the default; you choose it per connection.
A few rules hold regardless of what the agent asks. A connection set to dry run cannot be talked out of it. Artisan commands cannot be dry run, because there is no transaction to wrap them in, so a connection needs full access before Artisan runs through MCP at all. A write against a full production connection stops and shows a confirmation inside LaraBench before it executes; if the app is closed, the answer is no. Every run an AI tool makes lands in History with an AI badge, next to your own runs. And connection details never leave the app, only the connection's name and how it is exposed. The full model is in the run-safety docs.
Connecting Claude Code, Codex, or Cursor
On the MCP Server page, click the button for the tool you use. LaraBench writes itself into that tool's own MCP configuration and leaves everything else there untouched.
- Claude Code: one click updates both Claude Code and Claude Desktop. Restart whichever you use.
- Codex: one click writes LaraBench into Codex's config file alongside anything else you have there.
- Cursor: one click adds LaraBench to Cursor's MCP configuration.
For any other MCP-compatible client, Show config prints the exact JSON to paste in by hand. The command it points at is the LaraBench app itself with an --mcp-stdio flag, so there is nothing extra to install. Restart the tool afterwards to pick up the change.
What's free, and what needs the app open
The server is free and on by default, so browsing your library or reading history from an AI tool never requires an upgrade. The four read tools are free on any plan. Running code and saving snippets need Premium.
There is also a practical split. Reading your connections, saved items, and local run history works whether or not LaraBench is running. Running code, reading logs on SSH or Docker targets, and saving to your library all need the app open, because LaraBench is the only process allowed to run against your projects and write to your local data.
Read logs and history
The agent reads Laravel logs and recent runs directly, filtered by level, so it debugs from real output.
Run snippets and Artisan
Run a Tinker snippet or an Artisan command in the real app context, with output and query analysis returned.
Save the fix
Save a working snippet back to your library so the next run starts from the answer.
Production off by default
Production is hidden until you opt in, dry run is the default elsewhere, and writes wait for a human.
FAQ
Is it safe to give an AI agent access to my Laravel app?
It is as safe as you set it to be, per connection. Production starts as Off and has to be opted in. Local and staging default to dry run, where writes are rolled back and schema changes are blocked. A write against a full production connection still stops for a human confirmation in the app.
Which AI tools work with the LaraBench MCP server?
Claude Code, Claude Desktop, Codex, and Cursor have one-click setup. Any other MCP-compatible client works too; Show config prints the JSON to paste in.
Does LaraBench need to be open for the agent to work?
Reading connections, saved items, and run history works with the app closed. Running code, reading logs on SSH or Docker targets, and saving to your library need the app open.
Can the agent touch production?
Only if you decide it can. Production connections start Off, opting in asks for confirmation, and a write still waits for a human to approve it in the app. If the app is closed, nothing runs.
Is the MCP server free?
Yes. The server is free and on by default, and the four read tools are free on any plan. Running code and saving snippets through an AI tool need Premium and the app open.
// try it
Connect your agent to one Laravel project.
Download LaraBench, open the MCP Server page, and connect Claude Code, Codex, or Cursor in one click. Start with a dry-run local connection and let the agent read a log or run a snippet.