-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.php
More file actions
29 lines (23 loc) · 780 Bytes
/
server.php
File metadata and controls
29 lines (23 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env php
<?php
declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
use PhpMcp\Server\Server;
use PhpMcp\Server\Transports\StreamableHttpServerTransport; // For public!
try {
$server = Server::make()
->withServerInfo('Flight PHP Framework Docs MCP', '1.0.0')
->build();
// Auto-discover tools from src/
$server->discover(basePath: __DIR__, scanDirs: ['src']);
// **Public HTTP mode** (listen on port 8080)
$transport = new StreamableHttpServerTransport(
host: '0.0.0.0', // Bind to all interfaces
port: 8890,
mcpPath: '/mcp' // Endpoint: yourdomain.com/mcp
);
$server->listen($transport);
} catch (\Throwable $e) {
fwrite(STDERR, $e->getMessage() . "\n");
exit(1);
}