Installation:
composer require unopim/mcp
php artisan mcp:install
This publishes the config file and sets up Passport (if installed).
First Use Case:
For AI Agents (Copilot, Cursor, etc.): Start the stdio server:
php artisan mcp:dev
Configure your AI editor (e.g., VS Code .vscode/mcp.json) to use this server.
For HTTP Access:
Ensure APP_URL is set in .env and test the endpoint:
curl -X POST http://your-unopim-site/api/mcp/unopim -H "Authorization: Bearer YOUR_TOKEN"
Quick Test: Run the inspector to verify functionality:
php artisan mcp:inspector unopim-dev
This launches a web interface to manually test tools.
Catalog Management:
search_products with cursor pagination for large datasets:
{
"tool": "search_products",
"params": {
"filters": [
{"field": "status", "operator": "=", "value": "active"},
{"field": "price", "operator": ">=", "value": 50}
],
"page": 1,
"per_page": 50
}
}
upsert_products for atomic batch operations (max 50 items):
{
"tool": "upsert_products",
"params": {
"products": [
{"sku": "PRD001", "name": "Updated Product", "price": 69.99},
{"sku": "PRD002", "name": "Another Product", "price": 49.99}
]
}
}
Developer Tools:
dev_tools with create_file or update_file actions:
{
"tool": "dev_tools",
"params": {
"action": "create_file",
"path": "app/Http/Controllers/ProductController.php",
"content": "<?php namespace App\\Http\\Controllers; ..."
}
}
php artisan mcp:make plugin MyCustomPlugin --type=connector
AI-Assisted Development:
SKILL.md in .ai/skills/ to define custom workflows. Example:
---
name: generate_product_test
description: Generates a Pest test for a product
parameters:
sku:
type: string
required: true
---
Execute it via:
{
"tool": "run_skill",
"params": {
"skill_name": "generate_product_test",
"sku": "PRD001"
}
}
Schema Discovery:
Use get_catalog_schema to dynamically explore available fields and operators:
{
"tool": "get_catalog_schema",
"params": {
"entity": "products"
}
}
catalog-schema resource for AI prompts to guide users in constructing valid queries.MCP_RATE_LIMIT (default: 60 requests/minute/tool/IP) to avoid throttling during bulk operations.MCP_AUDIT_LOGGING to track destructive operations for compliance or debugging.allowed_paths in config/mcp.php to prevent path traversal attacks in file operations.Rate Limiting:
MCP_RATE_LIMIT in config/mcp.php or implement client-side throttling.Batch Size Limits:
upsert_products enforce a 50-item limit per call. Exceeding this returns an error.Path Traversal:
allowed_paths (e.g., /etc/passwd) fails silently or logs an error.allowed_paths in config/mcp.php and use absolute paths for file operations.Command Injection:
dev_tools with run_command action may bypass whitelisting.dev_tools actions are restricted to trusted commands (e.g., php artisan, composer).ACL Bypass:
mcp:dev) bypass ACL checks, which may expose sensitive operations.auth:api in config/mcp.php.Skill Caching:
SKILL.md files aren’t reflected immediately if MCP_ENABLE_CACHE is true.php artisan cache:clear
Inspector Tool:
Use php artisan mcp:inspector to manually test tools and inspect responses. This is invaluable for debugging tool parameters or schema issues.
Audit Logs:
Check storage/logs/laravel.log for audit entries when MCP_AUDIT_LOGGING is enabled. Look for:
MCP_Audit: Tool [tool_name] called by [user_id]@[ip]MCP_PathTraversalAttempt or MCP_CommandBlocked.Tool Registry: Verify tool availability via:
php artisan mcp:inspector unopim-dev --list-tools
This lists all registered tools and their parameters.
Query Operators:
CONTAINS is case-sensitive. Use LOWER() in SQL queries if case-insensitive searches are needed.{
"filters": [
{"field": "name", "operator": "CONTAINS", "value": "shirt"},
{"field": "price", "operator": ">", "value": 20},
{"field": "status", "operator": "IN", "value": ["active", "pending"]}
]
}
Custom Skills:
SKILL.md in .ai/skills/ with YAML frontmatter defining parameters and metadata.---
name: generate_product_descriptions
description: Generates SEO-friendly descriptions for products
parameters:
skus:
type: array
required: true
tone:
type: string
enum: ["technical", "casual", "luxury"]
default: "casual"
---
run_skill tool with skill_name: generate_product_descriptions.Override Tools:
BaseMcpTool or override methods in UnoPimAgentServer to customize behavior.validate_products tool by creating a class in app/MCP/Tools/Catalog/ValidateProductsTool.php and registering it in the service provider.Dynamic Prompts:
Prompts directory to add custom analysis prompts (e.g., analyze_product_completeness).catalog-schema resource to dynamically generate prompt templates.Media Tools:
allowed_extensions and allowed_mimes in config/mcp.php for upcoming media upload tools.API Authentication:
auth:api (Passport) by default. Disable with MCP_API_AUTH=false in .env (not recommended for production).Skills Path:
.ai/skills/. Change via MCP_SKILLS_PATH in .env or config/mcp.php.Rate Limiting:
How can I help you explore Laravel packages today?