Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,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/"
}
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/bootstrap.php → examples/server/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/Inspector/Http/HttpClientCommunicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public static function provideMethods(): array

protected function getServerScript(): string
{
return \dirname(__DIR__, 3).'/examples/client-communication/server.php';
return \dirname(__DIR__, 3).'/examples/server/client-communication/server.php';
}
}
2 changes: 1 addition & 1 deletion tests/Inspector/Http/HttpCombinedRegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public static function provideMethods(): array

protected function getServerScript(): string
{
return \dirname(__DIR__, 3).'/examples/combined-registration/server.php';
return \dirname(__DIR__, 3).'/examples/server/combined-registration/server.php';
}
}
2 changes: 1 addition & 1 deletion tests/Inspector/Http/HttpComplexToolSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ public static function provideMethods(): array

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';
}
}
2 changes: 1 addition & 1 deletion tests/Inspector/Http/HttpDiscoveryUserProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public static function provideMethods(): array

protected function getServerScript(): string
{
return \dirname(__DIR__, 3).'/examples/discovery-userprofile/server.php';
return \dirname(__DIR__, 3).'/examples/server/discovery-userprofile/server.php';
}
}
2 changes: 1 addition & 1 deletion tests/Inspector/Http/HttpSchemaShowcaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static function provideMethods(): array

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
Expand Down
2 changes: 1 addition & 1 deletion tests/Inspector/Stdio/StdioCachedDiscoveryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ public static function provideMethods(): array

protected function getServerScript(): string
{
return \dirname(__DIR__, 3).'/examples/cached-discovery/server.php';
return \dirname(__DIR__, 3).'/examples/server/cached-discovery/server.php';
}
}
2 changes: 1 addition & 1 deletion tests/Inspector/Stdio/StdioCustomDependenciesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function provideMethods(): array

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
Expand Down
2 changes: 1 addition & 1 deletion tests/Inspector/Stdio/StdioDiscoveryCalculatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public static function provideMethods(): array

protected function getServerScript(): string
{
return \dirname(__DIR__, 3).'/examples/discovery-calculator/server.php';
return \dirname(__DIR__, 3).'/examples/server/discovery-calculator/server.php';
}
}
2 changes: 1 addition & 1 deletion tests/Inspector/Stdio/StdioEnvVariablesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public static function provideMethods(): array

protected function getServerScript(): string
{
return \dirname(__DIR__, 3).'/examples/env-variables/server.php';
return \dirname(__DIR__, 3).'/examples/server/env-variables/server.php';
}
}
2 changes: 1 addition & 1 deletion tests/Inspector/Stdio/StdioExplicitRegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ public static function provideMethods(): array

protected function getServerScript(): string
{
return \dirname(__DIR__, 3).'/examples/explicit-registration/server.php';
return \dirname(__DIR__, 3).'/examples/server/explicit-registration/server.php';
}
}