Sponsored by Deepsite.site

Laravel Codebase Introspection and Analysis

Created By
capevace6 months ago
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 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)
Content

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

QueryAvailable Filters
Viewsname, path, used by view, uses view, extends
Routesname, URI, controller + fn, methods, middleware
Classesname / 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 installing laravel-codebase-mcp by adding the following to your composer.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.

Server Config

{
  "mcpServers": {
    "laravel-introspect": {
      "command": "php",
      "args": [
        "/path/to/your/codebase/artisan",
        "introspect:mcp"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
DeepChatYour AI Partner on Desktop
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Amap Maps高德地图官方 MCP Server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
ChatWiseThe second fastest AI chatbot™
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Serper MCP ServerA Serper MCP Server
Tavily Mcp