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(2mo ago)363—0%[1 PRs](https://github.com/dhur-gham/laravel-mcp-api-docs/pulls)MITPHPPHP ^8.3CI passing

Since Feb 14Pushed 1mo 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 1mo ago

READMEChangelog (5)Dependencies (14)Versions (8)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

44

—

FairBetter than 92% of packages

Maintenance87

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

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 ~1 days

Total

5

Last Release

84d 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 (12 commits)")[![dhurgham-miswag](https://avatars.githubusercontent.com/u/180981015?v=4)](https://github.com/dhurgham-miswag "dhurgham-miswag (6 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

[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[likeabas/filament-chatgpt-agent

Integrate with OpenAI ChatGPT

235.3k](/packages/likeabas-filament-chatgpt-agent)[tapp/filament-webhook-client

Add a Filament resource and a policy for Spatie Webhook client

1120.2k](/packages/tapp-filament-webhook-client)[pyaesoneaung/sportmonks-football-api

Laravel package for Sportmonks Football Api(V3)

271.8k](/packages/pyaesoneaung-sportmonks-football-api)

PHPackages © 2026

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