From 6dac6f3b4a48fe9f2b17669de7d479694fa00bc5 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sat, 27 Dec 2025 15:39:05 +0100 Subject: [PATCH] Move examples to server directory (#198) * move examples to server directory This will prepare for the client implementation in https://github.com/modelcontextprotocol/php-sdk/pull/192 * fix move bootstrap too --- composer.json | 24 +++++++++---------- examples/{ => server}/README.md | 0 examples/{ => server}/bootstrap.php | 2 +- .../CachedCalculatorElements.php | 2 +- .../{ => server}/cached-discovery/server.php | 0 .../ClientAwareService.php | 2 +- .../client-communication/server.php | 0 .../LoggingShowcaseHandlers.php | 2 +- .../{ => server}/client-logging/server.php | 0 .../DiscoveredElements.php | 2 +- .../combined-registration/ManualHandlers.php | 2 +- .../combined-registration/server.php | 2 +- .../complex-tool-schema/McpEventScheduler.php | 6 ++--- .../Model/EventPriority.php | 2 +- .../complex-tool-schema/Model/EventType.php | 2 +- .../complex-tool-schema/server.php | 0 .../custom-dependencies/McpTaskHandlers.php | 6 ++--- .../Service/InMemoryTaskRepository.php | 2 +- .../Service/StatsServiceInterface.php | 2 +- .../Service/SystemStatsService.php | 2 +- .../Service/TaskRepositoryInterface.php | 2 +- .../custom-dependencies/server.php | 8 +++---- .../CallToolRequestHandler.php | 2 +- .../ListToolsRequestHandler.php | 2 +- .../custom-method-handlers/server.php | 4 ++-- .../discovery-calculator/McpElements.php | 2 +- .../discovery-calculator/server.php | 0 .../discovery-userprofile/McpElements.php | 2 +- .../UserIdCompletionProvider.php | 2 +- .../discovery-userprofile/server.php | 0 .../env-variables/EnvToolHandler.php | 2 +- .../{ => server}/env-variables/server.php | 0 .../explicit-registration/SimpleHandlers.php | 2 +- .../explicit-registration/server.php | 2 +- .../SchemaShowcaseElements.php | 2 +- .../{ => server}/schema-showcase/server.php | 0 .../Http/HttpClientCommunicationTest.php | 2 +- .../Http/HttpCombinedRegistrationTest.php | 2 +- .../Http/HttpComplexToolSchemaTest.php | 2 +- .../Http/HttpDiscoveryUserProfileTest.php | 2 +- .../Inspector/Http/HttpSchemaShowcaseTest.php | 2 +- .../Stdio/StdioCachedDiscoveryTest.php | 2 +- .../Stdio/StdioCustomDependenciesTest.php | 2 +- .../Stdio/StdioDiscoveryCalculatorTest.php | 2 +- .../Inspector/Stdio/StdioEnvVariablesTest.php | 2 +- .../Stdio/StdioExplicitRegistrationTest.php | 2 +- 46 files changed, 56 insertions(+), 56 deletions(-) rename examples/{ => server}/README.md (100%) rename examples/{ => server}/bootstrap.php (97%) rename examples/{ => server}/cached-discovery/CachedCalculatorElements.php (96%) rename examples/{ => server}/cached-discovery/server.php (100%) rename examples/{ => server}/client-communication/ClientAwareService.php (97%) rename examples/{ => server}/client-communication/server.php (100%) rename examples/{ => server}/client-logging/LoggingShowcaseHandlers.php (98%) rename examples/{ => server}/client-logging/server.php (100%) rename examples/{ => server}/combined-registration/DiscoveredElements.php (95%) rename examples/{ => server}/combined-registration/ManualHandlers.php (95%) rename examples/{ => server}/combined-registration/server.php (93%) rename examples/{ => server}/complex-tool-schema/McpEventScheduler.php (93%) rename examples/{ => server}/complex-tool-schema/Model/EventPriority.php (86%) rename examples/{ => server}/complex-tool-schema/Model/EventType.php (88%) rename examples/{ => server}/complex-tool-schema/server.php (100%) rename examples/{ => server}/custom-dependencies/McpTaskHandlers.php (93%) rename examples/{ => server}/custom-dependencies/Service/InMemoryTaskRepository.php (97%) rename examples/{ => server}/custom-dependencies/Service/StatsServiceInterface.php (87%) rename examples/{ => server}/custom-dependencies/Service/SystemStatsService.php (94%) rename examples/{ => server}/custom-dependencies/Service/TaskRepositoryInterface.php (92%) rename examples/{ => server}/custom-dependencies/server.php (78%) rename examples/{ => server}/custom-method-handlers/CallToolRequestHandler.php (97%) rename examples/{ => server}/custom-method-handlers/ListToolsRequestHandler.php (96%) rename examples/{ => server}/custom-method-handlers/server.php (93%) rename examples/{ => server}/discovery-calculator/McpElements.php (99%) rename examples/{ => server}/discovery-calculator/server.php (100%) rename examples/{ => server}/discovery-userprofile/McpElements.php (98%) rename examples/{ => server}/discovery-userprofile/UserIdCompletionProvider.php (92%) rename examples/{ => server}/discovery-userprofile/server.php (100%) rename examples/{ => server}/env-variables/EnvToolHandler.php (97%) rename examples/{ => server}/env-variables/server.php (100%) rename examples/{ => server}/explicit-registration/SimpleHandlers.php (97%) rename examples/{ => server}/explicit-registration/server.php (96%) rename examples/{ => server}/schema-showcase/SchemaShowcaseElements.php (99%) rename examples/{ => server}/schema-showcase/server.php (100%) diff --git a/composer.json b/composer.json index 91a4d8a..7d4230b 100644 --- a/composer.json +++ b/composer.json @@ -51,18 +51,18 @@ }, "autoload-dev": { "psr-4": { - "Mcp\\Example\\CachedDiscovery\\": "examples/cached-discovery/", - "Mcp\\Example\\ClientCommunication\\": "examples/client-communication/", - "Mcp\\Example\\CombinedRegistration\\": "examples/combined-registration/", - "Mcp\\Example\\ComplexToolSchema\\": "examples/complex-tool-schema/", - "Mcp\\Example\\CustomDependencies\\": "examples/custom-dependencies/", - "Mcp\\Example\\CustomMethodHandlers\\": "examples/custom-method-handlers/", - "Mcp\\Example\\DiscoveryCalculator\\": "examples/discovery-calculator/", - "Mcp\\Example\\DiscoveryUserProfile\\": "examples/discovery-userprofile/", - "Mcp\\Example\\EnvVariables\\": "examples/env-variables/", - "Mcp\\Example\\ExplicitRegistration\\": "examples/explicit-registration/", - "Mcp\\Example\\SchemaShowcase\\": "examples/schema-showcase/", - "Mcp\\Example\\ClientLogging\\": "examples/client-logging/", + "Mcp\\Example\\Server\\CachedDiscovery\\": "examples/server/cached-discovery/", + "Mcp\\Example\\Server\\ClientCommunication\\": "examples/server/client-communication/", + "Mcp\\Example\\Server\\CombinedRegistration\\": "examples/server/combined-registration/", + "Mcp\\Example\\Server\\ComplexToolSchema\\": "examples/server/complex-tool-schema/", + "Mcp\\Example\\Server\\CustomDependencies\\": "examples/server/custom-dependencies/", + "Mcp\\Example\\Server\\CustomMethodHandlers\\": "examples/server/custom-method-handlers/", + "Mcp\\Example\\Server\\DiscoveryCalculator\\": "examples/server/discovery-calculator/", + "Mcp\\Example\\Server\\DiscoveryUserProfile\\": "examples/server/discovery-userprofile/", + "Mcp\\Example\\Server\\EnvVariables\\": "examples/server/env-variables/", + "Mcp\\Example\\Server\\ExplicitRegistration\\": "examples/server/explicit-registration/", + "Mcp\\Example\\Server\\SchemaShowcase\\": "examples/server/schema-showcase/", + "Mcp\\Example\\Server\\ClientLogging\\": "examples/server/client-logging/", "Mcp\\Tests\\": "tests/" } }, diff --git a/examples/README.md b/examples/server/README.md similarity index 100% rename from examples/README.md rename to examples/server/README.md diff --git a/examples/bootstrap.php b/examples/server/bootstrap.php similarity index 97% rename from examples/bootstrap.php rename to examples/server/bootstrap.php index 8c0508a..a592ea8 100644 --- a/examples/bootstrap.php +++ b/examples/server/bootstrap.php @@ -19,7 +19,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Log\AbstractLogger; use Psr\Log\LoggerInterface; -require_once dirname(__DIR__).'/vendor/autoload.php'; +require_once dirname(__DIR__, 2).'/vendor/autoload.php'; set_exception_handler(function (Throwable $t): never { logger()->critical('Uncaught exception: '.$t->getMessage(), ['exception' => $t]); diff --git a/examples/cached-discovery/CachedCalculatorElements.php b/examples/server/cached-discovery/CachedCalculatorElements.php similarity index 96% rename from examples/cached-discovery/CachedCalculatorElements.php rename to examples/server/cached-discovery/CachedCalculatorElements.php index ef67b0f..9e9766b 100644 --- a/examples/cached-discovery/CachedCalculatorElements.php +++ b/examples/server/cached-discovery/CachedCalculatorElements.php @@ -11,7 +11,7 @@ declare(strict_types=1); * file that was distributed with this source code. */ -namespace Mcp\Example\CachedDiscovery; +namespace Mcp\Example\Server\CachedDiscovery; use Mcp\Capability\Attribute\McpTool; use Mcp\Exception\ToolCallException; diff --git a/examples/cached-discovery/server.php b/examples/server/cached-discovery/server.php similarity index 100% rename from examples/cached-discovery/server.php rename to examples/server/cached-discovery/server.php diff --git a/examples/client-communication/ClientAwareService.php b/examples/server/client-communication/ClientAwareService.php similarity index 97% rename from examples/client-communication/ClientAwareService.php rename to examples/server/client-communication/ClientAwareService.php index 70b77bd..b33f4a7 100644 --- a/examples/client-communication/ClientAwareService.php +++ b/examples/server/client-communication/ClientAwareService.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ClientCommunication; +namespace Mcp\Example\Server\ClientCommunication; use Mcp\Capability\Attribute\McpTool; use Mcp\Schema\Content\TextContent; diff --git a/examples/client-communication/server.php b/examples/server/client-communication/server.php similarity index 100% rename from examples/client-communication/server.php rename to examples/server/client-communication/server.php diff --git a/examples/client-logging/LoggingShowcaseHandlers.php b/examples/server/client-logging/LoggingShowcaseHandlers.php similarity index 98% rename from examples/client-logging/LoggingShowcaseHandlers.php rename to examples/server/client-logging/LoggingShowcaseHandlers.php index 35dfa23..422efaf 100644 --- a/examples/client-logging/LoggingShowcaseHandlers.php +++ b/examples/server/client-logging/LoggingShowcaseHandlers.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ClientLogging; +namespace Mcp\Example\Server\ClientLogging; use Mcp\Capability\Attribute\McpTool; use Mcp\Capability\Logger\ClientLogger; diff --git a/examples/client-logging/server.php b/examples/server/client-logging/server.php similarity index 100% rename from examples/client-logging/server.php rename to examples/server/client-logging/server.php diff --git a/examples/combined-registration/DiscoveredElements.php b/examples/server/combined-registration/DiscoveredElements.php similarity index 95% rename from examples/combined-registration/DiscoveredElements.php rename to examples/server/combined-registration/DiscoveredElements.php index f714246..c2f93ac 100644 --- a/examples/combined-registration/DiscoveredElements.php +++ b/examples/server/combined-registration/DiscoveredElements.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CombinedRegistration; +namespace Mcp\Example\Server\CombinedRegistration; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; diff --git a/examples/combined-registration/ManualHandlers.php b/examples/server/combined-registration/ManualHandlers.php similarity index 95% rename from examples/combined-registration/ManualHandlers.php rename to examples/server/combined-registration/ManualHandlers.php index 65a86bc..14885ef 100644 --- a/examples/combined-registration/ManualHandlers.php +++ b/examples/server/combined-registration/ManualHandlers.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CombinedRegistration; +namespace Mcp\Example\Server\CombinedRegistration; use Psr\Log\LoggerInterface; diff --git a/examples/combined-registration/server.php b/examples/server/combined-registration/server.php similarity index 93% rename from examples/combined-registration/server.php rename to examples/server/combined-registration/server.php index 02f26a4..cf61d55 100644 --- a/examples/combined-registration/server.php +++ b/examples/server/combined-registration/server.php @@ -13,7 +13,7 @@ require_once dirname(__DIR__).'/bootstrap.php'; chdir(__DIR__); -use Mcp\Example\CombinedRegistration\ManualHandlers; +use Mcp\Example\Server\CombinedRegistration\ManualHandlers; use Mcp\Server; use Mcp\Server\Session\FileSessionStore; diff --git a/examples/complex-tool-schema/McpEventScheduler.php b/examples/server/complex-tool-schema/McpEventScheduler.php similarity index 93% rename from examples/complex-tool-schema/McpEventScheduler.php rename to examples/server/complex-tool-schema/McpEventScheduler.php index 253ff5c..366c687 100644 --- a/examples/complex-tool-schema/McpEventScheduler.php +++ b/examples/server/complex-tool-schema/McpEventScheduler.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ComplexToolSchema; +namespace Mcp\Example\Server\ComplexToolSchema; use Mcp\Capability\Attribute\McpTool; -use Mcp\Example\ComplexToolSchema\Model\EventPriority; -use Mcp\Example\ComplexToolSchema\Model\EventType; +use Mcp\Example\Server\ComplexToolSchema\Model\EventPriority; +use Mcp\Example\Server\ComplexToolSchema\Model\EventType; use Psr\Log\LoggerInterface; final class McpEventScheduler diff --git a/examples/complex-tool-schema/Model/EventPriority.php b/examples/server/complex-tool-schema/Model/EventPriority.php similarity index 86% rename from examples/complex-tool-schema/Model/EventPriority.php rename to examples/server/complex-tool-schema/Model/EventPriority.php index e46a69d..eb046ef 100644 --- a/examples/complex-tool-schema/Model/EventPriority.php +++ b/examples/server/complex-tool-schema/Model/EventPriority.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ComplexToolSchema\Model; +namespace Mcp\Example\Server\ComplexToolSchema\Model; enum EventPriority: int { diff --git a/examples/complex-tool-schema/Model/EventType.php b/examples/server/complex-tool-schema/Model/EventType.php similarity index 88% rename from examples/complex-tool-schema/Model/EventType.php rename to examples/server/complex-tool-schema/Model/EventType.php index eaf0f43..2cd9e5e 100644 --- a/examples/complex-tool-schema/Model/EventType.php +++ b/examples/server/complex-tool-schema/Model/EventType.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ComplexToolSchema\Model; +namespace Mcp\Example\Server\ComplexToolSchema\Model; enum EventType: string { diff --git a/examples/complex-tool-schema/server.php b/examples/server/complex-tool-schema/server.php similarity index 100% rename from examples/complex-tool-schema/server.php rename to examples/server/complex-tool-schema/server.php diff --git a/examples/custom-dependencies/McpTaskHandlers.php b/examples/server/custom-dependencies/McpTaskHandlers.php similarity index 93% rename from examples/custom-dependencies/McpTaskHandlers.php rename to examples/server/custom-dependencies/McpTaskHandlers.php index 00127a7..affa2a7 100644 --- a/examples/custom-dependencies/McpTaskHandlers.php +++ b/examples/server/custom-dependencies/McpTaskHandlers.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CustomDependencies; +namespace Mcp\Example\Server\CustomDependencies; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; -use Mcp\Example\CustomDependencies\Service\StatsServiceInterface; -use Mcp\Example\CustomDependencies\Service\TaskRepositoryInterface; +use Mcp\Example\Server\CustomDependencies\Service\StatsServiceInterface; +use Mcp\Example\Server\CustomDependencies\Service\TaskRepositoryInterface; use Psr\Log\LoggerInterface; /** diff --git a/examples/custom-dependencies/Service/InMemoryTaskRepository.php b/examples/server/custom-dependencies/Service/InMemoryTaskRepository.php similarity index 97% rename from examples/custom-dependencies/Service/InMemoryTaskRepository.php rename to examples/server/custom-dependencies/Service/InMemoryTaskRepository.php index dbf3b6a..95f7791 100644 --- a/examples/custom-dependencies/Service/InMemoryTaskRepository.php +++ b/examples/server/custom-dependencies/Service/InMemoryTaskRepository.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CustomDependencies\Service; +namespace Mcp\Example\Server\CustomDependencies\Service; use Psr\Log\LoggerInterface; diff --git a/examples/custom-dependencies/Service/StatsServiceInterface.php b/examples/server/custom-dependencies/Service/StatsServiceInterface.php similarity index 87% rename from examples/custom-dependencies/Service/StatsServiceInterface.php rename to examples/server/custom-dependencies/Service/StatsServiceInterface.php index 079f7e2..85bf9b3 100644 --- a/examples/custom-dependencies/Service/StatsServiceInterface.php +++ b/examples/server/custom-dependencies/Service/StatsServiceInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CustomDependencies\Service; +namespace Mcp\Example\Server\CustomDependencies\Service; interface StatsServiceInterface { diff --git a/examples/custom-dependencies/Service/SystemStatsService.php b/examples/server/custom-dependencies/Service/SystemStatsService.php similarity index 94% rename from examples/custom-dependencies/Service/SystemStatsService.php rename to examples/server/custom-dependencies/Service/SystemStatsService.php index 5cd4488..1cc9bee 100644 --- a/examples/custom-dependencies/Service/SystemStatsService.php +++ b/examples/server/custom-dependencies/Service/SystemStatsService.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CustomDependencies\Service; +namespace Mcp\Example\Server\CustomDependencies\Service; final class SystemStatsService implements StatsServiceInterface { diff --git a/examples/custom-dependencies/Service/TaskRepositoryInterface.php b/examples/server/custom-dependencies/Service/TaskRepositoryInterface.php similarity index 92% rename from examples/custom-dependencies/Service/TaskRepositoryInterface.php rename to examples/server/custom-dependencies/Service/TaskRepositoryInterface.php index 7216634..b1d43ce 100644 --- a/examples/custom-dependencies/Service/TaskRepositoryInterface.php +++ b/examples/server/custom-dependencies/Service/TaskRepositoryInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CustomDependencies\Service; +namespace Mcp\Example\Server\CustomDependencies\Service; /** * @phpstan-type Task array{id: int, userId: string, description: string, completed: bool, createdAt: string} diff --git a/examples/custom-dependencies/server.php b/examples/server/custom-dependencies/server.php similarity index 78% rename from examples/custom-dependencies/server.php rename to examples/server/custom-dependencies/server.php index cd450e5..835a84b 100644 --- a/examples/custom-dependencies/server.php +++ b/examples/server/custom-dependencies/server.php @@ -13,10 +13,10 @@ require_once dirname(__DIR__).'/bootstrap.php'; chdir(__DIR__); -use Mcp\Example\CustomDependencies\Service\InMemoryTaskRepository; -use Mcp\Example\CustomDependencies\Service\StatsServiceInterface; -use Mcp\Example\CustomDependencies\Service\SystemStatsService; -use Mcp\Example\CustomDependencies\Service\TaskRepositoryInterface; +use Mcp\Example\Server\CustomDependencies\Service\InMemoryTaskRepository; +use Mcp\Example\Server\CustomDependencies\Service\StatsServiceInterface; +use Mcp\Example\Server\CustomDependencies\Service\SystemStatsService; +use Mcp\Example\Server\CustomDependencies\Service\TaskRepositoryInterface; use Mcp\Server; use Mcp\Server\Session\FileSessionStore; diff --git a/examples/custom-method-handlers/CallToolRequestHandler.php b/examples/server/custom-method-handlers/CallToolRequestHandler.php similarity index 97% rename from examples/custom-method-handlers/CallToolRequestHandler.php rename to examples/server/custom-method-handlers/CallToolRequestHandler.php index 22d95b3..6714cb5 100644 --- a/examples/custom-method-handlers/CallToolRequestHandler.php +++ b/examples/server/custom-method-handlers/CallToolRequestHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CustomMethodHandlers; +namespace Mcp\Example\Server\CustomMethodHandlers; use Mcp\Schema\Content\TextContent; use Mcp\Schema\JsonRpc\Error; diff --git a/examples/custom-method-handlers/ListToolsRequestHandler.php b/examples/server/custom-method-handlers/ListToolsRequestHandler.php similarity index 96% rename from examples/custom-method-handlers/ListToolsRequestHandler.php rename to examples/server/custom-method-handlers/ListToolsRequestHandler.php index 498f3a8..e97ade5 100644 --- a/examples/custom-method-handlers/ListToolsRequestHandler.php +++ b/examples/server/custom-method-handlers/ListToolsRequestHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CustomMethodHandlers; +namespace Mcp\Example\Server\CustomMethodHandlers; use Mcp\Schema\JsonRpc\Request; use Mcp\Schema\JsonRpc\Response; diff --git a/examples/custom-method-handlers/server.php b/examples/server/custom-method-handlers/server.php similarity index 93% rename from examples/custom-method-handlers/server.php rename to examples/server/custom-method-handlers/server.php index 62f41df..23bb6b7 100644 --- a/examples/custom-method-handlers/server.php +++ b/examples/server/custom-method-handlers/server.php @@ -13,8 +13,8 @@ require_once dirname(__DIR__).'/bootstrap.php'; chdir(__DIR__); -use Mcp\Example\CustomMethodHandlers\CallToolRequestHandler; -use Mcp\Example\CustomMethodHandlers\ListToolsRequestHandler; +use Mcp\Example\Server\CustomMethodHandlers\CallToolRequestHandler; +use Mcp\Example\Server\CustomMethodHandlers\ListToolsRequestHandler; use Mcp\Schema\ServerCapabilities; use Mcp\Schema\Tool; use Mcp\Server; diff --git a/examples/discovery-calculator/McpElements.php b/examples/server/discovery-calculator/McpElements.php similarity index 99% rename from examples/discovery-calculator/McpElements.php rename to examples/server/discovery-calculator/McpElements.php index 972534d..cabd310 100644 --- a/examples/discovery-calculator/McpElements.php +++ b/examples/server/discovery-calculator/McpElements.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\DiscoveryCalculator; +namespace Mcp\Example\Server\DiscoveryCalculator; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; diff --git a/examples/discovery-calculator/server.php b/examples/server/discovery-calculator/server.php similarity index 100% rename from examples/discovery-calculator/server.php rename to examples/server/discovery-calculator/server.php diff --git a/examples/discovery-userprofile/McpElements.php b/examples/server/discovery-userprofile/McpElements.php similarity index 98% rename from examples/discovery-userprofile/McpElements.php rename to examples/server/discovery-userprofile/McpElements.php index 8418f09..8ab6c7d 100644 --- a/examples/discovery-userprofile/McpElements.php +++ b/examples/server/discovery-userprofile/McpElements.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\DiscoveryUserProfile; +namespace Mcp\Example\Server\DiscoveryUserProfile; use Mcp\Capability\Attribute\CompletionProvider; use Mcp\Capability\Attribute\McpPrompt; diff --git a/examples/discovery-userprofile/UserIdCompletionProvider.php b/examples/server/discovery-userprofile/UserIdCompletionProvider.php similarity index 92% rename from examples/discovery-userprofile/UserIdCompletionProvider.php rename to examples/server/discovery-userprofile/UserIdCompletionProvider.php index 69dfe4f..03d97ef 100644 --- a/examples/discovery-userprofile/UserIdCompletionProvider.php +++ b/examples/server/discovery-userprofile/UserIdCompletionProvider.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\DiscoveryUserProfile; +namespace Mcp\Example\Server\DiscoveryUserProfile; use Mcp\Capability\Completion\ProviderInterface; diff --git a/examples/discovery-userprofile/server.php b/examples/server/discovery-userprofile/server.php similarity index 100% rename from examples/discovery-userprofile/server.php rename to examples/server/discovery-userprofile/server.php diff --git a/examples/env-variables/EnvToolHandler.php b/examples/server/env-variables/EnvToolHandler.php similarity index 97% rename from examples/env-variables/EnvToolHandler.php rename to examples/server/env-variables/EnvToolHandler.php index f7cad81..7c6cc8d 100644 --- a/examples/env-variables/EnvToolHandler.php +++ b/examples/server/env-variables/EnvToolHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\EnvVariables; +namespace Mcp\Example\Server\EnvVariables; use Mcp\Capability\Attribute\McpTool; diff --git a/examples/env-variables/server.php b/examples/server/env-variables/server.php similarity index 100% rename from examples/env-variables/server.php rename to examples/server/env-variables/server.php diff --git a/examples/explicit-registration/SimpleHandlers.php b/examples/server/explicit-registration/SimpleHandlers.php similarity index 97% rename from examples/explicit-registration/SimpleHandlers.php rename to examples/server/explicit-registration/SimpleHandlers.php index 0fe385c..0f18a33 100644 --- a/examples/explicit-registration/SimpleHandlers.php +++ b/examples/server/explicit-registration/SimpleHandlers.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ExplicitRegistration; +namespace Mcp\Example\Server\ExplicitRegistration; use Psr\Log\LoggerInterface; diff --git a/examples/explicit-registration/server.php b/examples/server/explicit-registration/server.php similarity index 96% rename from examples/explicit-registration/server.php rename to examples/server/explicit-registration/server.php index 5a61fee..977ee43 100644 --- a/examples/explicit-registration/server.php +++ b/examples/server/explicit-registration/server.php @@ -13,7 +13,7 @@ require_once dirname(__DIR__).'/bootstrap.php'; chdir(__DIR__); -use Mcp\Example\ExplicitRegistration\SimpleHandlers; +use Mcp\Example\Server\ExplicitRegistration\SimpleHandlers; use Mcp\Schema\ServerCapabilities; use Mcp\Server; diff --git a/examples/schema-showcase/SchemaShowcaseElements.php b/examples/server/schema-showcase/SchemaShowcaseElements.php similarity index 99% rename from examples/schema-showcase/SchemaShowcaseElements.php rename to examples/server/schema-showcase/SchemaShowcaseElements.php index 6c7a4b9..35671cf 100644 --- a/examples/schema-showcase/SchemaShowcaseElements.php +++ b/examples/server/schema-showcase/SchemaShowcaseElements.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\SchemaShowcase; +namespace Mcp\Example\Server\SchemaShowcase; use Mcp\Capability\Attribute\McpTool; use Mcp\Capability\Attribute\Schema; diff --git a/examples/schema-showcase/server.php b/examples/server/schema-showcase/server.php similarity index 100% rename from examples/schema-showcase/server.php rename to examples/server/schema-showcase/server.php diff --git a/tests/Inspector/Http/HttpClientCommunicationTest.php b/tests/Inspector/Http/HttpClientCommunicationTest.php index ba287fd..c74d5cb 100644 --- a/tests/Inspector/Http/HttpClientCommunicationTest.php +++ b/tests/Inspector/Http/HttpClientCommunicationTest.php @@ -59,6 +59,6 @@ final class HttpClientCommunicationTest extends HttpInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/client-communication/server.php'; + return \dirname(__DIR__, 3).'/examples/server/client-communication/server.php'; } } diff --git a/tests/Inspector/Http/HttpCombinedRegistrationTest.php b/tests/Inspector/Http/HttpCombinedRegistrationTest.php index 36f133c..8077839 100644 --- a/tests/Inspector/Http/HttpCombinedRegistrationTest.php +++ b/tests/Inspector/Http/HttpCombinedRegistrationTest.php @@ -45,6 +45,6 @@ final class HttpCombinedRegistrationTest extends HttpInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/combined-registration/server.php'; + return \dirname(__DIR__, 3).'/examples/server/combined-registration/server.php'; } } diff --git a/tests/Inspector/Http/HttpComplexToolSchemaTest.php b/tests/Inspector/Http/HttpComplexToolSchemaTest.php index 6c104e2..1ef5880 100644 --- a/tests/Inspector/Http/HttpComplexToolSchemaTest.php +++ b/tests/Inspector/Http/HttpComplexToolSchemaTest.php @@ -82,6 +82,6 @@ final class HttpComplexToolSchemaTest extends HttpInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/complex-tool-schema/server.php'; + return \dirname(__DIR__, 3).'/examples/server/complex-tool-schema/server.php'; } } diff --git a/tests/Inspector/Http/HttpDiscoveryUserProfileTest.php b/tests/Inspector/Http/HttpDiscoveryUserProfileTest.php index b0ffef8..8011439 100644 --- a/tests/Inspector/Http/HttpDiscoveryUserProfileTest.php +++ b/tests/Inspector/Http/HttpDiscoveryUserProfileTest.php @@ -67,6 +67,6 @@ final class HttpDiscoveryUserProfileTest extends HttpInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/discovery-userprofile/server.php'; + return \dirname(__DIR__, 3).'/examples/server/discovery-userprofile/server.php'; } } diff --git a/tests/Inspector/Http/HttpSchemaShowcaseTest.php b/tests/Inspector/Http/HttpSchemaShowcaseTest.php index 9ed61ae..51a00b7 100644 --- a/tests/Inspector/Http/HttpSchemaShowcaseTest.php +++ b/tests/Inspector/Http/HttpSchemaShowcaseTest.php @@ -87,7 +87,7 @@ final class HttpSchemaShowcaseTest extends HttpInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/schema-showcase/server.php'; + return \dirname(__DIR__, 3).'/examples/server/schema-showcase/server.php'; } protected function normalizeTestOutput(string $output, ?string $testName = null): string diff --git a/tests/Inspector/Stdio/StdioCachedDiscoveryTest.php b/tests/Inspector/Stdio/StdioCachedDiscoveryTest.php index 438a3f8..fd0bc90 100644 --- a/tests/Inspector/Stdio/StdioCachedDiscoveryTest.php +++ b/tests/Inspector/Stdio/StdioCachedDiscoveryTest.php @@ -88,6 +88,6 @@ final class StdioCachedDiscoveryTest extends StdioInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/cached-discovery/server.php'; + return \dirname(__DIR__, 3).'/examples/server/cached-discovery/server.php'; } } diff --git a/tests/Inspector/Stdio/StdioCustomDependenciesTest.php b/tests/Inspector/Stdio/StdioCustomDependenciesTest.php index d2f64c0..9e1affd 100644 --- a/tests/Inspector/Stdio/StdioCustomDependenciesTest.php +++ b/tests/Inspector/Stdio/StdioCustomDependenciesTest.php @@ -55,7 +55,7 @@ final class StdioCustomDependenciesTest extends StdioInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/custom-dependencies/server.php'; + return \dirname(__DIR__, 3).'/examples/server/custom-dependencies/server.php'; } protected function normalizeTestOutput(string $output, ?string $testName = null): string diff --git a/tests/Inspector/Stdio/StdioDiscoveryCalculatorTest.php b/tests/Inspector/Stdio/StdioDiscoveryCalculatorTest.php index 87ce549..f44ed6c 100644 --- a/tests/Inspector/Stdio/StdioDiscoveryCalculatorTest.php +++ b/tests/Inspector/Stdio/StdioDiscoveryCalculatorTest.php @@ -45,6 +45,6 @@ final class StdioDiscoveryCalculatorTest extends StdioInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/discovery-calculator/server.php'; + return \dirname(__DIR__, 3).'/examples/server/discovery-calculator/server.php'; } } diff --git a/tests/Inspector/Stdio/StdioEnvVariablesTest.php b/tests/Inspector/Stdio/StdioEnvVariablesTest.php index c46eb75..1c87469 100644 --- a/tests/Inspector/Stdio/StdioEnvVariablesTest.php +++ b/tests/Inspector/Stdio/StdioEnvVariablesTest.php @@ -50,6 +50,6 @@ final class StdioEnvVariablesTest extends StdioInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/env-variables/server.php'; + return \dirname(__DIR__, 3).'/examples/server/env-variables/server.php'; } } diff --git a/tests/Inspector/Stdio/StdioExplicitRegistrationTest.php b/tests/Inspector/Stdio/StdioExplicitRegistrationTest.php index 1cb8179..d31c3f2 100644 --- a/tests/Inspector/Stdio/StdioExplicitRegistrationTest.php +++ b/tests/Inspector/Stdio/StdioExplicitRegistrationTest.php @@ -77,6 +77,6 @@ final class StdioExplicitRegistrationTest extends StdioInspectorSnapshotTestCase protected function getServerScript(): string { - return \dirname(__DIR__, 3).'/examples/explicit-registration/server.php'; + return \dirname(__DIR__, 3).'/examples/server/explicit-registration/server.php'; } }