Laravel Codebase Introspection
Introspects Laravel codebases to provide structured information about views, routes, classes, and models using the mateffy/laravel-introspect package.
MCP Server for Laravel Codebase Intelligence and Introspection
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.
- π Let AI query views, routes, classes and models without needing to read through all of the code
- π Can even use wildcards (
*) to match multiple views, routes, classes and models - π Supports querying for things from Laravel packages, which most file searchers can't do
- πͺ Gives your AI quick overviews of your datamodel and its relationships
- π€ Supports any AI agent implementing the MCP protocol
| Query | 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)
Who is this for?
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.
Example tasks
- Give your AI an overview of your datamodel and its relationships
- Refactoring views and making sure it's not used anywhere else
- Finding all routes that use a specific controller
- Finding models that use a specific trait or interface
- Making sure all routes are using the correct middleware
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.
Installation
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-mcpby 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!
Available queries
If you want to see all available queries, please check the laravel-introspect package documentation.
Acknowledgements
The MCP server uses the php-mcp/server package to implement the MCP protocol.
License
The MIT License (MIT). Please see License File for more information.
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
APIWeaver
Dynamically creates MCP servers from web API configurations, integrating any REST API, GraphQL endpoint, or web service into MCP-compatible tools.
ui-ticket-mcp
Human-to-AI code review bridge. Review UI prototypes in the browser, then let AI agents fix the code automatically via MCP.
mcp-of-mcps
MCP of MCPs is a meta-server that merges all your MCP servers into a single smart endpoint.β¨It gives AI agents instant tool discovery, selective schema loading, and massively cheaper execution, so you stop wasting tokens and time. With persistent tool metadata, semantic search, and direct code execution between tools, it turns chaotic multi-server setups into a fast, efficient, hallucination-free workflow.β¨It also automatically analyzes the tools output schemas if not exist and preserves them across sessions for consistent behavior.
Notifly MCP Server
Notifly MCP Server - enabling AI agents to provide real-time, trusted Notifly documentation and SDK code examples for seamless integrations.
Claude Code History
Retrieve and analyze Claude Code conversation history from local files.
Grafana
Search dashboards, investigate incidents and query datasources in your Grafana instance
Terry-Form MCP
Execute Terraform commands locally in a secure, containerized environment. Features LSP integration for intelligent Terraform development.
Divvi MCP Server
Automatically integrate the Divvi referral SDK into JavaScript and TypeScript blockchain applications.
1MCP
A unified MCP server that aggregates multiple MCP servers into a single endpoint.
rxjs-mcp-server
Execute, debug, and visualize RxJS streams directly from AI assistants like Claude.