Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| McpServerServiceProvider | n/a |
0 / 0 |
n/a |
0 / 0 |
2 | n/a |
0 / 0 |
|||
| register | n/a |
0 / 0 |
n/a |
0 / 0 |
2 | |||||
| 1 | <?php |
| 2 | namespace Apie\McpServer; |
| 3 | |
| 4 | use Apie\ServiceProviderGenerator\UseGeneratedMethods; |
| 5 | use Illuminate\Support\ServiceProvider; |
| 6 | |
| 7 | /** |
| 8 | * This file is generated with apie/service-provider-generator from file: mcp_server.yaml |
| 9 | * @codeCoverageIgnore |
| 10 | */ |
| 11 | class McpServerServiceProvider extends ServiceProvider |
| 12 | { |
| 13 | use UseGeneratedMethods; |
| 14 | |
| 15 | public function register() |
| 16 | { |
| 17 | $this->app->singleton( |
| 18 | \Apie\McpServer\RunMcpServerCommand::class, |
| 19 | function ($app) { |
| 20 | return new \Apie\McpServer\RunMcpServerCommand( |
| 21 | $app->make(\Apie\McpServer\Factory\RunnerFactoryInterface::class), |
| 22 | $app->make(\Apie\McpServer\Tool\ToolFactory::class), |
| 23 | $app->make(\Apie\McpServer\Tool\ToolRunner::class), |
| 24 | $app->make(\Psr\Log\LoggerInterface::class) |
| 25 | ); |
| 26 | } |
| 27 | ); |
| 28 | \Apie\ServiceProviderGenerator\TagMap::register( |
| 29 | $this->app, |
| 30 | \Apie\McpServer\RunMcpServerCommand::class, |
| 31 | array( |
| 32 | 0 => |
| 33 | array( |
| 34 | 'name' => 'console.command', |
| 35 | ), |
| 36 | ) |
| 37 | ); |
| 38 | $this->app->tag([\Apie\McpServer\RunMcpServerCommand::class], 'console.command'); |
| 39 | $this->app->bind(\Apie\McpServer\Factory\RunnerFactoryInterface::class, \Apie\McpServer\Factory\RunnerFactory::class); |
| 40 | |
| 41 | $this->app->singleton( |
| 42 | \Apie\McpServer\Factory\RunnerFactory::class, |
| 43 | function ($app) { |
| 44 | return new \Apie\McpServer\Factory\RunnerFactory( |
| 45 | $app->make(\Psr\Log\LoggerInterface::class) |
| 46 | ); |
| 47 | } |
| 48 | ); |
| 49 | $this->app->singleton( |
| 50 | \Apie\McpServer\Tool\ToolRunner::class, |
| 51 | function ($app) { |
| 52 | return new \Apie\McpServer\Tool\ToolRunner( |
| 53 | $app->make(\Apie\Core\ContextBuilders\ContextBuilderFactory::class), |
| 54 | $app->make('apie'), |
| 55 | $app->make(\Psr\Log\LoggerInterface::class), |
| 56 | $app->bound(\Apie\Console\ConsoleCliStorage::class) ? $app->make(\Apie\Console\ConsoleCliStorage::class) : null |
| 57 | ); |
| 58 | } |
| 59 | ); |
| 60 | $this->app->singleton( |
| 61 | \Apie\McpServer\Tool\ToolFactory::class, |
| 62 | function ($app) { |
| 63 | return new \Apie\McpServer\Tool\ToolFactory( |
| 64 | $app->make(\Apie\Core\ContextBuilders\ContextBuilderFactory::class), |
| 65 | $app->make(\Apie\SchemaGenerator\SchemaGenerator::class), |
| 66 | $app->make(\Apie\Core\BoundedContext\BoundedContextHashmap::class), |
| 67 | $app->make(\Apie\Common\ActionDefinitionProvider::class) |
| 68 | ); |
| 69 | } |
| 70 | ); |
| 71 | $this->app->singleton( |
| 72 | \Apie\McpServer\Controllers\RemoteMcpController::class, |
| 73 | function ($app) { |
| 74 | return new \Apie\McpServer\Controllers\RemoteMcpController( |
| 75 | $app->make(\Apie\McpServer\Tool\ToolFactory::class), |
| 76 | $app->make(\Apie\McpServer\Tool\ToolRunner::class), |
| 77 | $app->make(\Psr\Log\LoggerInterface::class), |
| 78 | $app->make('apie.mcp_store') |
| 79 | ); |
| 80 | } |
| 81 | ); |
| 82 | \Apie\ServiceProviderGenerator\TagMap::register( |
| 83 | $this->app, |
| 84 | \Apie\McpServer\Controllers\RemoteMcpController::class, |
| 85 | array( |
| 86 | 0 => |
| 87 | array( |
| 88 | 'name' => 'controller.service_arguments', |
| 89 | ), |
| 90 | ) |
| 91 | ); |
| 92 | $this->app->tag([\Apie\McpServer\Controllers\RemoteMcpController::class], 'controller.service_arguments'); |
| 93 | $this->app->bind('apie.mcp_store', \Mcp\Server\Transport\Http\SessionStoreInterface::class); |
| 94 | |
| 95 | $this->app->singleton( |
| 96 | \Apie\McpServer\RouteDefinitions\McpServerRouteDefinitionProvider::class, |
| 97 | function ($app) { |
| 98 | return new \Apie\McpServer\RouteDefinitions\McpServerRouteDefinitionProvider( |
| 99 | $this->parseArgument('%apie.remote_mcp_path%', \Apie\McpServer\RouteDefinitions\McpServerRouteDefinitionProvider::class, 0) |
| 100 | ); |
| 101 | } |
| 102 | ); |
| 103 | \Apie\ServiceProviderGenerator\TagMap::register( |
| 104 | $this->app, |
| 105 | \Apie\McpServer\RouteDefinitions\McpServerRouteDefinitionProvider::class, |
| 106 | array( |
| 107 | 0 => |
| 108 | array( |
| 109 | 'name' => 'apie.common.route_definition', |
| 110 | ), |
| 111 | ) |
| 112 | ); |
| 113 | $this->app->tag([\Apie\McpServer\RouteDefinitions\McpServerRouteDefinitionProvider::class], 'apie.common.route_definition'); |
| 114 | $this->app->singleton( |
| 115 | \Mcp\Server\Transport\Http\InMemorySessionStore::class, |
| 116 | function ($app) { |
| 117 | return new \Mcp\Server\Transport\Http\InMemorySessionStore( |
| 118 | |
| 119 | ); |
| 120 | } |
| 121 | ); |
| 122 | $this->app->singleton( |
| 123 | \Mcp\Server\Transport\Http\FileSessionStore::class, |
| 124 | function ($app) { |
| 125 | return new \Mcp\Server\Transport\Http\FileSessionStore( |
| 126 | $this->parseArgument('%kernel.cache_dir%/mcp_server_sessions', \Mcp\Server\Transport\Http\FileSessionStore::class, 0) |
| 127 | ); |
| 128 | } |
| 129 | ); |
| 130 | $this->app->bind(\Mcp\Server\Transport\Http\SessionStoreInterface::class, \Mcp\Server\Transport\Http\FileSessionStore::class); |
| 131 | |
| 132 | |
| 133 | } |
| 134 | } |