diff --git a/src/Capability/Registry.php b/src/Capability/Registry.php index ff836745..6e54cfc2 100644 --- a/src/Capability/Registry.php +++ b/src/Capability/Registry.php @@ -23,12 +23,12 @@ use Mcp\Event\ResourceTemplateListChangedEvent; use Mcp\Event\ToolListChangedEvent; use Mcp\Exception\InvalidCursorException; +use Mcp\Schema\Page; use Mcp\Schema\Prompt; use Mcp\Schema\Resource; use Mcp\Schema\ResourceTemplate; use Mcp\Schema\ServerCapabilities; use Mcp\Schema\Tool; -use Mcp\Server\RequestHandler\Reference\Page; use Psr\EventDispatcher\EventDispatcherInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; diff --git a/src/Capability/Registry/ReferenceProviderInterface.php b/src/Capability/Registry/ReferenceProviderInterface.php index 1d40359f..2f60014b 100644 --- a/src/Capability/Registry/ReferenceProviderInterface.php +++ b/src/Capability/Registry/ReferenceProviderInterface.php @@ -11,7 +11,7 @@ namespace Mcp\Capability\Registry; -use Mcp\Server\RequestHandler\Reference\Page; +use Mcp\Schema\Page; /** * Interface for providing access to registered MCP elements. diff --git a/src/Server/RequestHandler/Reference/Page.php b/src/Schema/Page.php similarity index 71% rename from src/Server/RequestHandler/Reference/Page.php rename to src/Schema/Page.php index b5b31863..bad46e9c 100644 --- a/src/Server/RequestHandler/Reference/Page.php +++ b/src/Schema/Page.php @@ -9,15 +9,17 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler\Reference; +namespace Mcp\Schema; /** - * @extends \ArrayObject + * @phpstan-type PageItem Tool|Prompt|ResourceTemplate|Resource + * + * @extends \ArrayObject */ final class Page extends \ArrayObject { /** - * @param array $references Items can be Tool, Prompt, ResourceTemplate, or Resource + * @param array $references Items can be Tool, Prompt, ResourceTemplate, or Resource */ public function __construct( public readonly array $references, diff --git a/src/Server.php b/src/Server.php index a529134e..ec3d6542 100644 --- a/src/Server.php +++ b/src/Server.php @@ -11,9 +11,9 @@ namespace Mcp; -use Mcp\JsonRpc\Handler; use Mcp\Server\Builder; -use Mcp\Server\TransportInterface; +use Mcp\Server\Handler\JsonRpcHandler; +use Mcp\Server\Transport\TransportInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Symfony\Component\Uid\Uuid; @@ -25,7 +25,7 @@ final class Server { public function __construct( - private readonly Handler $jsonRpcHandler, + private readonly JsonRpcHandler $jsonRpcHandler, private readonly LoggerInterface $logger = new NullLogger(), ) { } diff --git a/src/Server/Builder.php b/src/Server/Builder.php index b3d36ca4..7afd5bd1 100644 --- a/src/Server/Builder.php +++ b/src/Server/Builder.php @@ -29,7 +29,6 @@ use Mcp\Capability\Tool\ToolCaller; use Mcp\Capability\Tool\ToolCallerInterface; use Mcp\Exception\ConfigurationException; -use Mcp\JsonRpc\Handler; use Mcp\Schema\Annotations; use Mcp\Schema\Implementation; use Mcp\Schema\Prompt; @@ -39,6 +38,7 @@ use Mcp\Schema\Tool; use Mcp\Schema\ToolAnnotations; use Mcp\Server; +use Mcp\Server\Handler\JsonRpcHandler; use Mcp\Server\Session\InMemorySessionStore; use Mcp\Server\Session\SessionFactory; use Mcp\Server\Session\SessionFactoryInterface; @@ -334,7 +334,7 @@ public function build(): Server $sessionStore = $this->sessionStore ?? new InMemorySessionStore($sessionTtl); return new Server( - jsonRpcHandler: Handler::make( + jsonRpcHandler: JsonRpcHandler::make( registry: $registry, referenceProvider: $registry, implementation: $this->serverInfo, diff --git a/src/JsonRpc/Handler.php b/src/Server/Handler/JsonRpcHandler.php similarity index 92% rename from src/JsonRpc/Handler.php rename to src/Server/Handler/JsonRpcHandler.php index b73f7769..a29dc998 100644 --- a/src/JsonRpc/Handler.php +++ b/src/Server/Handler/JsonRpcHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\JsonRpc; +namespace Mcp\Server\Handler; use Mcp\Capability\Prompt\PromptGetterInterface; use Mcp\Capability\Registry\ReferenceProviderInterface; @@ -20,15 +20,14 @@ use Mcp\Exception\HandlerNotFoundException; use Mcp\Exception\InvalidInputMessageException; use Mcp\Exception\NotFoundExceptionInterface; +use Mcp\JsonRpc\MessageFactory; use Mcp\Schema\Implementation; use Mcp\Schema\JsonRpc\Error; use Mcp\Schema\JsonRpc\HasMethodInterface; use Mcp\Schema\JsonRpc\Request; use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\InitializeRequest; -use Mcp\Server\MethodHandlerInterface; -use Mcp\Server\NotificationHandler; -use Mcp\Server\RequestHandler; +use Mcp\Server\Handler; use Mcp\Server\Session\SessionFactoryInterface; use Mcp\Server\Session\SessionInterface; use Mcp\Server\Session\SessionStoreInterface; @@ -41,7 +40,7 @@ * * @author Christopher Hertel */ -class Handler +class JsonRpcHandler { /** * @var array @@ -80,15 +79,15 @@ public static function make( sessionFactory: $sessionFactory, sessionStore: $sessionStore, methodHandlers: [ - new NotificationHandler\InitializedHandler(), - new RequestHandler\InitializeHandler($registry->getCapabilities(), $implementation), - new RequestHandler\PingHandler(), - new RequestHandler\ListPromptsHandler($referenceProvider, $paginationLimit), - new RequestHandler\GetPromptHandler($promptGetter), - new RequestHandler\ListResourcesHandler($referenceProvider, $paginationLimit), - new RequestHandler\ReadResourceHandler($resourceReader), - new RequestHandler\CallToolHandler($toolCaller, $logger), - new RequestHandler\ListToolsHandler($referenceProvider, $paginationLimit), + new Notification\InitializedHandler(), + new Handler\Request\InitializeHandler($registry->getCapabilities(), $implementation), + new Handler\Request\PingHandler(), + new Handler\Request\ListPromptsHandler($referenceProvider, $paginationLimit), + new Handler\Request\GetPromptHandler($promptGetter), + new Handler\Request\ListResourcesHandler($referenceProvider, $paginationLimit), + new Handler\Request\ReadResourceHandler($resourceReader), + new Handler\Request\CallToolHandler($toolCaller, $logger), + new Handler\Request\ListToolsHandler($referenceProvider, $paginationLimit), ], logger: $logger, ); diff --git a/src/Server/MethodHandlerInterface.php b/src/Server/Handler/MethodHandlerInterface.php similarity index 96% rename from src/Server/MethodHandlerInterface.php rename to src/Server/Handler/MethodHandlerInterface.php index 4abca854..0f61631b 100644 --- a/src/Server/MethodHandlerInterface.php +++ b/src/Server/Handler/MethodHandlerInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server; +namespace Mcp\Server\Handler; use Mcp\Exception\ExceptionInterface; use Mcp\Schema\JsonRpc\Error; diff --git a/src/Server/NotificationHandler/InitializedHandler.php b/src/Server/Handler/Notification/InitializedHandler.php similarity index 91% rename from src/Server/NotificationHandler/InitializedHandler.php rename to src/Server/Handler/Notification/InitializedHandler.php index 55af7759..01881a13 100644 --- a/src/Server/NotificationHandler/InitializedHandler.php +++ b/src/Server/Handler/Notification/InitializedHandler.php @@ -9,13 +9,13 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\NotificationHandler; +namespace Mcp\Server\Handler\Notification; use Mcp\Schema\JsonRpc\Error; use Mcp\Schema\JsonRpc\HasMethodInterface; use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Notification\InitializedNotification; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; /** diff --git a/src/Server/RequestHandler/CallToolHandler.php b/src/Server/Handler/Request/CallToolHandler.php similarity index 95% rename from src/Server/RequestHandler/CallToolHandler.php rename to src/Server/Handler/Request/CallToolHandler.php index fd6bddae..9e83037e 100644 --- a/src/Server/RequestHandler/CallToolHandler.php +++ b/src/Server/Handler/Request/CallToolHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler; +namespace Mcp\Server\Handler\Request; use Mcp\Capability\Tool\ToolCallerInterface; use Mcp\Exception\ExceptionInterface; @@ -17,7 +17,7 @@ use Mcp\Schema\JsonRpc\HasMethodInterface; use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\CallToolRequest; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; diff --git a/src/Server/RequestHandler/GetPromptHandler.php b/src/Server/Handler/Request/GetPromptHandler.php similarity index 94% rename from src/Server/RequestHandler/GetPromptHandler.php rename to src/Server/Handler/Request/GetPromptHandler.php index a6b98909..07a5bebf 100644 --- a/src/Server/RequestHandler/GetPromptHandler.php +++ b/src/Server/Handler/Request/GetPromptHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler; +namespace Mcp\Server\Handler\Request; use Mcp\Capability\Prompt\PromptGetterInterface; use Mcp\Exception\ExceptionInterface; @@ -17,7 +17,7 @@ use Mcp\Schema\JsonRpc\HasMethodInterface; use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\GetPromptRequest; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; /** diff --git a/src/Server/RequestHandler/InitializeHandler.php b/src/Server/Handler/Request/InitializeHandler.php similarity index 94% rename from src/Server/RequestHandler/InitializeHandler.php rename to src/Server/Handler/Request/InitializeHandler.php index e27d1fbb..124829f0 100644 --- a/src/Server/RequestHandler/InitializeHandler.php +++ b/src/Server/Handler/Request/InitializeHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler; +namespace Mcp\Server\Handler\Request; use Mcp\Schema\Implementation; use Mcp\Schema\JsonRpc\HasMethodInterface; @@ -17,7 +17,7 @@ use Mcp\Schema\Request\InitializeRequest; use Mcp\Schema\Result\InitializeResult; use Mcp\Schema\ServerCapabilities; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; /** diff --git a/src/Server/RequestHandler/ListPromptsHandler.php b/src/Server/Handler/Request/ListPromptsHandler.php similarity index 94% rename from src/Server/RequestHandler/ListPromptsHandler.php rename to src/Server/Handler/Request/ListPromptsHandler.php index 90459b3a..4a5b0556 100644 --- a/src/Server/RequestHandler/ListPromptsHandler.php +++ b/src/Server/Handler/Request/ListPromptsHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler; +namespace Mcp\Server\Handler\Request; use Mcp\Capability\Registry\ReferenceProviderInterface; use Mcp\Exception\InvalidCursorException; @@ -17,7 +17,7 @@ use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\ListPromptsRequest; use Mcp\Schema\Result\ListPromptsResult; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; /** diff --git a/src/Server/RequestHandler/ListResourcesHandler.php b/src/Server/Handler/Request/ListResourcesHandler.php similarity index 94% rename from src/Server/RequestHandler/ListResourcesHandler.php rename to src/Server/Handler/Request/ListResourcesHandler.php index f70e63d5..383a5f43 100644 --- a/src/Server/RequestHandler/ListResourcesHandler.php +++ b/src/Server/Handler/Request/ListResourcesHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler; +namespace Mcp\Server\Handler\Request; use Mcp\Capability\Registry\ReferenceProviderInterface; use Mcp\Exception\InvalidCursorException; @@ -17,7 +17,7 @@ use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\ListResourcesRequest; use Mcp\Schema\Result\ListResourcesResult; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; /** diff --git a/src/Server/RequestHandler/ListToolsHandler.php b/src/Server/Handler/Request/ListToolsHandler.php similarity index 94% rename from src/Server/RequestHandler/ListToolsHandler.php rename to src/Server/Handler/Request/ListToolsHandler.php index 757eb742..d34b9a5b 100644 --- a/src/Server/RequestHandler/ListToolsHandler.php +++ b/src/Server/Handler/Request/ListToolsHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler; +namespace Mcp\Server\Handler\Request; use Mcp\Capability\Registry\ReferenceProviderInterface; use Mcp\Exception\InvalidCursorException; @@ -17,7 +17,7 @@ use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\ListToolsRequest; use Mcp\Schema\Result\ListToolsResult; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; /** diff --git a/src/Server/RequestHandler/PingHandler.php b/src/Server/Handler/Request/PingHandler.php similarity index 91% rename from src/Server/RequestHandler/PingHandler.php rename to src/Server/Handler/Request/PingHandler.php index 30701332..bc2cae32 100644 --- a/src/Server/RequestHandler/PingHandler.php +++ b/src/Server/Handler/Request/PingHandler.php @@ -9,13 +9,13 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler; +namespace Mcp\Server\Handler\Request; use Mcp\Schema\JsonRpc\HasMethodInterface; use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\PingRequest; use Mcp\Schema\Result\EmptyResult; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; /** diff --git a/src/Server/RequestHandler/ReadResourceHandler.php b/src/Server/Handler/Request/ReadResourceHandler.php similarity index 94% rename from src/Server/RequestHandler/ReadResourceHandler.php rename to src/Server/Handler/Request/ReadResourceHandler.php index 455e23a5..fd208917 100644 --- a/src/Server/RequestHandler/ReadResourceHandler.php +++ b/src/Server/Handler/Request/ReadResourceHandler.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server\RequestHandler; +namespace Mcp\Server\Handler\Request; use Mcp\Capability\Resource\ResourceReaderInterface; use Mcp\Exception\ExceptionInterface; @@ -18,7 +18,7 @@ use Mcp\Schema\JsonRpc\HasMethodInterface; use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\ReadResourceRequest; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionInterface; /** diff --git a/src/Server/Transport/InMemoryTransport.php b/src/Server/Transport/InMemoryTransport.php index de80edee..2da8d215 100644 --- a/src/Server/Transport/InMemoryTransport.php +++ b/src/Server/Transport/InMemoryTransport.php @@ -11,7 +11,6 @@ namespace Mcp\Server\Transport; -use Mcp\Server\TransportInterface; use Symfony\Component\Uid\Uuid; /** diff --git a/src/Server/Transport/StdioTransport.php b/src/Server/Transport/StdioTransport.php index 89132cae..6b4a337a 100644 --- a/src/Server/Transport/StdioTransport.php +++ b/src/Server/Transport/StdioTransport.php @@ -11,7 +11,6 @@ namespace Mcp\Server\Transport; -use Mcp\Server\TransportInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Symfony\Component\Uid\Uuid; diff --git a/src/Server/Transport/StreamableHttpTransport.php b/src/Server/Transport/StreamableHttpTransport.php index 428315b4..7f5035fe 100644 --- a/src/Server/Transport/StreamableHttpTransport.php +++ b/src/Server/Transport/StreamableHttpTransport.php @@ -12,7 +12,6 @@ namespace Mcp\Server\Transport; use Mcp\Schema\JsonRpc\Error; -use Mcp\Server\TransportInterface; use Psr\Http\Message\ResponseFactoryInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; diff --git a/src/Server/TransportInterface.php b/src/Server/Transport/TransportInterface.php similarity index 98% rename from src/Server/TransportInterface.php rename to src/Server/Transport/TransportInterface.php index 6e975188..a8040a0f 100644 --- a/src/Server/TransportInterface.php +++ b/src/Server/Transport/TransportInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Server; +namespace Mcp\Server\Transport; use Symfony\Component\Uid\Uuid; diff --git a/tests/Unit/JsonRpc/HandlerTest.php b/tests/Unit/JsonRpc/HandlerTest.php index 2535449a..63c8e0f6 100644 --- a/tests/Unit/JsonRpc/HandlerTest.php +++ b/tests/Unit/JsonRpc/HandlerTest.php @@ -11,10 +11,10 @@ namespace Mcp\Tests\Unit\JsonRpc; -use Mcp\JsonRpc\Handler; use Mcp\JsonRpc\MessageFactory; use Mcp\Schema\JsonRpc\Response; -use Mcp\Server\MethodHandlerInterface; +use Mcp\Server\Handler\JsonRpcHandler; +use Mcp\Server\Handler\MethodHandlerInterface; use Mcp\Server\Session\SessionFactoryInterface; use Mcp\Server\Session\SessionInterface; use Mcp\Server\Session\SessionStoreInterface; @@ -56,7 +56,7 @@ public function testHandleMultipleNotifications() $sessionFactory->method('createWithId')->willReturn($session); $sessionStore->method('exists')->willReturn(true); - $jsonRpc = new Handler( + $jsonRpc = new JsonRpcHandler( MessageFactory::make(), $sessionFactory, $sessionStore, @@ -102,7 +102,7 @@ public function testHandleMultipleRequests() $sessionFactory->method('createWithId')->willReturn($session); $sessionStore->method('exists')->willReturn(true); - $jsonRpc = new Handler( + $jsonRpc = new JsonRpcHandler( MessageFactory::make(), $sessionFactory, $sessionStore, diff --git a/tests/Unit/Server/RequestHandler/CallToolHandlerTest.php b/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php similarity index 99% rename from tests/Unit/Server/RequestHandler/CallToolHandlerTest.php rename to tests/Unit/Server/Handler/Request/CallToolHandlerTest.php index ea0b8c17..da092c7e 100644 --- a/tests/Unit/Server/RequestHandler/CallToolHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Tests\Unit\Server\RequestHandler; +namespace Mcp\Tests\Unit\Server\Handler\Request; use Mcp\Capability\Tool\ToolCallerInterface; use Mcp\Exception\ToolCallException; @@ -19,7 +19,7 @@ use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\CallToolRequest; use Mcp\Schema\Result\CallToolResult; -use Mcp\Server\RequestHandler\CallToolHandler; +use Mcp\Server\Handler\Request\CallToolHandler; use Mcp\Server\Session\SessionInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/Unit/Server/RequestHandler/GetPromptHandlerTest.php b/tests/Unit/Server/Handler/Request/GetPromptHandlerTest.php similarity index 99% rename from tests/Unit/Server/RequestHandler/GetPromptHandlerTest.php rename to tests/Unit/Server/Handler/Request/GetPromptHandlerTest.php index e941ef41..9fba1b29 100644 --- a/tests/Unit/Server/RequestHandler/GetPromptHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/GetPromptHandlerTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Tests\Unit\Server\RequestHandler; +namespace Mcp\Tests\Unit\Server\Handler\Request; use Mcp\Capability\Prompt\PromptGetterInterface; use Mcp\Exception\PromptGetException; @@ -21,7 +21,7 @@ use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\GetPromptRequest; use Mcp\Schema\Result\GetPromptResult; -use Mcp\Server\RequestHandler\GetPromptHandler; +use Mcp\Server\Handler\Request\GetPromptHandler; use Mcp\Server\Session\SessionInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/Unit/Server/RequestHandler/ListPromptsHandlerTest.php b/tests/Unit/Server/Handler/Request/ListPromptsHandlerTest.php similarity index 98% rename from tests/Unit/Server/RequestHandler/ListPromptsHandlerTest.php rename to tests/Unit/Server/Handler/Request/ListPromptsHandlerTest.php index c3079e2d..21a73a9e 100644 --- a/tests/Unit/Server/RequestHandler/ListPromptsHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/ListPromptsHandlerTest.php @@ -9,14 +9,14 @@ * file that was distributed with this source code. */ -namespace Mcp\Tests\Unit\Server\RequestHandler; +namespace Mcp\Tests\Unit\Server\Handler\Request; use Mcp\Capability\Registry; use Mcp\Exception\InvalidCursorException; use Mcp\Schema\Prompt; use Mcp\Schema\Request\ListPromptsRequest; use Mcp\Schema\Result\ListPromptsResult; -use Mcp\Server\RequestHandler\ListPromptsHandler; +use Mcp\Server\Handler\Request\ListPromptsHandler; use Mcp\Server\Session\InMemorySessionStore; use Mcp\Server\Session\Session; use Mcp\Server\Session\SessionInterface; diff --git a/tests/Unit/Server/RequestHandler/ListResourcesHandlerTest.php b/tests/Unit/Server/Handler/Request/ListResourcesHandlerTest.php similarity index 98% rename from tests/Unit/Server/RequestHandler/ListResourcesHandlerTest.php rename to tests/Unit/Server/Handler/Request/ListResourcesHandlerTest.php index f1b6a6ca..232aef41 100644 --- a/tests/Unit/Server/RequestHandler/ListResourcesHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/ListResourcesHandlerTest.php @@ -9,14 +9,14 @@ * file that was distributed with this source code. */ -namespace Mcp\Tests\Unit\Server\RequestHandler; +namespace Mcp\Tests\Unit\Server\Handler\Request; use Mcp\Capability\Registry; use Mcp\Exception\InvalidCursorException; use Mcp\Schema\Request\ListResourcesRequest; use Mcp\Schema\Resource; use Mcp\Schema\Result\ListResourcesResult; -use Mcp\Server\RequestHandler\ListResourcesHandler; +use Mcp\Server\Handler\Request\ListResourcesHandler; use Mcp\Server\Session\InMemorySessionStore; use Mcp\Server\Session\Session; use Mcp\Server\Session\SessionInterface; diff --git a/tests/Unit/Server/RequestHandler/ListToolsHandlerTest.php b/tests/Unit/Server/Handler/Request/ListToolsHandlerTest.php similarity index 99% rename from tests/Unit/Server/RequestHandler/ListToolsHandlerTest.php rename to tests/Unit/Server/Handler/Request/ListToolsHandlerTest.php index d85c2bf7..32f2c35e 100644 --- a/tests/Unit/Server/RequestHandler/ListToolsHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/ListToolsHandlerTest.php @@ -9,14 +9,14 @@ * file that was distributed with this source code. */ -namespace Mcp\Tests\Unit\Server\RequestHandler; +namespace Mcp\Tests\Unit\Server\Handler\Request; use Mcp\Capability\Registry; use Mcp\Exception\InvalidCursorException; use Mcp\Schema\Request\ListToolsRequest; use Mcp\Schema\Result\ListToolsResult; use Mcp\Schema\Tool; -use Mcp\Server\RequestHandler\ListToolsHandler; +use Mcp\Server\Handler\Request\ListToolsHandler; use Mcp\Server\Session\InMemorySessionStore; use Mcp\Server\Session\Session; use Mcp\Server\Session\SessionInterface; diff --git a/tests/Unit/Server/RequestHandler/PingHandlerTest.php b/tests/Unit/Server/Handler/Request/PingHandlerTest.php similarity index 98% rename from tests/Unit/Server/RequestHandler/PingHandlerTest.php rename to tests/Unit/Server/Handler/Request/PingHandlerTest.php index 6c75e74a..2a33ecd1 100644 --- a/tests/Unit/Server/RequestHandler/PingHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/PingHandlerTest.php @@ -9,13 +9,13 @@ * file that was distributed with this source code. */ -namespace Mcp\Tests\Unit\Server\RequestHandler; +namespace Mcp\Tests\Unit\Server\Handler\Request; use Mcp\Schema\JsonRpc\Request; use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\PingRequest; use Mcp\Schema\Result\EmptyResult; -use Mcp\Server\RequestHandler\PingHandler; +use Mcp\Server\Handler\Request\PingHandler; use Mcp\Server\Session\SessionInterface; use PHPUnit\Framework\TestCase; diff --git a/tests/Unit/Server/RequestHandler/ReadResourceHandlerTest.php b/tests/Unit/Server/Handler/Request/ReadResourceHandlerTest.php similarity index 99% rename from tests/Unit/Server/RequestHandler/ReadResourceHandlerTest.php rename to tests/Unit/Server/Handler/Request/ReadResourceHandlerTest.php index ab6c8fb3..fd67becd 100644 --- a/tests/Unit/Server/RequestHandler/ReadResourceHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/ReadResourceHandlerTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Mcp\Tests\Unit\Server\RequestHandler; +namespace Mcp\Tests\Unit\Server\Handler\Request; use Mcp\Capability\Resource\ResourceReaderInterface; use Mcp\Exception\ResourceNotFoundException; @@ -20,7 +20,7 @@ use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\ReadResourceRequest; use Mcp\Schema\Result\ReadResourceResult; -use Mcp\Server\RequestHandler\ReadResourceHandler; +use Mcp\Server\Handler\Request\ReadResourceHandler; use Mcp\Server\Session\SessionInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/Unit/ServerTest.php b/tests/Unit/ServerTest.php index 34c04efc..1abba9f6 100644 --- a/tests/Unit/ServerTest.php +++ b/tests/Unit/ServerTest.php @@ -11,8 +11,8 @@ namespace Mcp\Tests\Unit; -use Mcp\JsonRpc\Handler; use Mcp\Server; +use Mcp\Server\Handler\JsonRpcHandler; use Mcp\Server\Transport\InMemoryTransport; use PHPUnit\Framework\TestCase; @@ -20,7 +20,7 @@ class ServerTest extends TestCase { public function testJsonExceptions() { - $handler = $this->getMockBuilder(Handler::class) + $handler = $this->getMockBuilder(JsonRpcHandler::class) ->disableOriginalConstructor() ->onlyMethods(['process']) ->getMock();