定制 abr4xas/mcp-tools 二次开发

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

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

abr4xas/mcp-tools

最新稳定版本:v1.0.0

Composer 安装命令:

composer require abr4xas/mcp-tools

包简介

A collection of MCP (Model Context Protocol) tools for Laravel development

README 文档

README

Logo for essentials

MCP Tools for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A growing collection of Model Context Protocol (MCP) tools designed to enhance Laravel development with AI assistance. This package provides ready-to-use MCP tools that integrate seamlessly with your Laravel MCP server.

Important

This package provides MCP tools that must be registered in your project's MCP server. It does not create or run an MCP server itself - you need to have Laravel MCP configured in your project.

What's Included

Currently, this package focuses on API development tools, with more tools planned for future releases:

API Tools

  • API Contract Generation: Automatically scan Laravel routes and generate comprehensive API documentation
  • Route Discovery: List and filter API routes by method, version, and search terms
  • Route Description: Get detailed endpoint information including auth, parameters, and schemas

Coming Soon

More MCP tools will be added to assist with various aspects of Laravel development.

Installation

Install the package via composer:

composer require abr4xas/mcp-tools

The package will automatically register its service provider. However, the MCP tools must be manually registered in your project's MCP server configuration.

Usage

API Contract Generation

Generate a comprehensive API contract from your Laravel routes:

php artisan api:generate-contract

This command will:

  • Scan all your application routes
  • Extract route information (methods, paths, parameters)
  • Analyze controller methods and FormRequest classes
  • Generate authentication requirements
  • Create a JSON file at storage/api-contracts/api.json

Available MCP Tools

Once installed, the package provides these MCP tools. You must register them manually in your Laravel MCP server configuration:

1. list-api-routes

Lists all API routes with optional filtering.

Arguments:

  • method (optional): Filter by HTTP method (GET, POST, PUT, DELETE, PATCH)
  • version (optional): Filter by API version (v1, v2, etc.)
  • search (optional): Search term to filter routes by path
  • limit (optional): Maximum number of results (default: 50, max: 200)

Example:

{
    "method": "GET",
    "version": "v1",
    "search": "users",
    "limit": 10
}

2. describe-api-route

Get detailed information about a specific endpoint.

Arguments:

  • path (required): The API route path (e.g., /api/v1/users/{user})
  • method (optional): HTTP method (defaults to GET)

Example:

{
    "path": "/api/v1/users/{user}",
    "method": "GET"
}

Response includes:

  • Route description
  • API version
  • Authentication requirements
  • Path parameters with types
  • Request/response schemas (if available)

Registering MCP Tools

The MCP tools provided by this package must be manually registered in your Laravel MCP server configuration.

Important

Verify registration by checking your MCP server's available tools list.

Troubleshooting

If you encounter issues registering the tools:

  • Tools not appearing: Ensure the MCP server configuration file is being loaded correctly
  • Class not found errors: Run composer dump-autoload to refresh the autoloader
  • Service provider not registered: Check that Abr4xas\McpTools\McpToolsServiceProvider is in your config/app.php providers array (should be auto-discovered)

Important

The service provider is automatically registered by Laravel, but the MCP tools themselves require manual registration in your MCP server configuration.

API Contract Structure

The generated contract at storage/api-contracts/api.json follows this structure:

{
    "/api/v1/users": {
        "GET": {
            "description": "List all users",
            "api_version": "v1",
            "auth": {
                "type": "bearer"
            },
            "path_parameters": {}
        },
        "POST": {
            "description": "Create a new user",
            "api_version": "v1",
            "auth": {
                "type": "bearer"
            },
            "request_schema": {...},
            "response_schema": {...}
        }
    },
    "/api/v1/users/{user}": {
        "GET": {
            "description": "Get user details",
            "api_version": "v1",
            "auth": {
                "type": "bearer"
            },
            "path_parameters": {
                "user": {
                    "type": "integer"
                }
            }
        }
    }
}

Requirements

Testing

composer test

Run tests with coverage:

vendor/bin/pest --coverage

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-14