Laravel MCP server: code graph for AI agents

TL;DR. When an AI agent needs to modify a Laravel controller or service, which models, FormRequests, and migrations are affected? trace-mcp indexes your existing Laravel repository into a local static code graph. AI coding agents query route-to-controller bindings, Eloquent model associations, and validation rules through MCP without dumping entire directories into the prompt.


What trace-mcp extracts in Laravel

Laravel relies on convention, facades, and dynamic magic that raw text search cannot connect. The laravel plugin extracts:


Installation & Quickstart

Install trace-mcp globally, run initialization, and connect your Laravel repository:

npm i -g trace-mcp && trace init && trace add

Example question to your agent

“Which Eloquent models, migrations, and FormRequests are affected if I modify the payment transaction status transitions, and what controllers route to it?”

The agent calls trace-mcp tools like get_symbol, get_call_graph, or get_change_impact to inspect the exact subgraph without reading irrelevant controllers or models.


Without graph vs with trace-mcp

Measurements below reflect corpus-level benchmarks from our PR review context benchmark across 60 pull requests.

Capability Without graph With trace-mcp
Median input tokens ~13595 tokens ~3291 tokens (-72.7%)
Eloquent relations Guesses via grep Exact relational graph edges
Route to Controller mapping Relies on exact text search Resolves closures, namespaces, groups
FormRequest validation Must load request file manually Automatic caller-to-request edge
Livewire & Filament context Misses view-to-component linkage Explicit component and action edges
Tools exposed None (reads full files) 182 specialized MCP tools

Frequently asked questions

Does trace-mcp support Laravel 11 and 12/13 with bootstrap/app.php?

Yes. trace-mcp extracts routing, middleware, and exception configurations from modern bootstrap/app.php definitions (withRouting, withMiddleware) as well as classic app/Http/Kernel.php and RouteServiceProvider setups.

How does trace-mcp resolve Eloquent relationships?

The indexer inspects Eloquent model method calls like hasMany, belongsTo, belongsToMany, and hasOne, linking related models across files and cross-referencing migration schemas.

Does trace-mcp understand Livewire and Filament in Laravel?

Yes. Dedicated sub-plugins index Livewire component classes, properties, actions, and Blade views, as well as Filament resources, relation managers, panels, and widgets.


Next steps

Explore the full Tools reference for available query tools, see the Language capability matrix for PHP AST details, view Comparisons against other tools, or browse all Supported frameworks.

Catalogue: Articles / frameworks

Last updated: October 20, 2026