Files
redmine/redMCP/app/mcp-http-router.php
T
Jason Thistlethwaite 22c8e915e9 Sanitize noisy MCP text fields by default
Clean control and invisible junk from tool result text fields to reduce token waste while preserving readable Unicode. Add an MCP_TEXT_SANITIZATION toggle and regression tests for enabled and disabled behavior.
2026-05-06 02:31:25 -04:00

32 lines
788 B
PHP

<?php
declare(strict_types=1);
use RedMCP\McpDispatcher;
use RedMCP\McpDebugLogger;
use RedMCP\McpEnvironment;
use RedMCP\McpHttpHandler;
use RedMCP\RedmineClient;
require __DIR__ . '/../vendor/autoload.php';
$env = McpEnvironment::load(__DIR__ . '/../.env');
$token = $env['mcp_server_token'];
if ($token === null) {
http_response_code(500);
header('Content-Type: application/json');
echo json_encode(['error' => 'MCP_SERVER_TOKEN is required']);
return;
}
$handler = new McpHttpHandler(
new McpDispatcher(
RedmineClient::fromCredentials($env['redmine_url'], $env['redmine_api_key']),
new McpDebugLogger($env['mcp_debug_log']),
$env['mcp_text_sanitization']
),
$token,
getenv('MCP_HTTP_PATH') ?: '/mcp'
);
$handler->handle();