Introspects Laravel codebases to provide structured information about views, routes, classes, and models using the mateffy/laravel-introspect package.
For AIs to make sense of your codebase, they need to be able to know what's in it. While vector search is a powerful tool for searching through code, it uses a lot of tokens and doesn't even give you the full picture of your codebase for things like views or routes. This package implements a Model Context Protocol (MCP) server for the mateffy/laravel-introspect package, which allows you to introspect your codebase and get structured information about it.
*
) to match multiple views, routes, classes and modelsQuery | Available Filters |
---|---|
Views | name, path, used by view, uses view, extends |
Routes | name, URI, controller + fn, methods, middleware |
Classes | name / namespace, extends parent, implements interfaces, uses traits |
โคท Models | ... relationships, properties, casts, fillable, hidden, read/writeable |
โคท Commands | ... signature, description (coming soon) |
Name and a few other queries even support wildcard queries (e.g.
components.*.paragraph
)
If you use AI tools like Aider, Cursor, Windsurf or Claude Code to help you build your app, this package is for you. Simply configure the MCP server in your agent and it can automatically query your codebase for views, routes, classes and models.
This is especially useful for large codebases where just searching through the code is less practical.
laravel-codebase-mcp
vs. laravel-introspect
The MCP server uses the laravel-introspect
package to introspect your codebase and get structured information about it.
If you want to write tests or run the same queries multiple times, you can also just use the package directly.
Install the package via composer:
composer require mateffy/laravel-codebase-mcp --dev
[!NOTE]
At the moment, there is a dependency issue with
php-mcp/server
(#23) and ReactPHP (#542). You may temporarily need to use these patched forks if you run into issues when installinglaravel-codebase-mcp
by adding the following to yourcomposer.json
:{ "repositories": [ { "type": "vcs", "url": "https://github.com/leantime/php-mcp-server.git" }, { "type": "vcs", "url": "https://github.com/Leantime/reactphp-http.git" } ] }
And then add it to your AI agent's MCP configuration:
{
"mcpServers": {
"laravel-introspect": {
"command": "php",
"args": [
"/path/to/your/codebase/artisan",
"introspect:mcp"
]
}
}
}
[!IMPORTANT]
The MCP server is still in beta, there will probably be bugs!
If you want to see all available queries, please check the laravel-introspect
package documentation.
The MCP server uses the php-mcp/server package to implement the MCP protocol.
The MIT License (MIT). Please see License File for more information.
Reference implementations of Model Context Protocol (MCP) servers in Typescript and Python, showcasing MCP features and SDK usage.
Integrates with the Neo N3 blockchain for wallet management, asset transfers, contract interactions, and blockchain queries.
An MCP (Model Context Protocol) aggregator that allows you to combine multiple MCP servers into a single endpoint allowing to filter specific tools.
Reference / test server with prompts, resources, and tools
Generate images using Amazon Nova Canvas with text prompts and color guidance.
Enable AI agents to interact with the Atla API for state-of-the-art LLMJ evaluation.
Equip AI agents with evaluation and self-improvement capabilities with Root Signals.
Integrates ComfyUI with MCP, allowing the use of custom workflows. Requires a running ComfyUI server.
Generate and edit images using OpenAI's GPT-4o image generation and editing APIs with advanced prompt control.
Create and read feature flags, review experiments, generate flag types, search docs, and interact with GrowthBook's feature flagging and experimentation platform.