An MCP server for PHP and Laravel.

Tinkr ships a Model Context Protocol server, so the AI tool you already work in can run PHP the way you do: in your project's own Tinker session, locally or over SSH, with the returned value as data.

Set it up

The easy way: open Settings → MCP in Tinkr. It lists the clients it knows, writes the config for the one you pick, and gives you the JSON for anything else.

It knows Claude Code, Claude Desktop, Cursor, Windsurf and VS Code.

By hand:

mcp.json
{
  "mcpServers": {
    "tinkr": {
      "command": "node",
      "args": ["/path/to/tinkr/packages/tinkr-mcp/src/cli.js"]
    }
  }
}

The directory the client starts it in is the project code runs in. No API token, no open window needed.

Tools

Tool What it does
tinkr_documentation How Tinkr works and how to use these tools: the guards, connections, every tool, how to read an answer
tinkr_run_php Run PHP in a local project: what every statement returned, and what the code printed
tinkr_run_php_over_ssh The same, on a server, through one of Tinkr's SSH connections
tinkr_list_history The runs the app kept for a connection: the code, when it ran, how it ended
tinkr_read_run One kept run in full: what it returned, printed and threw
tinkr_list_connections The connections saved in the app, with the command each session starts with
tinkr_list_snippets The snippets saved for a connection
tinkr_save_snippet Keep code as a snippet of a connection

Guards

tinkr_run_php and tinkr_run_php_over_ssh take an optional guard.

rollback
Runs the code inside a transaction that is taken back at the end, and reports what that transaction did. The safe way for an agent to look at production without changing it.
sandbox
The same transaction, with the side-effect drivers swapped for recorders first: mail, jobs, the HTTP client, every disk, the cache and the log. A write that was rolled back cannot still have sent an email. The answer carries what was caught.

A transaction holds the database and nothing else, so sandbox is the guard to name when the code might send, queue, call or write something.

Production

A connection tagged production is refused unless the server was started on that connection with --connection, or with --allow-production. A run there is a write nobody is watching.

Options

Option What it does
--connection <id|name> Run in a connection the app knows, by id or name
--path <directory> The project to run in (default: where the client started it)
--command <command> What the session starts with (default: the connection's own, or php artisan tinker)
--data-dir <directory> Where the app keeps its connections and snippets, if not the default
--timeout <ms> How long a run may take before it is given up (default: 60000)
--allow-production Run code on connections tagged production

Try it from a terminal

terminal
yarn mcp --path /path/to/your/project

When Tinkr has a connection for that directory, the server uses it, so snippets and history are shared with the app.

Get Tinkr, and the server comes with it.

Download Tinkr

v0.4.3 · Free and open source · All platforms