1. Go to this page and download the library: Download aimeos/pagible-mcp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aimeos / pagible-mcp example snippets
namespace App\Mcp;
use Aimeos\Cms\Tools\Tool;
use App\Models\Order;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Mcp\Request;
use Laravel\Mcp\Response;
use Laravel\Mcp\ResponseFactory;
use Laravel\Mcp\Server\Attributes\Description;
use Laravel\Mcp\Server\Attributes\Name;
use Laravel\Mcp\Server\Tools\Annotations\IsReadOnly;
#[IsReadOnly]
#[Name('get-orders')]
#[Description('Returns the latest orders with their ID, status and total.')]
class GetOrders extends Tool
{
protected const PERMISSIONS = ['order:view'];
public function schema( JsonSchema $schema ) : array
{
return [
'limit' => $schema->integer()->description( 'Number of orders, 10 by default' ),
];
}
protected function run( Request $request ) : ResponseFactory
{
$v = $request->validate( ['limit' => 'nullable|integer|min:1|max:50'] );
$orders = Order::latest()->limit( $v['limit'] ?? 10 )->get( ['id', 'status', 'total'] );
return Response::structured( ['orders' => $orders->toArray()] );
}
}
use Aimeos\Cms\Mcp\CmsServer;
use Aimeos\Cms\Permission;
Permission::register( 'order:view' );
CmsServer::register( [\App\Mcp\GetOrders::class] );
bash
php artisan cms:install:mcp
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.