PHPackages                             abr4xas/mcp-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. abr4xas/mcp-tools

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

abr4xas/mcp-tools
=================

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

v2.0.0(3mo ago)345[2 PRs](https://github.com/abr4xas/mcp-tools/pulls)MITPHPPHP ^8.4CI passing

Since Dec 14Pushed 1mo agoCompare

[ Source](https://github.com/abr4xas/mcp-tools)[ Packagist](https://packagist.org/packages/abr4xas/mcp-tools)[ Docs](https://github.com/abr4xas/mcp-tools)[ Fund](https://angelcruz.dev/donate)[ RSS](/packages/abr4xas-mcp-tools/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (14)Versions (10)Used By (0)

  ![Logo for essentials](art/banner-light.png)MCP Tools
=========

[](#mcp-tools)

A Laravel package for generating and managing API contracts with MCP (Model Context Protocol) integration.

[![Latest Version on Packagist](https://camo.githubusercontent.com/5faabadaddb149a7b44297b33c6f641fe67b56e84506b6b8b5c0a06be398c52c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616272347861732f6d63702d746f6f6c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abr4xas/mcp-tools)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ef879461d7a0f4ffa2f1b562541d17eb4c07ff2bee1a28c46b78b7015cbaa601/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616272347861732f6d63702d746f6f6c732f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/abr4xas/mcp-tools/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/fcacd7fe62f0b531d2817329bfa6c1d07f50f4c0ffda5e8e7d4cea940fe63495/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616272347861732f6d63702d746f6f6c732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/abr4xas/mcp-tools/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/58d95b6451d6c45a2ee0b0493a2f617cfbcbc924d3479919cff42e7886b24d4d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616272347861732f6d63702d746f6f6c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abr4xas/mcp-tools)

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](https://github.com/laravel/mcp) configured in your project.

Features
--------

[](#features)

- **Automatic API Contract Generation**: Generate comprehensive API contracts from your Laravel routes
- **MCP Tools Integration**: List and describe API routes through MCP tools
- **Advanced Analysis**: Deep analysis of routes, FormRequests, Resources, and middleware
- **OpenAPI Export**: Export contracts to OpenAPI 3.0 format
- **Caching**: Intelligent caching for improved performance
- **Validation**: JSON Schema validation for generated contracts

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 11.x or 12.x
- [Laravel MCP](https://github.com/laravel/mcp) ^0.5.1

Installation
------------

[](#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
-----

[](#usage)

### Generate API Contract

[](#generate-api-contract)

Generate a comprehensive API contract from your Laravel routes:

```
php artisan api:contract:generate
```

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`

**Options:**

- `--incremental`: Only update routes that have been modified
- `--log`: Enable detailed logging
- `--dry-run`: Validate without writing file
- `--validate-schemas`: Validate generated schemas against JSON Schema

### Export to OpenAPI

[](#export-to-openapi)

```
php artisan api:export-openapi
```

### Clear Cache

[](#clear-cache)

```
php artisan mcp-tools:clear-cache
```

### Health Check

[](#health-check)

```
php artisan mcp-tools:health-check
```

### View Metrics

[](#view-metrics)

```
php artisan mcp-tools:metrics
```

### Manage Contract Versions

[](#manage-contract-versions)

```
php artisan api:contract:versions
```

### View Logs

[](#view-logs)

```
php artisan mcp-tools:logs
```

MCP Tools
---------

[](#mcp-tools-1)

The package provides MCP tools that must be manually registered in your Laravel MCP server configuration.

Important

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

### 1. `list-api-routes`

[](#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)
- `page` (optional): Page number for pagination (default: 1)

**Example:**

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

### 2. `describe-api-route`

[](#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)
- Rate limiting information
- HTTP status codes
- Content negotiation

### Registering MCP Tools

[](#registering-mcp-tools)

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

#### Troubleshooting

[](#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)

Configuration
-------------

[](#configuration)

The package automatically detects and includes in contracts:

- Route parameters and types
- Authentication requirements (derived from middleware analysis)
- Rate limiting information
- Request validation rules (from FormRequests)
- Response schemas (from Resources)
- HTTP status codes
- Custom headers
- Content negotiation
- API versioning

API Contract Structure
----------------------

[](#api-contract-structure)

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

```
{
    "/api/v1/users": {
        "GET": {
            "description": "List all users",
            "deprecated": null,
            "auth": { "type": "bearer" },
            "path_parameters": {},
            "request_schema": {
                "location": "query",
                "properties": {}
            },
            "response_schema": {
                "type": "array",
                "items": {}
            },
            "response_headers": [],
            "custom_headers": [],
            "rate_limit": null,
            "api_version": "v1",
            "status_codes": {
                "200": "OK",
                "401": "Unauthorized"
            },
            "content_negotiation": []
        },
        "POST": {
            "description": "Create a new user",
            "deprecated": null,
            "auth": { "type": "bearer" },
            "path_parameters": {},
            "request_schema": {
                "location": "body",
                "properties": {
                    "name": { "type": "string", "required": true },
                    "email": { "type": "string", "format": "email", "required": true }
                }
            },
            "response_schema": { "type": "object", "properties": {} },
            "response_headers": [],
            "custom_headers": [],
            "rate_limit": null,
            "api_version": "v1",
            "status_codes": {
                "201": "Created",
                "422": "Unprocessable Entity"
            },
            "content_negotiation": []
        }
    },
    "/api/v1/users/{user}": {
        "GET": {
            "description": "Get user details",
            "deprecated": null,
            "auth": { "type": "bearer" },
            "path_parameters": {
                "user": { "type": "integer", "required": true }
            },
            "request_schema": { "location": "query", "properties": {} },
            "response_schema": { "type": "object", "properties": {} },
            "response_headers": [],
            "custom_headers": [],
            "rate_limit": null,
            "api_version": "v1",
            "status_codes": {
                "200": "OK",
                "404": "Not Found"
            },
            "content_negotiation": []
        }
    }
}
```

Extending
---------

[](#extending)

### Custom Schema Transformers

[](#custom-schema-transformers)

Create a transformer implementing `SchemaTransformerInterface`:

```
use Abr4xas\McpTools\Interfaces\SchemaTransformerInterface;

class CustomTransformer implements SchemaTransformerInterface
{
    public function transform(array $schema): array
    {
        // Transform schema
        return $schema;
    }

    public function getPriority(): int
    {
        return 100;
    }
}
```

Register it in your service provider:

```
$this->app->make(SchemaTransformerRegistry::class)
    ->register(new CustomTransformer());
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Run tests with coverage:

```
vendor/bin/pest --coverage
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Angel](https://github.com/abr4xas)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance85

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Total

3

Last Release

98d ago

Major Versions

v0.1.0 → v1.0.02025-12-23

v1.0.0 → v2.0.02026-01-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d947508ce4076ed67ec719eb2c74696e025dab397eabc921d483545fb4c403f?d=identicon)[abr4xas](/maintainers/abr4xas)

---

Top Contributors

[![abr4xas](https://avatars.githubusercontent.com/u/405484?v=4)](https://github.com/abr4xas "abr4xas (16 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelmcpmcp-toolslaravelabr4xasmcp-tools

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/abr4xas-mcp-tools/health.svg)

```
[![Health](https://phpackages.com/badges/abr4xas-mcp-tools/health.svg)](https://phpackages.com/packages/abr4xas-mcp-tools)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M626](/packages/spatie-laravel-data)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

188.5k](/packages/tarfin-labs-event-machine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
