Automatically generate beautiful documentation pages for your Laravel MCP (Model Context Protocol) servers. This package extracts metadata from your MCP server classes and generates comprehensive documentation with tools, resources, prompts, and installation instructions.
- 🚀 Automatic Documentation: Automatically extracts tools, resources, and prompts from your MCP server class
- 🎨 Beautiful UI: Modern, responsive documentation pages built with Tailwind CSS
- ⚙️ Highly Configurable: Customize server URLs, installation commands, and messages
- 📦 Easy Integration: Works out of the box with Laravel MCP servers
- 🔧 Extensible: Publish and customize views to match your brand
Install the package via Composer:
composer require fabianbartsch/mcp-docsPublish the configuration file:
php artisan vendor:publish --tag=mcp-docs-configThis will create config/mcp-docs.php. Configure your MCP server class:
'server_class' => env('MCP_DOCS_SERVER_CLASS', App\Mcp\Servers\YourServer::class),
'server_name' => env('MCP_DOCS_SERVER_NAME', 'your-server'),
'server_url_pattern' => env('MCP_DOCS_SERVER_URL', '{base_url}/mcp/{server}'),Or set it in your .env file:
MCP_DOCS_SERVER_CLASS=App\Mcp\Servers\YourServer
MCP_DOCS_SERVER_NAME=your-server
MCP_DOCS_SERVER_URL=https://yourdomain.com/mcp/{server}By default, the package registers a route at /docs/mcp. You can customize this in the config file or disable it:
'route' => [
'enabled' => true,
'path' => '/docs/mcp',
'name' => 'mcp.docs',
'middleware' => 'web',
],If you prefer to register the route manually, disable automatic registration and add it to your routes/web.php:
use FabianBartsch\McpDocs\Controllers\McpDocumentationController;
Route::get('/docs/mcp', [McpDocumentationController::class, 'index'])
->name('mcp.docs');Publish the views to customize them:
php artisan vendor:publish --tag=mcp-docs-viewsViews will be published to resources/views/vendor/mcp-docs/. You can now customize:
index.blade.php- Main documentation pagemcp-docs.blade.php- Layout templatepartials/- Reusable components
You can customize authentication and support messages in the config file:
'auth_message' => 'This MCP server requires authentication. Include your Sanctum token in the Authorization header:',
'support_message' => 'For questions or issues, please contact support@example.com.',Set to null to hide a section entirely.
Customize installation commands for different platforms:
'installation_commands' => [
'cursor' => 'cursor://install-mcp?url={url}',
'vscode' => 'vscode://install-mcp?url={url}',
'claude code' => 'claude mcp add {url}',
'custom' => 'your-custom-command {url}',
],- PHP >= 8.1
- Laravel >= 10.0 (supports Laravel 10, 11, and 12)
- laravel/mcp >= 0.1.0
Note: This package matches the same Laravel and PHP version requirements as
laravel/mcpfor maximum compatibility.
Your MCP server class should extend Laravel\Mcp\Server and define:
<?php
namespace App\Mcp\Servers;
use Laravel\Mcp\Server;
class YourServer extends Server
{
protected string $name = 'Your Server Name';
protected string $version = '1.0.0';
protected string $instructions = 'Server description';
protected array $tools = [
YourTool::class,
];
protected array $resources = [
YourResource::class,
];
protected array $prompts = [
YourPrompt::class,
];
}The package uses PHP reflection to:
- Extract server metadata (name, version, instructions)
- Discover all registered tools, resources, and prompts
- Extract metadata from each component (name, title, description, parameters)
- Generate a comprehensive documentation page
After installation and configuration, visit /docs/mcp to see your documentation.
You can extend the controller to add custom logic:
<?php
namespace App\Http\Controllers;
use FabianBartsch\McpDocs\Controllers\McpDocumentationController as BaseController;
class McpDocumentationController extends BaseController
{
protected function generateServerUrl(): string
{
// Custom URL generation logic
return 'https://custom-url.com/mcp/server';
}
}Contributions are welcome! Please feel free to submit a Pull Request.
The MIT License (MIT). Please see License File for more information.