scribase-mcp-php/bin/scribase-mcp-server
caelum0x d150234d68 feat: Scribase MCP server for PHP/Symfony AI (Symfony AI & MCP Hackathon)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-07 04:20:26 +03:00

46 lines
1.5 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
declare(strict_types=1);
/*
* Real MCP stdio server for Scribase (hosted Postgres, Supabase/Neon
* alternative) — five tools against production `api.scribase.com`.
*
* Run it directly:
* SCRIBASE_API_KEY=sbk_... php bin/scribase-mcp-server
*
* Or point any MCP client (the MCP Inspector, a Symfony AI `ClientToolset`,
* Claude Desktop's `mcpServers` config, …) at `php <absolute path to this
* file>` over stdio.
*
* `SCRIBASE_API_KEY` is read once, at boot, from the environment — never
* accepted as a tool argument, so a model can never exfiltrate or rotate
* it through a tool call.
*/
use Mcp\Server;
use Mcp\Server\Transport\StdioTransport;
use Scribase\Mcp\ScribaseClient;
use Scribase\Mcp\ScribaseTools;
foreach ([__DIR__.'/../vendor/autoload.php', __DIR__.'/../../vendor/autoload.php'] as $autoload) {
if (is_file($autoload)) {
require $autoload;
break;
}
}
$client = ScribaseClient::fromEnvironment();
$tools = new ScribaseTools($client);
exit(Server::builder()
->setServerInfo('scribase-mcp-php', '0.1.0')
->addTool([$tools, 'createProject'], name: 'scribase_create_project')
->addTool([$tools, 'lintMigration'], name: 'scribase_lint_migration')
->addTool([$tools, 'query'], name: 'scribase_query')
->addTool([$tools, 'branchTask'], name: 'scribase_branch_task')
->addTool([$tools, 'memoryTask'], name: 'scribase_memory_task')
->build()
->run(new StdioTransport()));