PHP code example of superconductor / streamable-http-transport

1. Go to this page and download the library: Download superconductor/streamable-http-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 / streamable-http-transport example snippets


use Superconductor\Transports\StreamableHttp\Support\Facades\StreamableHttp;
use Superconductor\Transports\StreamableHttp\DTO\Servers\StreamableServerConfig;

// Define the command to run the MCP server
$mcp_server_config = [
    "url" => "https://api.githubcopilot.com/mcp/",
    "headers" => [
        "Authorization" => "auth_token"
    ],
];

$mcp_server = new StreamableServerConfig(...$mcp_server_config)

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