diff --git a/composer.json b/composer.json index 4dbf09e3..00188f46 100644 --- a/composer.json +++ b/composer.json @@ -51,15 +51,15 @@ }, "autoload-dev": { "psr-4": { - "Mcp\\Example\\StdioCalculatorExample\\": "examples/01-discovery-stdio-calculator/", - "Mcp\\Example\\HttpUserProfileExample\\": "examples/02-discovery-http-userprofile/", - "Mcp\\Example\\ManualStdioExample\\": "examples/03-manual-registration-stdio/", - "Mcp\\Example\\CombinedHttpExample\\": "examples/04-combined-registration-http/", - "Mcp\\Example\\StdioEnvVariables\\": "examples/05-stdio-env-variables/", - "Mcp\\Example\\DependenciesStdioExample\\": "examples/06-custom-dependencies-stdio/", - "Mcp\\Example\\ComplexSchemaHttpExample\\": "examples/07-complex-tool-schema-http/", - "Mcp\\Example\\SchemaShowcaseExample\\": "examples/08-schema-showcase-streamable/", - "Mcp\\Example\\CachedDiscoveryExample\\": "examples/09-cached-discovery-stdio/", + "Mcp\\Example\\HttpCombinedRegistration\\": "examples/http-combined-registration/", + "Mcp\\Example\\HttpComplexToolSchema\\": "examples/http-complex-tool-schema/", + "Mcp\\Example\\HttpDiscoveryUserProfile\\": "examples/http-discovery-userprofile/", + "Mcp\\Example\\HttpSchemaShowcase\\": "examples/http-schema-showcase/", + "Mcp\\Example\\StdioCachedDiscovery\\": "examples/stdio-cached-discovery/", + "Mcp\\Example\\StdioCustomDependencies\\": "examples/stdio-custom-dependencies/", + "Mcp\\Example\\StdioDiscoveryCalculator\\": "examples/stdio-discovery-calculator/", + "Mcp\\Example\\StdioEnvVariables\\": "examples/stdio-env-variables/", + "Mcp\\Example\\StdioExplicitRegistration\\": "examples/stdio-explicit-registration/", "Mcp\\Tests\\": "tests/" } }, diff --git a/examples/04-combined-registration-http/DiscoveredElements.php b/examples/http-combined-registration/DiscoveredElements.php similarity index 95% rename from examples/04-combined-registration-http/DiscoveredElements.php rename to examples/http-combined-registration/DiscoveredElements.php index 3c3edf81..7d030679 100644 --- a/examples/04-combined-registration-http/DiscoveredElements.php +++ b/examples/http-combined-registration/DiscoveredElements.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CombinedHttpExample; +namespace Mcp\Example\HttpCombinedRegistration; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; diff --git a/examples/04-combined-registration-http/ManualHandlers.php b/examples/http-combined-registration/ManualHandlers.php similarity index 95% rename from examples/04-combined-registration-http/ManualHandlers.php rename to examples/http-combined-registration/ManualHandlers.php index fef7216a..21f86e9d 100644 --- a/examples/04-combined-registration-http/ManualHandlers.php +++ b/examples/http-combined-registration/ManualHandlers.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CombinedHttpExample; +namespace Mcp\Example\HttpCombinedRegistration; use Psr\Log\LoggerInterface; diff --git a/examples/04-combined-registration-http/server.php b/examples/http-combined-registration/server.php similarity index 96% rename from examples/04-combined-registration-http/server.php rename to examples/http-combined-registration/server.php index b78c680c..6eefcfd3 100644 --- a/examples/04-combined-registration-http/server.php +++ b/examples/http-combined-registration/server.php @@ -14,7 +14,7 @@ chdir(__DIR__); use Laminas\HttpHandlerRunner\Emitter\SapiEmitter; -use Mcp\Example\CombinedHttpExample\ManualHandlers; +use Mcp\Example\HttpCombinedRegistration\ManualHandlers; use Mcp\Server; use Mcp\Server\Session\FileSessionStore; use Mcp\Server\Transport\StreamableHttpTransport; diff --git a/examples/07-complex-tool-schema-http/McpEventScheduler.php b/examples/http-complex-tool-schema/McpEventScheduler.php similarity index 93% rename from examples/07-complex-tool-schema-http/McpEventScheduler.php rename to examples/http-complex-tool-schema/McpEventScheduler.php index a6d9db92..a9b3edc7 100644 --- a/examples/07-complex-tool-schema-http/McpEventScheduler.php +++ b/examples/http-complex-tool-schema/McpEventScheduler.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ComplexSchemaHttpExample; +namespace Mcp\Example\HttpComplexToolSchema; use Mcp\Capability\Attribute\McpTool; -use Mcp\Example\ComplexSchemaHttpExample\Model\EventPriority; -use Mcp\Example\ComplexSchemaHttpExample\Model\EventType; +use Mcp\Example\HttpComplexToolSchema\Model\EventPriority; +use Mcp\Example\HttpComplexToolSchema\Model\EventType; use Psr\Log\LoggerInterface; final class McpEventScheduler diff --git a/examples/07-complex-tool-schema-http/Model/EventPriority.php b/examples/http-complex-tool-schema/Model/EventPriority.php similarity index 86% rename from examples/07-complex-tool-schema-http/Model/EventPriority.php rename to examples/http-complex-tool-schema/Model/EventPriority.php index 1ec29543..1654be0e 100644 --- a/examples/07-complex-tool-schema-http/Model/EventPriority.php +++ b/examples/http-complex-tool-schema/Model/EventPriority.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ComplexSchemaHttpExample\Model; +namespace Mcp\Example\HttpComplexToolSchema\Model; enum EventPriority: int { diff --git a/examples/07-complex-tool-schema-http/Model/EventType.php b/examples/http-complex-tool-schema/Model/EventType.php similarity index 88% rename from examples/07-complex-tool-schema-http/Model/EventType.php rename to examples/http-complex-tool-schema/Model/EventType.php index 2965c634..5711662d 100644 --- a/examples/07-complex-tool-schema-http/Model/EventType.php +++ b/examples/http-complex-tool-schema/Model/EventType.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ComplexSchemaHttpExample\Model; +namespace Mcp\Example\HttpComplexToolSchema\Model; enum EventType: string { diff --git a/examples/07-complex-tool-schema-http/server.php b/examples/http-complex-tool-schema/server.php similarity index 100% rename from examples/07-complex-tool-schema-http/server.php rename to examples/http-complex-tool-schema/server.php diff --git a/examples/02-discovery-http-userprofile/McpElements.php b/examples/http-discovery-userprofile/McpElements.php similarity index 97% rename from examples/02-discovery-http-userprofile/McpElements.php rename to examples/http-discovery-userprofile/McpElements.php index 815d3d54..7120a5ff 100644 --- a/examples/02-discovery-http-userprofile/McpElements.php +++ b/examples/http-discovery-userprofile/McpElements.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\HttpUserProfileExample; +namespace Mcp\Example\HttpDiscoveryUserProfile; use Mcp\Capability\Attribute\CompletionProvider; use Mcp\Capability\Attribute\McpPrompt; @@ -37,7 +37,7 @@ final class McpElements public function __construct( private readonly LoggerInterface $logger, ) { - $this->logger->debug('HttpUserProfileExample McpElements instantiated.'); + $this->logger->debug('HttpDiscoveryUserProfile McpElements instantiated.'); } /** diff --git a/examples/02-discovery-http-userprofile/UserIdCompletionProvider.php b/examples/http-discovery-userprofile/UserIdCompletionProvider.php similarity index 93% rename from examples/02-discovery-http-userprofile/UserIdCompletionProvider.php rename to examples/http-discovery-userprofile/UserIdCompletionProvider.php index 2b1d0555..bc4022e4 100644 --- a/examples/02-discovery-http-userprofile/UserIdCompletionProvider.php +++ b/examples/http-discovery-userprofile/UserIdCompletionProvider.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\HttpUserProfileExample; +namespace Mcp\Example\HttpDiscoveryUserProfile; use Mcp\Capability\Prompt\Completion\ProviderInterface; diff --git a/examples/02-discovery-http-userprofile/server.php b/examples/http-discovery-userprofile/server.php similarity index 100% rename from examples/02-discovery-http-userprofile/server.php rename to examples/http-discovery-userprofile/server.php diff --git a/examples/08-schema-showcase-streamable/SchemaShowcaseElements.php b/examples/http-schema-showcase/SchemaShowcaseElements.php similarity index 99% rename from examples/08-schema-showcase-streamable/SchemaShowcaseElements.php rename to examples/http-schema-showcase/SchemaShowcaseElements.php index ea11b687..d19bfa1f 100644 --- a/examples/08-schema-showcase-streamable/SchemaShowcaseElements.php +++ b/examples/http-schema-showcase/SchemaShowcaseElements.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\SchemaShowcaseExample; +namespace Mcp\Example\HttpSchemaShowcase; use Mcp\Capability\Attribute\McpTool; use Mcp\Capability\Attribute\Schema; diff --git a/examples/08-schema-showcase-streamable/server.php b/examples/http-schema-showcase/server.php similarity index 100% rename from examples/08-schema-showcase-streamable/server.php rename to examples/http-schema-showcase/server.php diff --git a/examples/09-cached-discovery-stdio/CachedCalculatorElements.php b/examples/stdio-cached-discovery/CachedCalculatorElements.php similarity index 96% rename from examples/09-cached-discovery-stdio/CachedCalculatorElements.php rename to examples/stdio-cached-discovery/CachedCalculatorElements.php index 03930fea..2d5249df 100644 --- a/examples/09-cached-discovery-stdio/CachedCalculatorElements.php +++ b/examples/stdio-cached-discovery/CachedCalculatorElements.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\CachedDiscoveryExample; +namespace Mcp\Example\StdioCachedDiscovery; use Mcp\Capability\Attribute\McpTool; diff --git a/examples/09-cached-discovery-stdio/server.php b/examples/stdio-cached-discovery/server.php similarity index 100% rename from examples/09-cached-discovery-stdio/server.php rename to examples/stdio-cached-discovery/server.php diff --git a/examples/06-custom-dependencies-stdio/McpTaskHandlers.php b/examples/stdio-custom-dependencies/McpTaskHandlers.php similarity index 98% rename from examples/06-custom-dependencies-stdio/McpTaskHandlers.php rename to examples/stdio-custom-dependencies/McpTaskHandlers.php index bf5ce556..262d1a86 100644 --- a/examples/06-custom-dependencies-stdio/McpTaskHandlers.php +++ b/examples/stdio-custom-dependencies/McpTaskHandlers.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\DependenciesStdioExample; +namespace Mcp\Example\StdioCustomDependencies; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; diff --git a/examples/06-custom-dependencies-stdio/Service/InMemoryTaskRepository.php b/examples/stdio-custom-dependencies/Service/InMemoryTaskRepository.php similarity index 100% rename from examples/06-custom-dependencies-stdio/Service/InMemoryTaskRepository.php rename to examples/stdio-custom-dependencies/Service/InMemoryTaskRepository.php diff --git a/examples/06-custom-dependencies-stdio/Service/StatsServiceInterface.php b/examples/stdio-custom-dependencies/Service/StatsServiceInterface.php similarity index 100% rename from examples/06-custom-dependencies-stdio/Service/StatsServiceInterface.php rename to examples/stdio-custom-dependencies/Service/StatsServiceInterface.php diff --git a/examples/06-custom-dependencies-stdio/Service/SystemStatsService.php b/examples/stdio-custom-dependencies/Service/SystemStatsService.php similarity index 100% rename from examples/06-custom-dependencies-stdio/Service/SystemStatsService.php rename to examples/stdio-custom-dependencies/Service/SystemStatsService.php diff --git a/examples/06-custom-dependencies-stdio/Service/TaskRepositoryInterface.php b/examples/stdio-custom-dependencies/Service/TaskRepositoryInterface.php similarity index 100% rename from examples/06-custom-dependencies-stdio/Service/TaskRepositoryInterface.php rename to examples/stdio-custom-dependencies/Service/TaskRepositoryInterface.php diff --git a/examples/06-custom-dependencies-stdio/server.php b/examples/stdio-custom-dependencies/server.php similarity index 100% rename from examples/06-custom-dependencies-stdio/server.php rename to examples/stdio-custom-dependencies/server.php diff --git a/examples/01-discovery-stdio-calculator/McpElements.php b/examples/stdio-discovery-calculator/McpElements.php similarity index 99% rename from examples/01-discovery-stdio-calculator/McpElements.php rename to examples/stdio-discovery-calculator/McpElements.php index cde2ecc4..71aea372 100644 --- a/examples/01-discovery-stdio-calculator/McpElements.php +++ b/examples/stdio-discovery-calculator/McpElements.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\StdioCalculatorExample; +namespace Mcp\Example\StdioDiscoveryCalculator; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; diff --git a/examples/01-discovery-stdio-calculator/server.php b/examples/stdio-discovery-calculator/server.php similarity index 100% rename from examples/01-discovery-stdio-calculator/server.php rename to examples/stdio-discovery-calculator/server.php diff --git a/examples/05-stdio-env-variables/EnvToolHandler.php b/examples/stdio-env-variables/EnvToolHandler.php similarity index 100% rename from examples/05-stdio-env-variables/EnvToolHandler.php rename to examples/stdio-env-variables/EnvToolHandler.php diff --git a/examples/05-stdio-env-variables/server.php b/examples/stdio-env-variables/server.php similarity index 100% rename from examples/05-stdio-env-variables/server.php rename to examples/stdio-env-variables/server.php diff --git a/examples/03-manual-registration-stdio/SimpleHandlers.php b/examples/stdio-explicit-registration/SimpleHandlers.php similarity index 97% rename from examples/03-manual-registration-stdio/SimpleHandlers.php rename to examples/stdio-explicit-registration/SimpleHandlers.php index e581c406..0a119e77 100644 --- a/examples/03-manual-registration-stdio/SimpleHandlers.php +++ b/examples/stdio-explicit-registration/SimpleHandlers.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Example\ManualStdioExample; +namespace Mcp\Example\StdioExplicitRegistration; use Psr\Log\LoggerInterface; diff --git a/examples/03-manual-registration-stdio/server.php b/examples/stdio-explicit-registration/server.php similarity index 95% rename from examples/03-manual-registration-stdio/server.php rename to examples/stdio-explicit-registration/server.php index 8b717658..f225f989 100644 --- a/examples/03-manual-registration-stdio/server.php +++ b/examples/stdio-explicit-registration/server.php @@ -13,7 +13,7 @@ require_once dirname(__DIR__).'/bootstrap.php'; chdir(__DIR__); -use Mcp\Example\ManualStdioExample\SimpleHandlers; +use Mcp\Example\StdioExplicitRegistration\SimpleHandlers; use Mcp\Server; use Mcp\Server\Transport\StdioTransport; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c1e53ebe..9520acdc 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,16 +1,16 @@ parameters: ignoreErrors: - - message: '#^Call to static method invalidParams\(\) on an unknown class Mcp\\Example\\HttpUserProfileExample\\McpServerException\.$#' + message: '#^Call to static method invalidParams\(\) on an unknown class Mcp\\Example\\HttpDiscoveryUserProfile\\McpServerException\.$#' identifier: class.notFound count: 2 - path: examples/02-discovery-http-userprofile/McpElements.php + path: examples/http-discovery-userprofile/McpElements.php - - message: '#^PHPDoc tag @throws with type Mcp\\Example\\HttpUserProfileExample\\McpServerException is not subtype of Throwable$#' + message: '#^PHPDoc tag @throws with type Mcp\\Example\\HttpDiscoveryUserProfile\\McpServerException is not subtype of Throwable$#' identifier: throws.notThrowable count: 2 - path: examples/02-discovery-http-userprofile/McpElements.php + path: examples/http-discovery-userprofile/McpElements.php - message: '#^Call to an undefined method Mcp\\Capability\\Registry\\ResourceTemplateReference\:\:handle\(\)\.$#' diff --git a/tests/Inspector/ManualStdioExampleTest.php b/tests/Inspector/ManualStdioExampleTest.php index affe4462..582de0dc 100644 --- a/tests/Inspector/ManualStdioExampleTest.php +++ b/tests/Inspector/ManualStdioExampleTest.php @@ -24,6 +24,6 @@ public static function provideMethods(): array protected function getServerScript(): string { - return \dirname(__DIR__, 2).'/examples/03-manual-registration-stdio/server.php'; + return \dirname(__DIR__, 2).'/examples/stdio-explicit-registration/server.php'; } } diff --git a/tests/Inspector/StdioCalculatorExampleTest.php b/tests/Inspector/StdioCalculatorExampleTest.php index 237ef648..b1b1bc5e 100644 --- a/tests/Inspector/StdioCalculatorExampleTest.php +++ b/tests/Inspector/StdioCalculatorExampleTest.php @@ -22,6 +22,6 @@ public static function provideMethods(): array protected function getServerScript(): string { - return \dirname(__DIR__, 2).'/examples/01-discovery-stdio-calculator/server.php'; + return \dirname(__DIR__, 2).'/examples/stdio-discovery-calculator/server.php'; } }