PHP code example of superconductor / stdio-transport

1. Go to this page and download the library: Download superconductor/stdio-transport 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/ */

    

superconductor / stdio-transport example snippets


use Superconductor\Transports\Stdio\DTO\Servers\ProcessCommandConfig;
use Superconductor\Transports\Stdio\Support\Facades\Stdio;
use Superconductor\Capabilities\Tools\DTO\Messages\Requests\ListToolsRequest;

// Define the command to run the MCP server
$mcp_server = [
    "command" => "php",
    "args" => ["artisan","boost:mcp"],
    'env' => [],
];

// Create a ProcessCommandConfig instance
$command = new ProcessCommandConfig(...$mcp_server);

// Start the client by passing in the command configuration
$client = Stdio::client($command)

$request = new ListToolsRequest();


use Superconductor\Transports\Stdio\Support\Facades\Stdio;

// Start the server
$server = Stdio::server();