PHP
Get an OpenAPI spec from Laravel
Install Scramble and run php artisan scramble:export. No annotations needed.
How it works
Scramble reads your API routes, controllers, validation rules ($request->validate and Form Requests) and API resources, and builds the spec without any comments or annotations.
By default it documents routes whose address starts with api/, which is everything in routes/api.php.
Step by step
Step 1: Install Scramble
In your Laravel project folder:
Terminalcomposer require dedoc/scrambleStep 2: Export the file
This writes api.json in the project root. Upload that file to MCPEasy.
Terminalphp artisan scramble:exportTerminal (choose the path)php artisan scramble:export --path=public/openapi.jsonExporting to public/ makes it reachable at https://your-site.com/openapi.json, so you can paste the link into MCPEasy instead.
Step 3: Optional: the live link
While the app runs, the spec is also at /docs/api.json and a browsable page at /docs/api. By default these only open in the local environment.
To allow them on your live site, define the viewApiDocs gate in app/Providers/AppServiceProvider.php:
app/Providers/AppServiceProvider.phpuse Illuminate\Support\Facades\Gate; public function boot(): void { Gate::define('viewApiDocs', function ($user = null) { return true; // anyone can read the API description }); }Step 4: If your API is not under /api
Publish Scramble's config and change api_path to your prefix (or an empty string for all routes).
Terminalphp artisan vendor:publish --provider="Dedoc\Scramble\ScrambleServiceProvider" --tag="scramble-config"config/scramble.php'api_path' => 'api',
Check that it worked
- Open api.json. Your routes from routes/api.php should be under "paths", with fields from your validation rules.
Give it to MCPEasy
Have a link? Paste it (best)
In MCPEasy, create a server, choose OpenAPI URL and paste the link, for example https://api.example.com/openapi.json. Later changes to your API can be picked up with a sync.
Have a file? Upload it
Choose Upload file and drop in the .json or .yaml file (up to 5 MB). MCPEasy turns each endpoint into a tool, and you review them all before anything goes live.
Already using Scribe?
Scribe also writes an OpenAPI file. It reads the same things plus your docblock comments.
Step 1: Install, publish the config, generate
At the end, the generate command prints where it wrote openapi.yaml. Upload that file.
Terminalcomposer require --dev knuckleswtf/scribe php artisan vendor:publish --tag=scribe-config php artisan scribe:generate
If something goes wrong
- "paths" is empty.
- Your routes do not start with api/. Change api_path (step 4).
- /docs/api.json returns 403 on the live site.
- Define the viewApiDocs gate (step 3), or use the exported file instead.
- Export runs out of memory on a large app.
- Run php -d memory_limit=-1 artisan scramble:export.
Still stuck, or no time to set this up? In MCPEasy choose From code (GitHub): it reads your routes straight from the repository, read-only, and tests every tool against your live API before it goes live.
Official documentation
Other frameworks
More guides for MCP and OpenAPI
- OpenAPI to MCP serverHow a spec maps to MCP tools, which endpoints to keep, and how auth works.
- REST API to MCP serverConvert any API, with or without a spec: Postman, cURL, code, plus a worked example.
- Get an OpenAPI spec from your frameworkExport an OpenAPI (Swagger) file from 11 frameworks, step by step.
- OpenAPI spec from FastAPINothing to install: FastAPI already serves your spec at /openapi.json.
- OpenAPI spec from ExpressThe packages, code and commands to produce a spec from an Express app.