Installation:
composer require unopim/mcp
php artisan mcp:install
This publishes the config file and sets up Passport (if installed).
First Use Case:
For local AI integration (Copilot, Cursor, etc.):
php artisan mcp:dev
Then configure your AI editor to use the unopim-dev stdio server (see README.md).
For remote AI access (HTTP/SSE):
Ensure APP_URL is set in .env and test with:
curl -X POST http://your-unopim-site.test/api/mcp/unopim \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"action": "get_catalog_schema"}'
Quick Test: Run the MCP Inspector to manually test tools:
php artisan mcp:inspector unopim-dev
This launches a web UI where you can interactively call any MCP tool.
Searching Products:
Use search_products with cursor pagination for large datasets:
{
"action": "search_products",
"filters": [
{"field": "status", "operator": "=", "value": "active"},
{"field": "price", "operator": ">=", "value": 50}
],
"limit": 50,
"cursor": null
}
get_catalog_schema first to confirm available fields and operators.Batch Upserts:
Use upsert_products for bulk updates (max 50 items per call):
{
"action": "upsert_products",
"products": [
{"sku": "PRD001", "name": "Updated Product", "price": 99.99},
{"sku": "PRD002", "name": "New Product", "price": 49.99}
]
}
File Management:
Use dev_tools with create_file or update_file actions:
{
"action": "dev_tools",
"tool": "create_file",
"params": {
"path": "app/Services/NewService.php",
"content": "<?php namespace App\\Services; class NewService { ... }"
}
}
allowed_paths (configured in config/mcp.php).Plugin Scaffolding: Generate a new plugin skeleton:
php artisan mcp:make plugin MyConnector --type=connector
Test Generation: Auto-generate Pest tests for a class:
php artisan mcp:make test App\\Services\\ProductService ProductServiceTest
Dynamic Skills:
Create a SKILL.md in .ai/skills/ to define custom workflows. Example:
---
name: generate-product-mock
description: Generates a mock product based on a description
parameters:
description:
type: string
required: true
---
execute_generate_product_mock in your AI editor.Database Introspection:
Use get_database_schema to explore tables:
{
"action": "get_database_schema",
"table": "products"
}
run_database_query to execute read-only queries:{
"action": "run_database_query",
"query": "SELECT * FROM products WHERE price > 100 LIMIT 10"
}
{
"action": "search_settings",
"type": "channels",
"filters": [{"field": "code", "operator": "CONTAINS", "value": "web"}]
}
{
"action": "upsert_settings",
"type": "channels",
"settings": [{"code": "new_channel", "name": "New Channel", "enabled": true}]
}
AI Editor Configuration:
stdio transport (php artisan mcp:dev)./api/mcp/unopim) with SSE.Rate Limiting:
MCP_RATE_LIMIT in .env (default: 60 requests/minute per tool per client).429 Too Many Requests errors.Security:
MCP_API_AUTH (default: true) to require API tokens for HTTP endpoints.allowed_paths in config/mcp.php to sandbox file operations.Audit Logging:
MCP_AUDIT_LOGGING to log destructive operations (e.g., upsert_products).storage/logs/laravel.log for compliance or debugging.Dynamic Skills:
SKILL.md files in .ai/skills/ to extend functionality without code changes.Path Traversal:
allowed_paths (e.g., /etc/passwd) will fail with a 403 Forbidden.allowed_paths in config/mcp.php includes only trusted directories (e.g., base_path(), sys_get_temp_dir()).Command Injection:
dev_tools action blocks shell operators (;, &, |, etc.) and restricts commands to php artisan and composer.CommandRunner service or use run_database_query for SQL-based operations.Rate Limiting:
MCP_RATE_LIMIT (default: 60/min) returns 429 Too Many Requests..env or implement exponential backoff in your client.ACL Bypass:
mcp:dev) bypass ACL checks for local development.mcp:dev in production or restrict access via config/mcp.php.Cursor Pagination:
cursor in subsequent search_* calls may return duplicate or incomplete results.cursor field from the previous response:
{
"data": [...],
"cursor": "eyJzY29wZSI6I..."
}
Batch Size Limits:
upsert_* tools enforce a 50-item limit per call.Skill Discovery:
SKILL.md) may not update immediately if caching is enabled.php artisan cache:clear or adjust MCP_CACHE_TTL.Tool Errors:
storage/logs/laravel.log for detailed error messages.mcp:inspector to test tools interactively.HTTP Endpoint Issues:
APP_URL and MCP_API_AUTH in .env.auth:api middleware is properly configured (requires Passport).stdio Transport:
unopim-dev server is running (php artisan mcp:dev).cwd) in the editor config matches your UnoPim root.Permission Denied:
get_app_info to inspect the current user’s permissions:
{
"action": "get_app_info"
}
How can I help you explore Laravel packages today?