The Laravilt Plugins package includes a built-in MCP (Model Context Protocol) server that allows AI agents to interact with the plugin system.
Install the MCP server configuration:
php artisan laravilt:install-mcpThis command will:
- Publish
routes/ai.php(if it doesn't exist) - Laravel MCP routes file - Register the server in
routes/ai.php:use Laravel\Mcp\Facades\Mcp; use Laravilt\Plugins\Mcp\LaraviltPluginsServer; Mcp::local('laravilt-plugins', LaraviltPluginsServer::class);
- Update
.mcp.jsonfor AI clients:{ "mcpServers": { "laravilt-plugins": { "command": "php", "args": [ "artisan", "mcp:start", "laravilt-plugins" ] } } }
After installation, restart your AI agent application (Claude Desktop, etc.) to load the new MCP server.
List all installed Laravilt plugins in the packages directory.
Usage:
list-plugins
Output:
Found 3 plugin(s):
📦 actions
Package: laravilt/actions
Version: 1.0.0
Description: Actions plugin for Laravilt
Path: /path/to/packages/laravilt/actions
...
Get detailed information about a specific plugin including structure, features, and configuration.
Arguments:
plugin(string): The plugin name in kebab-case
Usage:
plugin-info(plugin="blog-extensions")
Output:
- Package information (name, description, version)
- Directory structure
- Available features (migrations, models, views, etc.)
Generate a new Laravilt plugin with specified features.
Arguments:
name(string, required): Plugin name in StudlyCasedescription(string, optional): Plugin descriptionmigrations(bool, default: false): Include database migrationsviews(bool, default: false): Include Blade viewswebRoutes(bool, default: false): Include web routesapiRoutes(bool, default: false): Include API routescss(bool, default: false): Include CSS assetsjs(bool, default: false): Include JavaScript assetsarts(bool, default: true): Include arts folder with cover photogithub(bool, default: true): Include GitHub workflowsphpstan(bool, default: true): Include PHPStan configuration
Usage:
generate-plugin(
name="BlogExtensions",
description="Blog extensions for Laravilt",
migrations=true,
views=true,
css=true
)
Generate a Laravel component within a plugin.
Arguments:
plugin(string, required): Plugin name in kebab-casetype(string, required): Component typename(string, required): Component name
Component Types:
migration- Database migrationmodel- Eloquent modelcontroller- HTTP controllercommand- Artisan commandjob- Queueable jobevent- Event classlistener- Event listenernotification- Notificationseeder- Database seederfactory- Model factorytest- Feature testlang- Language fileroute- Route file
Usage:
generate-component(
plugin="blog-extensions",
type="model",
name="Post"
)
List all available component types that can be generated.
Usage:
list-component-types
Get the complete directory structure of a plugin.
Arguments:
plugin(string): Plugin name in kebab-case
Usage:
plugin-structure(plugin="blog-extensions")
You: "List all installed plugins"
Claude: [calls list-plugins tool]
You: "Create a new plugin called BlogExtensions with migrations and views"
Claude: [calls generate-plugin with appropriate parameters]
You: "Generate a Post model in the blog-extensions plugin"
Claude: [calls generate-component with plugin="blog-extensions", type="model", name="Post"]
- Plugin Discovery: AI agents can explore installed plugins
- Automated Generation: Create plugins and components through natural language
- Structure Analysis: Inspect plugin architecture and features
- Development Assistance: Quick component generation during development
The MCP server runs with the same permissions as your Laravel application. Ensure:
- Proper file permissions on the packages directory
- Secure configuration of the MCP server
- Limited access to the MCP configuration file
If the AI agent can't find the server:
- Check
.mcp/config.jsonexists - Verify the artisan path is correct
- Restart the AI agent application
Ensure the packages directory is writable:
chmod -R 775 packages/laraviltCheck Laravel logs for detailed error messages:
tail -f storage/logs/laravel.log