PHP code example of particle-academy / prism-mcp

1. Go to this page and download the library: Download particle-academy/prism-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/ */

    

particle-academy / prism-mcp example snippets


use Prism\Mcp\Facades\PrismMcp;
use Prism\Prism\Prism;

$tools = PrismMcp::server('github')->tools();

Prism::text()
    ->using('anthropic', 'claude-sonnet-4-5')
    ->withTools($tools)
    ->withPrompt('Which of our open PRs touch the billing module?')
    ->asText();

// config/prism-mcp.php
'github' => [
    'url' => env('MCP_GITHUB_URL'),
    'trust' => [
        'tools' => ['search_repositories', 'get_file_contents'],
    ],
],

'trust' => ['tools' => '*'],

'trust' => [
    'tools' => ['search_repositories'],
    'pins' => ['search_repositories' => 'sha256:…'],
],

// Laravel's Gate — authorization.
Gate::define('mcp.call', fn (?User $user, string $server, string $tool, array $args) =>
    $user?->can('use-external-tools') ?? false);

$tools = PrismMcp::server('github')->tools();

$tools = PrismMcp::tools();

$tools = PrismMcp::client('https://mcp.example.com/mcp')
    ->withToken(config('services.example.token'))
    ->trusting(['search'])
    ->withTimeout(10)
    ->tools();
bash
php artisan prism-mcp:pins github