π Laravel MCP API Docs
Laravel MCP API Docs, a package that exposes your OpenAPI specification directly to AI tools via Laravel MCP. Instead of letting AI guess endpoints and payloads, it allows structured querying of your real API contract β enabling more accurate code generation, safer integrations, and AI-native workflows.
Make AI Use Your Real API β Not Guess It
If you're building Laravel applications in 2026 and using AI tools like Cursor, autonomous agents, or code assistants, you've probably seen this happen:
AI guesses your endpoints
It invents request fields
It assumes wrong payload structures
And suddenly your βAI productivity boostβ turns into debugging sessions.
Laravel MCP API Docs fixes that.
π Available on Packagist:
https://packagist.org/packages/dhur-gham/laravel-mcp-api-docs
It exposes your real OpenAPI specification directly to Laravel MCP, allowing AI tools to consume the canonical API contract β not reverse-engineered assumptions from your controllers.
β‘ What It Actually Does
Instead of forcing AI to parse a massive Swagger JSON file, this package provides:
Structured, queryable tools:
search_endpoints(query)get_endpoint(method, path)list_tags()
Plus:
A browsable API catalog resource
Optional feature documentation via
DocsForMcp/*.md
So instead of reading everything, AI can simply ask:
βGive me the POST /shipments schema.β
And it receives:
Exact request structure
Validation rules
Required fields
Response schema
Status codes
No hallucination. No guessing. Just structured truth.
π§ Why Itβs Powerful
1οΈβ£ AI Generates Correct Code the First Time
Imagine a frontend developer asking:
βGenerate a form for creating shipments.β
With MCP API Docs:
AI reads the real request schema
Uses correct field names
Applies correct data types
Handles enums properly
Marks required fields accurately
No Slack threads.
No βIs this field required?β questions.
No mismatched payload bugs.
2οΈβ£ Itβs Built for AI, Not Just Humans
Swagger JSON was designed for:
Humans
Swagger UI
Postman
Frontend and mobile teams
Laravel MCP API Docs is designed for:
AI IDEs
Code agents
Autonomous refactoring systems
Intelligent integration builders
That distinction matters.
Swagger is documentation.
MCP API Docs is machine-consumable infrastructure.
π Swagger JSON vs MCP API Docs
Swagger JSON | Laravel MCP API Docs |
|---|---|
Static JSON file | Interactive MCP server |
Entire spec loaded at once | Query specific endpoints on demand |
Human-focused documentation | AI-native interface |
No policy enforcement | Full Laravel middleware + policy support |
Passive | Agent-ready |
With Swagger, AI must parse everything.
With MCP API Docs, AI queries only what it needs.
π Security Is First-Class
Youβre not exposing random API knowledge publicly.
You can protect the MCP route using:
auth:sanctumCustom middleware
Policy ability checks (
useMcpApiDocs)
Authentication runs first.
Policy authorization runs next.
This makes it safe for internal tooling, enterprise APIs, and large teams.
π― When You Should Use It
Laravel MCP API Docs makes sense if:
You use AI IDEs like Cursor
You have frontend or mobile teams
You maintain a growing API surface
You want AI to build integrations correctly
You care about reducing communication friction
If AI is part of your workflow, your API should be structured for AI consumption.
π‘ The Core Idea
Sharing Swagger helps humans read your API.
Laravel MCP API Docs helps AI understand your API.
And in an AI-first development world, that difference changes everything.
π¦ Install It
composer require dhur-gham/laravel-mcp-api-docs
π Packagist:
https://packagist.org/packages/dhur-gham/laravel-mcp-api-docs