|
31 | 31 | use Butschster\ContextGenerator\McpServer\Action\Tools\ListToolsAction; |
32 | 32 | use Butschster\ContextGenerator\McpServer\Action\Tools\Prompts\GetPromptToolAction; |
33 | 33 | use Butschster\ContextGenerator\McpServer\Action\Tools\Prompts\ListPromptsToolAction; |
| 34 | +use Butschster\ContextGenerator\McpServer\Config\McpConfig; |
34 | 35 | use Butschster\ContextGenerator\McpServer\Console\MCPServerCommand; |
35 | 36 | use Butschster\ContextGenerator\McpServer\Projects\Actions\ProjectsListToolAction; |
36 | 37 | use Butschster\ContextGenerator\McpServer\Projects\Actions\ProjectSwitchToolAction; |
|
46 | 47 | use Butschster\ContextGenerator\McpServer\Routing\Handler\Tools\ToolsHandlerInterface; |
47 | 48 | use Butschster\ContextGenerator\McpServer\Routing\McpResponseStrategy; |
48 | 49 | use Butschster\ContextGenerator\McpServer\Routing\RouteRegistrar; |
| 50 | +use Butschster\ContextGenerator\McpServer\Server\Runner; |
| 51 | +use Butschster\ContextGenerator\McpServer\Server\RunnerInterface; |
| 52 | +use Butschster\ContextGenerator\McpServer\Server\ServerDriverFactory; |
49 | 53 | use Butschster\ContextGenerator\McpServer\Tool\McpToolBootloader; |
50 | 54 | use League\Route\Router; |
51 | 55 | use League\Route\Strategy\StrategyInterface; |
@@ -81,6 +85,18 @@ public function init(EnvironmentInterface $env): void |
81 | 85 | McpConfig::CONFIG, |
82 | 86 | [ |
83 | 87 | 'document_name_format' => $env->get('MCP_DOCUMENT_NAME_FORMAT', '[{path}] {description}'), |
| 88 | + 'transport' => [ |
| 89 | + 'type' => $env->get('MCP_TRANSPORT', 'stdio'), |
| 90 | + 'http' => [ |
| 91 | + 'host' => $env->get('MCP_HTTP_HOST', 'localhost'), |
| 92 | + 'port' => (int) $env->get('MCP_HTTP_PORT', 8080), |
| 93 | + 'session_store' => $env->get('MCP_HTTP_SESSION_STORE', 'file'), |
| 94 | + 'session_store_path' => $env->get('MCP_HTTP_SESSION_STORE_PATH'), |
| 95 | + 'cors_enabled' => (bool) $env->get('MCP_HTTP_CORS_ENABLED', true), |
| 96 | + 'cors_origins' => \array_filter(\explode(',', $env->get('MCP_HTTP_CORS_ORIGINS', '*'))), |
| 97 | + 'max_request_size' => (int) $env->get('MCP_HTTP_MAX_REQUEST_SIZE', 10485760), |
| 98 | + ], |
| 99 | + ], |
84 | 100 | 'file_operations' => [ |
85 | 101 | 'enable' => (bool) $env->get('MCP_FILE_OPERATIONS', !$isCommonProject), |
86 | 102 | 'write' => (bool) $env->get('MCP_FILE_WRITE', true), |
@@ -128,9 +144,9 @@ public function defineSingletons(): array |
128 | 144 | ToolsHandlerInterface::class => ToolsHandler::class, |
129 | 145 |
|
130 | 146 | // Server infrastructure |
131 | | - ServerRunnerInterface::class => function ( |
| 147 | + RunnerInterface::class => function ( |
132 | 148 | McpConfig $config, |
133 | | - ServerRunner $factory, |
| 149 | + Runner $factory, |
134 | 150 | ConfigLoaderInterface $loader, |
135 | 151 | ) { |
136 | 152 | $loader->load(); |
|
0 commit comments