定制 skylence/laravel-model-inspector-mcp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

skylence/laravel-model-inspector-mcp

Composer 安装命令:

composer require skylence/laravel-model-inspector-mcp

包简介

MCP server for Laravel model introspection — relationships, attributes, scopes, observers, and database schema

README 文档

README

An MCP (Model Context Protocol) server that gives AI coding assistants deep introspection into your Laravel application's Eloquent models, relationships, and database schema.

What it does

Exposes four tools to any MCP-compatible client (Claude Code, Cursor, VS Code, PhpStorm, etc.):

Tool Description
eloquent-list-models List all Eloquent models with their tables and relationship counts. Auto-discovers models from Composer PSR-4 autoload paths.
eloquent-inspect-model Inspect a model's columns, fillable/guarded, casts, relationships, scopes, observers, and policy.
eloquent-get-relationships Map relationships for one or more models: types, foreign keys, pivot tables, morph types.
eloquent-get-table-schema Get the database schema for a model or table: columns, types, indexes, and foreign keys.

Models are auto-discovered from all Composer PSR-4 namespaces containing Models in the path — your app models and vendor package models are found automatically without configuration.

Requirements

  • PHP 8.2+
  • Laravel 11 or 12
  • laravel/mcp ^0.3.0 or ^0.5.0

Installation

composer require skylence/laravel-model-inspector-mcp --dev

Quick setup with the install command

php artisan model-inspector:install

This detects your IDE (Claude Code, Cursor, VS Code, PhpStorm) and configures the MCP server automatically.

Manual setup

Add to your .mcp.json in the project root:

{
    "mcpServers": {
        "laravel-model-inspector-mcp": {
            "command": "php",
            "args": ["artisan", "model-inspector:mcp"]
        }
    }
}

If using Laravel Sail:

{
    "mcpServers": {
        "laravel-model-inspector-mcp": {
            "command": "./vendor/bin/sail",
            "args": ["artisan", "model-inspector:mcp"]
        }
    }
}

Restart your editor/AI tool to connect to the MCP server.

Configuration

Publish the config file (optional):

php artisan vendor:publish --tag=model-inspector-mcp-config
// config/model-inspector-mcp.php
return [
    // Disable specific tools
    'tools' => [
        'model-discovery' => true,
        'model-inspector' => true,
        'relationship-map' => true,
        'schema-inspector' => true,
    ],

    // Add paths for models outside standard PSR-4 "Models" directories
    'extra_model_paths' => [
        // 'packages/my-package/src/Entities',
    ],
];

Usage examples

Once connected, your AI assistant can use the tools automatically. You can also prompt it directly:

  • "List all models in this project" — calls eloquent-list-models
  • "Show me the Order model's relationships" — calls eloquent-get-relationships
  • "What columns does the sales_orders table have?" — calls eloquent-get-table-schema
  • "Inspect the Customer model" — calls eloquent-inspect-model

Security

MCP routes are only registered in local and testing environments. The MCP server runs over stdio and is not exposed over HTTP.

License

MIT

统计信息

  • 总下载量: 577
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固