mcp-server-laravel
Enables AI assistants to introspect a Laravel application's routes, models, controllers, migrations, and more through the Model Context Protocol, running locally via php artisan commands and filesystem scanning.
README
mcp-server-laravel
<div align="center"> <img src="demo.gif" width="720" alt="Laravel Codebase MCP Server Demo"> <br> <em>Browse routes, models, controllers, migrations via MCP</em> </div>
Laravel Codebase MCP Server — introspect routes, models, controllers, migrations, and more through the Model Context Protocol. Works with any AI client that supports MCP: opencode, Claude Desktop, Cursor, and others.
Stop grepping your Laravel codebase. Let your AI assistant answer "what routes exist?", "show me the User model", or "list all migrations" instantly.
Quick Start
# Install
npx mcp-server-laravel-codebase
# Or clone
git clone git@github.com:rendi-febrian/mcp-server-laravel-codebase.git
cd mcp-server-laravel-codebase
npm install && npm run build
opencode Configuration
Add to ~/.config/opencode/opencode.json:
{
"mcp": {
"laravel-codebase": {
"type": "local",
"command": ["node", "/path/to/mcp-server-laravel/dist/index.js"],
"environment": {
"LARAVEL_PROJECT_PATH": "/path/to/your/laravel-project"
},
"enabled": true
}
}
}
Claude Desktop / Cursor / Other MCP Clients
{
"mcpServers": {
"laravel-codebase": {
"command": "node",
"args": ["/path/to/mcp-server-laravel/dist/index.js"],
"env": {
"LARAVEL_PROJECT_PATH": "/path/to/your/laravel-project"
}
}
}
}
Features
Tools
| Tool | Description | Example |
|---|---|---|
routes_list |
All routes with method, URI, controller, middleware | routes_list(method: "GET") |
models_list |
All Eloquent models with paths and namespaces | models_list() |
model_detail |
Single model: columns, relations, casts, policies | model_detail(name: "User") |
controllers_list |
Controllers with optional route mapping | controllers_list(detail: true) |
app_about |
Laravel version, env, packages, config | app_about() |
migrations_list |
Migration status (ran/pending) | migrations_list() |
schedule_list |
Scheduled tasks with frequency | schedule_list() |
events_list |
Events and registered listeners | events_list() |
middleware_list |
Middleware aliases with class names | middleware_list() |
commands_list |
All registered Artisan commands | commands_list(filter: "make") |
artisan_run |
Run read-only Artisan commands | artisan_run(command: "route:list --json") |
Resources
| URI | Content |
|---|---|
laravel://about |
Application info (version, env, drivers) |
laravel://routes |
Full route table as JSON |
Security
artisan_run is restricted to read-only commands:
route:list · model:show · about · migrate:status · schedule:list · event:list · middleware · db:show · db:table · config:show · queue:failed · package:discover
Write operations (migrate, make:*, db:wipe, etc.) are blocked.
Requirements
- Node.js >= 18
- PHP 8.1+ with
phpon PATH - A Laravel project (Laravel 9/10/11/12/13)
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
LARAVEL_PROJECT_PATH |
Yes | — | Absolute path to Laravel project root |
PHP_BINARY |
No | php |
Path to PHP binary |
Switching Projects
Point LARAVEL_PROJECT_PATH at any Laravel project. No rebuild needed.
// Inspect FlightManagement API
"LARAVEL_PROJECT_PATH": "/home/user/Kerjaan/FlightManagement"
// Inspect admin panel
"LARAVEL_PROJECT_PATH": "/home/user/Projects/admin-panel"
Architecture
src/
├── index.ts # MCP server entry point (raw Server)
├── artisan.ts # PHP exec wrapper + whitelist
├── scanner.ts # Laravel filesystem scanner
├── tools/
│ ├── routes.ts # routes_list, routes_cache, routes_clear
│ ├── models.ts # models_list, model_detail
│ ├── controllers.ts # controllers_list
│ ├── migrations.ts # migrations_list
│ ├── schedule.ts # schedule_list
│ ├── events.ts # events_list
│ ├── middleware.ts # middleware_list
│ ├── about.ts # app_about
│ ├── commands.ts # commands_list
│ └── artisan.ts # artisan_run
└── resources/
└── index.ts # laravel:// URIs
No external API calls — everything runs locally via php artisan commands and filesystem scanning.
Contributing
See CONTRIBUTING.md.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。