PHPackages                             dhur-gham/laravel-mcp-api-docs - 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. [API Development](/categories/api)
4. /
5. dhur-gham/laravel-mcp-api-docs

ActiveLibrary[API Development](/categories/api)

dhur-gham/laravel-mcp-api-docs
==============================

Laravel MCP API Documentation package

1.4(4mo ago)31.4k↑385.7%[2 PRs](https://github.com/dhur-gham/laravel-mcp-api-docs/pulls)MITPHPPHP ^8.3CI passing

Since Feb 14Pushed 1w agoCompare

[ Source](https://github.com/dhur-gham/laravel-mcp-api-docs)[ Packagist](https://packagist.org/packages/dhur-gham/laravel-mcp-api-docs)[ GitHub Sponsors](https://github.com/:vendor_name)[ RSS](/packages/dhur-gham-laravel-mcp-api-docs/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (5)Dependencies (14)Versions (12)Used By (0)

Laravel MCP API Docs
====================

[](#laravel-mcp-api-docs)

Exposes your app’s OpenAPI spec to Laravel MCP via tools and a resource so the AI uses the canonical API contract (no guessing endpoints or payloads).

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

[](#requirements)

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

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

[](#installation)

```
composer require dhur-gham/laravel-mcp-api-docs
```

Publish the config (optional; defaults work out of the box):

```
php artisan vendor:publish --tag="laravel-mcp-api-docs-config"
```

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

[](#configuration)

After publishing, edit `config/mcp-api-docs.php`:

KeyEnvDescription`enabled``MCP_API_DOCS_ENABLED`Enable/disable the MCP API Docs server (default: `true`).`path``MCP_API_DOCS_PATH`Web route path for the MCP server (default: `/mcp/api-docs`).`middleware``MCP_API_DOCS_MIDDLEWARE`Comma-separated middleware, e.g. `auth:sanctum`.`policy_ability``MCP_API_DOCS_POLICY_ABILITY`Gate ability (e.g. `useMcpApiDocs`) required after auth; user must be allowed by policy. Omit or null to skip.`openapi.file``MCP_API_DOCS_OPENAPI_FILE`Absolute path to a local OpenAPI JSON file.`openapi.url``MCP_API_DOCS_OPENAPI_URL`URL to fetch OpenAPI JSON from.`docs_folder``MCP_API_DOCS_DOCS_FOLDER`Path to folder of feature docs (e.g. `DocsForMcp`); each `.md` file = one feature. Omit or null = docs tools are not registered.If neither `openapi.file` nor `openapi.url` is set, the package looks for `openapi.json` in `public/`, project root, `storage/app/`, and `storage/app/api-docs/`.

### Policy (optional)

[](#policy-optional)

To require the authenticated user to be allowed by a Laravel policy (not just a valid token), set `policy_ability` (e.g. `MCP_API_DOCS_POLICY_ABILITY=useMcpApiDocs`). Then define the ability in a policy and register it:

```
// app/Policies/UserPolicy.php
public function useMcpApiDocs(User $user): bool
{
    return $user->hasPermission('use_mcp'); // your logic
}
```

```
// app/Providers/AuthServiceProvider.php
protected $policies = [
    User::class => UserPolicy::class,
];
```

Middleware order: first `auth:sanctum` (token → user), then `can:useMcpApiDocs` (policy check).

MCP Behaviour
-------------

[](#mcp-behaviour)

Read-only API info for AI agents to implement against (no real HTTP requests).

- **Tools**
    - `list_tags()` – list tags and their endpoints (method, path, operationId, summary).
    - `search_endpoints(query)` – discover endpoints by keyword (path, summary, operationId, tags).
    - `get_endpoint(method, path)` – full request/response schema for one endpoint.
    - `get_endpoints(tag)` or `get_endpoints(paths: [{method, path}, ...])` – bulk schema for up to 25 endpoints (by tag or explicit list).
    - `list_docs()` – list feature doc names from the DocsForMcp folder (when `docs_folder` is set). Returns `name` (filename without `.md`) and `summary` (first heading).
    - `get_doc(name)` – return the markdown content of a feature doc by name.
- **Resources**
    - `api://openapi/catalog` – servers + flat list of all operations (method, path, summary, operationId, tags) for fast scan.
    - `api://openapi` – full OpenAPI spec.

Usage in AI IDEs (Cursor, etc.)
-------------------------------

[](#usage-in-ai-ides-cursor-etc)

Point your IDE’s MCP config at your app’s MCP route. With **auth:sanctum** and a personal access token:

**Cursor** – add a server in `~/.cursor/mcp.json` (or project `.cursor/mcp.json`):

```
{
  "mcpServers": {
    "your-app-api-docs": {
      "transport": "streamable-http",
      "url": "http://127.0.0.1:8000/mcp/api-docs",
      "headers": {
        "Authorization": "Bearer YOUR_SANCTUM_TOKEN"
      }
    }
  }
}
```

Replace `YOUR_SANCTUM_TOKEN` with a Laravel Sanctum personal access token (e.g. from `users` → create token). Use your real app URL if not local (e.g. `https://api.example.com/mcp/api-docs`). The server name (`your-app-api-docs`) is only a label.

License
-------

[](#license)

MIT.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance88

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 65% 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 ~1 days

Total

5

Last Release

138d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/204501209?v=4)[dhurgham](/maintainers/dhur-gham)[@dhur-gham](https://github.com/dhur-gham)

---

Top Contributors

[![dhur-gham](https://avatars.githubusercontent.com/u/204501209?v=4)](https://github.com/dhur-gham "dhur-gham (13 commits)")[![dhurgham-miswag](https://avatars.githubusercontent.com/u/180981015?v=4)](https://github.com/dhurgham-miswag "dhurgham-miswag (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/dhur-gham-laravel-mcp-api-docs/health.svg)

```
[![Health](https://phpackages.com/badges/dhur-gham-laravel-mcp-api-docs/health.svg)](https://phpackages.com/packages/dhur-gham-laravel-mcp-api-docs)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M102](/packages/dedoc-scramble)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816334.1k3](/packages/defstudio-telegraph)[binaryk/laravel-restify

Laravel REST API helpers

677415.0k](/packages/binaryk-laravel-restify)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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