diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml new file mode 100644 index 000000000..b90f9eff3 --- /dev/null +++ b/.doctor-rst.yaml @@ -0,0 +1,96 @@ +rules: + american_english: ~ + argument_variable_must_match_type: ~ + avoid_repetetive_words: ~ +# be_kind_to_newcomers: ~ + blank_line_after_anchor: ~ +# blank_line_after_colon: ~ + blank_line_after_directive: ~ +# blank_line_after_filepath_in_code_block: ~ +# blank_line_after_filepath_in_php_code_block: ~ +# blank_line_after_filepath_in_twig_code_block: ~ +# blank_line_after_filepath_in_xml_code_block: ~ +# blank_line_after_filepath_in_yaml_code_block: ~ + blank_line_before_directive: ~ +# composer_dev_option_at_the_end: ~ + composer_dev_option_not_at_the_end: ~ + correct_code_block_directive_based_on_the_content: ~ + deprecated_directive_major_version: + major_version: 2 + deprecated_directive_min_version: + min_version: '2.0' + deprecated_directive_should_have_version: ~ + ensure_bash_prompt_before_composer_command: ~ + ensure_exactly_one_space_before_directive_type: ~ + ensure_exactly_one_space_between_link_definition_and_link: ~ + ensure_link_definition_contains_valid_url: ~ + ensure_order_of_code_blocks_in_configuration_block: ~ + extend_abstract_admin: ~ + extend_abstract_controller: ~ +# extend_controller: ~ + extension_xlf_instead_of_xliff: ~ +# filename_uses_dashes_only: ~ +# filename_uses_underscores_only: ~ + final_admin_classes: ~ + final_admin_extension_classes: ~ + forbidden_directives: + directives: + - '.. index::' + indention: ~ + kernel_instead_of_app_kernel: ~ +# line_length: ~ + lowercase_as_in_use_statements: ~ + max_blank_lines: + max: 2 + max_colons: ~ + no_admin_yaml: ~ + no_app_bundle: ~ + no_app_console: ~ +# no_bash_prompt: ~ + no_blank_line_after_filepath_in_code_block: ~ + no_blank_line_after_filepath_in_php_code_block: ~ + no_blank_line_after_filepath_in_twig_code_block: ~ + no_blank_line_after_filepath_in_xml_code_block: ~ + no_blank_line_after_filepath_in_yaml_code_block: ~ + no_brackets_in_method_directive: ~ + no_composer_phar: ~ + no_composer_req: ~ + no_config_yaml: ~ +# no_contraction: ~ + no_directive_after_shorthand: ~ + no_explicit_use_of_code_block_php: ~ + no_inheritdoc_in_code_examples: ~ + no_merge_conflict: ~ + no_namespace_after_use_statements: ~ + no_php_open_tag_in_code_block_php_directive: ~ +# no_php_prefix_before_bin_console: ~ +# no_php_prefix_before_composer: ~ +# no_space_before_self_xml_closing_tag: ~ + only_backslashes_in_namespace_in_php_code_block: ~ + only_backslashes_in_use_statements_in_php_code_block: ~ + ordered_use_statements: ~ +# php_open_tag_in_code_block_php_directive: ~ + php_prefix_before_bin_console: ~ + replace_code_block_types: ~ + replacement: ~ + short_array_syntax: ~ +# space_before_self_xml_closing_tag: ~ + space_between_label_and_link_in_doc: ~ + space_between_label_and_link_in_ref: ~ + string_replacement: ~ + title_underline_length_must_match_title_length: ~ + typo: ~ + unused_links: ~ + use_deprecated_directive_instead_of_versionadded: ~ + use_https_xsd_urls: ~ +# use_named_constructor_without_new_keyword_rule: ~ + valid_inline_highlighted_namespaces: ~ + valid_use_statements: ~ + versionadded_directive_major_version: + major_version: 2 + versionadded_directive_min_version: + min_version: '2.0' + versionadded_directive_should_have_version: ~ + yaml_instead_of_yml_suffix: ~ + yarn_dev_option_at_the_end: ~ +# yarn_dev_option_not_at_the_end: ~ diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 67788bbfc..84c9bb48e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,13 +1,54 @@ in('src') - ->exclude(['var', 'vendor']) -; +declare(strict_types=1); + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (!file_exists(__DIR__.'/src')) { + exit(0); +} + +$fileHeaderParts = [ + <<<'EOF' + This file is part of the Symfony package. + + (c) Fabien Potencier + + EOF, + <<<'EOF' + + For the full copyright and license information, please view the LICENSE + file that was distributed with this source code. + EOF, +]; return (new PhpCsFixer\Config()) + // @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/7777 + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ->setRules([ + '@PHP71Migration' => true, + '@PHPUnit75Migration:risky' => true, '@Symfony' => true, + '@Symfony:risky' => true, + 'protected_to_private' => false, + 'declare_strict_types' => true, + 'header_comment' => [ + 'header' => implode('', $fileHeaderParts), + ], ]) - ->setFinder($finder) + ->setRiskyAllowed(true) + ->setFinder( + (new PhpCsFixer\Finder()) + ->in(__DIR__.'/src') + ->append([__FILE__]) + ->notPath('#/Fixtures/#') + ) + ->setCacheFile('.php-cs-fixer.cache') ; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..7902d9aff --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +Contributing +------------ + +Symfony is an open source, community-driven project. + +If you'd like to contribute, please read the following documents: + +* [Reviewing issues/pull requests][0] +* [Reporting a Bug][1] +* [Submitting a Patch][2] +* [Symfony Core Team][3] +* [Security Issues][4] +* [Running Symfony Tests][5] +* [Our Backwards Compatibility Promise][6] +* [Coding Standards][7] +* [Conventions][8] + +[0]: https://symfony.com/doc/current/contributing/community/reviews.html +[1]: https://symfony.com/doc/current/contributing/code/bugs.html +[2]: https://symfony.com/doc/current/contributing/code/patches.html +[3]: https://symfony.com/doc/current/contributing/code/core_team.html +[4]: https://symfony.com/doc/current/contributing/code/security.html +[5]: https://symfony.com/doc/current/contributing/code/tests.html +[6]: https://symfony.com/doc/current/contributing/code/bc.html +[7]: https://symfony.com/doc/current/contributing/code/standards.html +[8]: https://symfony.com/doc/current/contributing/code/conventions.html diff --git a/README.md b/README.md new file mode 100644 index 000000000..09119044e --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +

+ Symfony Logo +

+ +

+ Symfony AI +

+ +Symfony AI is a set of packages that integrate AI capabilities into PHP applications. + +## Sponsor + +Help Symfony by [sponsoring][2] its development! + +## Contributing + +Thank you for considering contributing to Symfony AI! You can find the [contribution guide here](CONTRIBUTING.md). + +[1]: https://symfony.com/backers +[2]: https://symfony.com/sponsor diff --git a/composer.json b/composer.json index c2924e22c..0024d3c17 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "require-dev": { "php": ">=8.1", "symfony/filesystem": "^6.4|^7.0", - "symfony/finder": "^6.4|^7.0" + "symfony/finder": "^6.4|^7.0", + "php-cs-fixer/shim": "^3.75" } } diff --git a/src/mcp-sdk/README.md b/src/mcp-sdk/README.md index 21905fd97..c7637bedd 100644 --- a/src/mcp-sdk/README.md +++ b/src/mcp-sdk/README.md @@ -1,119 +1,26 @@ -# Model Context Protocol PHP SDK [WIP] +# Model Context Protocol PHP SDK Model Context Protocol SDK for Client and Server applications in PHP. -**Currently only support Tool Calls as Server via Server-Sent Events (SSE) and STDIO.** - -See [Demo App](https://github.com/php-llm/mcp-demo) for a working example and [MCP Bundle](https://github.com/php-llm/mcp-bundle) for Symfony integration. ## Installation ```bash -composer require php-llm/mcp-sdk -``` - -## Usage with Symfony - -Server integration points for are tailored to Symfony Console and HttpFoundation (Laravel compatible). - -### Console Command for STDIO Server - -```php -namespace App\Command; - -use PhpLlm\McpSdk\Server; -use PhpLlm\McpSdk\Server\Transport\Stdio\SymfonyConsoleTransport; -use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -#[AsCommand('mcp', 'Starts an MCP server')] -final class McpCommand extends Command -{ - public function __construct( - private readonly Server $server, - ) { - parent::__construct(); - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $this->server->connect( - new SymfonyConsoleTransport($input, $output) - ); - - return Command::SUCCESS; - } -} +composer require symfony/mcp-sdk ``` -### Controller for Server-Sent Events Server +This is a low level SDK that implements the [Model Context Protocol](https://modelcontextprotocol.io/) +(MCP). The protocol is used by LLM model to build "plugins" and give them extra +context. Example the logged in users' latest order. -```php -namespace App\Controller; +**This repository is a READ-ONLY sub-tree split**. See +https://github.com/symfony/ai to create issues or submit pull requests. -use PhpLlm\McpSdk\Server; -use PhpLlm\McpSdk\Server\Transport\Sse\Store\CachePoolStore; -use PhpLlm\McpSdk\Server\Transport\Sse\StreamTransport; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpKernel\Attribute\AsController; -use Symfony\Component\Routing\Attribute\Route; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Uid\Uuid; +## Resources -#[AsController] -#[Route('/mcp', name: 'mcp_')] -final readonly class McpController -{ - public function __construct( - private Server $server, - private CachePoolStore $store, - private UrlGeneratorInterface $urlGenerator, - ) { - } +- [Documentation](doc/index.rst) +- [Report issues](https://github.com/symfony/ai/issues) and + [send Pull Requests](https://github.com/symfony/ai/pulls) + in the [main Symfony AI repository](https://github.com/symfony/ai) - #[Route('/sse', name: 'sse', methods: ['GET'])] - public function sse(): StreamedResponse - { - $id = Uuid::v4(); - $endpoint = $this->urlGenerator->generate('mcp_messages', ['id' => $id], UrlGeneratorInterface::ABSOLUTE_URL); - $transport = new StreamTransport($endpoint, $this->store, $id); - - return new StreamedResponse(fn() => $this->server->connect($transport), headers: [ - 'Content-Type' => 'text/event-stream', - 'Cache-Control' => 'no-cache', - 'X-Accel-Buffering' => 'no', - ]); - } - - #[Route('/messages/{id}', name: 'messages', methods: ['POST'])] - public function messages(Request $request, Uuid $id): Response - { - $this->store->push($id, $request->getContent()); - - return new Response(); - } -} -``` - -### Exposing Tools - -Under the hood the SDK uses [LLM Chain](https://github.com/php-llm/llm-chain)'s `ToolBox` to register, analyze and -execute tools. In combination with its [Symfony Bundle](https://github.com/php-llm/llm-chain-bundle) you can expose -tools with `#[AsTool]` attribute. - -```php -use PhpLlm\LlmChain\ToolBox\Attribute\AsTool; - -#[AsTool('company_name', 'Provides the name of your company')] -final class CompanyName -{ - public function __invoke(): string - { - return 'ACME Corp.' - } -} -``` -See [LLM Chain Documentation](https://github.com/php-llm/llm-chain?tab=readme-ov-file#tools) for more information. +[1]: https://symfony.com/backers +[3]: https://symfony.com/sponsor diff --git a/src/mcp-sdk/composer.json b/src/mcp-sdk/composer.json index 8bc29e69a..3cfeb4898 100644 --- a/src/mcp-sdk/composer.json +++ b/src/mcp-sdk/composer.json @@ -1,5 +1,5 @@ { - "name": "php-llm/mcp-sdk", + "name": "symfony/mcp-sdk", "type": "library", "description": "Model Context Protocol SDK for Client and Server applications in PHP", "license": "MIT", @@ -31,12 +31,12 @@ }, "autoload": { "psr-4": { - "PhpLlm\\McpSdk\\": "src/" + "Symfony\\AI\\McpSdk\\": "src/" } }, "autoload-dev": { "psr-4": { - "PhpLlm\\McpSdk\\Tests\\": "tests/" + "Symfony\\AI\\McpSdk\\Tests\\": "tests/" } } } diff --git a/src/mcp-sdk/doc/index.rst b/src/mcp-sdk/doc/index.rst new file mode 100644 index 000000000..532165e82 --- /dev/null +++ b/src/mcp-sdk/doc/index.rst @@ -0,0 +1,32 @@ +Model Context Protocol SDK +========================== + +Symfony AI MCP SDK is the low level library that enables communication between +a PHP application and an LLM model. + +Installation +------------ + +Install the bundle using Composer: + +.. code-block:: terminal + + $ composer require symfony/mcp-sdk + +Usage +----- + +The `Model Context Protocol`_ is built on top of JSON-RPC. There two types of +messages. A Notification and Request. The Notification is just a status update +that something has happened. There is never a response to a Notification. A Request +is a message that expects a response. There are 3 concepts that you may request. +These are:: + +1. **Resources**: File-like data that can be read by clients (like API responses or file contents) +1. **Tools**: Functions that can be called by the LLM (with user approval) +1. **Prompts**: Pre-written templates that help users accomplish specific tasks + +The SDK comes with NotificationHandlers and RequestHandlers which are expected +to be wired up in your application. + +.. _`Model Context Protocol`: https://modelcontextprotocol.io/ diff --git a/src/mcp-sdk/examples/cli/index.php b/src/mcp-sdk/examples/cli/index.php index bf7040dab..ca90b7b65 100644 --- a/src/mcp-sdk/examples/cli/index.php +++ b/src/mcp-sdk/examples/cli/index.php @@ -1,5 +1,16 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + require __DIR__.'/vendor/autoload.php'; use Symfony\Component\Console as SymfonyConsole; @@ -13,18 +24,18 @@ $logger = new SymfonyConsole\Logger\ConsoleLogger($output); // Configure the JsonRpcHandler and build the functionality -$jsonRpcHandler = new PhpLlm\McpSdk\Server\JsonRpcHandler( - new PhpLlm\McpSdk\Message\Factory(), +$jsonRpcHandler = new Symfony\AI\McpSdk\Server\JsonRpcHandler( + new Symfony\AI\McpSdk\Message\Factory(), App\Builder::buildRequestHandlers(), App\Builder::buildNotificationHandlers(), $logger ); // Set up the server -$sever = new PhpLlm\McpSdk\Server($jsonRpcHandler, $logger); +$sever = new Symfony\AI\McpSdk\Server($jsonRpcHandler, $logger); // Create the transport layer using Symfony Console -$transport = new PhpLlm\McpSdk\Server\Transport\Stdio\SymfonyConsoleTransport($input, $output); +$transport = new Symfony\AI\McpSdk\Server\Transport\Stdio\SymfonyConsoleTransport($input, $output); // Start our application $sever->connect($transport); diff --git a/src/mcp-sdk/examples/cli/src/Builder.php b/src/mcp-sdk/examples/cli/src/Builder.php index 40e5a9c69..bb4ccafad 100644 --- a/src/mcp-sdk/examples/cli/src/Builder.php +++ b/src/mcp-sdk/examples/cli/src/Builder.php @@ -1,21 +1,32 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace App; -use PhpLlm\McpSdk\Capability\PromptChain; -use PhpLlm\McpSdk\Capability\ResourceChain; -use PhpLlm\McpSdk\Capability\ToolChain; -use PhpLlm\McpSdk\Server\NotificationHandler\InitializedHandler; -use PhpLlm\McpSdk\Server\NotificationHandlerInterface; -use PhpLlm\McpSdk\Server\RequestHandler\InitializeHandler; -use PhpLlm\McpSdk\Server\RequestHandler\PingHandler; -use PhpLlm\McpSdk\Server\RequestHandler\PromptGetHandler; -use PhpLlm\McpSdk\Server\RequestHandler\PromptListHandler; -use PhpLlm\McpSdk\Server\RequestHandler\ResourceListHandler; -use PhpLlm\McpSdk\Server\RequestHandler\ResourceReadHandler; -use PhpLlm\McpSdk\Server\RequestHandler\ToolCallHandler; -use PhpLlm\McpSdk\Server\RequestHandler\ToolListHandler; -use PhpLlm\McpSdk\Server\RequestHandlerInterface; +use Symfony\AI\McpSdk\Capability\PromptChain; +use Symfony\AI\McpSdk\Capability\ResourceChain; +use Symfony\AI\McpSdk\Capability\ToolChain; +use Symfony\AI\McpSdk\Server\NotificationHandler\InitializedHandler; +use Symfony\AI\McpSdk\Server\NotificationHandlerInterface; +use Symfony\AI\McpSdk\Server\RequestHandler\InitializeHandler; +use Symfony\AI\McpSdk\Server\RequestHandler\PingHandler; +use Symfony\AI\McpSdk\Server\RequestHandler\PromptGetHandler; +use Symfony\AI\McpSdk\Server\RequestHandler\PromptListHandler; +use Symfony\AI\McpSdk\Server\RequestHandler\ResourceListHandler; +use Symfony\AI\McpSdk\Server\RequestHandler\ResourceReadHandler; +use Symfony\AI\McpSdk\Server\RequestHandler\ToolCallHandler; +use Symfony\AI\McpSdk\Server\RequestHandler\ToolListHandler; +use Symfony\AI\McpSdk\Server\RequestHandlerInterface; class Builder { diff --git a/src/mcp-sdk/examples/cli/src/ExamplePrompt.php b/src/mcp-sdk/examples/cli/src/ExamplePrompt.php index bbe86c902..c247398e0 100644 --- a/src/mcp-sdk/examples/cli/src/ExamplePrompt.php +++ b/src/mcp-sdk/examples/cli/src/ExamplePrompt.php @@ -1,12 +1,23 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace App; -use PhpLlm\McpSdk\Capability\Prompt\MetadataInterface; -use PhpLlm\McpSdk\Capability\Prompt\PromptGet; -use PhpLlm\McpSdk\Capability\Prompt\PromptGetResult; -use PhpLlm\McpSdk\Capability\Prompt\PromptGetResultMessages; -use PhpLlm\McpSdk\Capability\Prompt\PromptGetterInterface; +use Symfony\AI\McpSdk\Capability\Prompt\MetadataInterface; +use Symfony\AI\McpSdk\Capability\Prompt\PromptGet; +use Symfony\AI\McpSdk\Capability\Prompt\PromptGetResult; +use Symfony\AI\McpSdk\Capability\Prompt\PromptGetResultMessages; +use Symfony\AI\McpSdk\Capability\Prompt\PromptGetterInterface; class ExamplePrompt implements MetadataInterface, PromptGetterInterface { @@ -18,7 +29,7 @@ public function get(PromptGet $input): PromptGetResult $this->getDescription(), [new PromptGetResultMessages( 'user', - sprintf('Hello %s', $firstName ?? 'World') + \sprintf('Hello %s', $firstName ?? 'World') )] ); } diff --git a/src/mcp-sdk/examples/cli/src/ExampleResource.php b/src/mcp-sdk/examples/cli/src/ExampleResource.php index 9e6cdba73..b264d26cc 100644 --- a/src/mcp-sdk/examples/cli/src/ExampleResource.php +++ b/src/mcp-sdk/examples/cli/src/ExampleResource.php @@ -1,11 +1,22 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace App; -use PhpLlm\McpSdk\Capability\Resource\MetadataInterface; -use PhpLlm\McpSdk\Capability\Resource\ResourceRead; -use PhpLlm\McpSdk\Capability\Resource\ResourceReaderInterface; -use PhpLlm\McpSdk\Capability\Resource\ResourceReadResult; +use Symfony\AI\McpSdk\Capability\Resource\MetadataInterface; +use Symfony\AI\McpSdk\Capability\Resource\ResourceRead; +use Symfony\AI\McpSdk\Capability\Resource\ResourceReaderInterface; +use Symfony\AI\McpSdk\Capability\Resource\ResourceReadResult; class ExampleResource implements MetadataInterface, ResourceReaderInterface { diff --git a/src/mcp-sdk/examples/cli/src/ExampleTool.php b/src/mcp-sdk/examples/cli/src/ExampleTool.php index 618acb916..e459b019e 100644 --- a/src/mcp-sdk/examples/cli/src/ExampleTool.php +++ b/src/mcp-sdk/examples/cli/src/ExampleTool.php @@ -1,11 +1,22 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace App; -use PhpLlm\McpSdk\Capability\Tool\MetadataInterface; -use PhpLlm\McpSdk\Capability\Tool\ToolCall; -use PhpLlm\McpSdk\Capability\Tool\ToolCallResult; -use PhpLlm\McpSdk\Capability\Tool\ToolExecutorInterface; +use Symfony\AI\McpSdk\Capability\Tool\MetadataInterface; +use Symfony\AI\McpSdk\Capability\Tool\ToolCall; +use Symfony\AI\McpSdk\Capability\Tool\ToolCallResult; +use Symfony\AI\McpSdk\Capability\Tool\ToolExecutorInterface; class ExampleTool implements MetadataInterface, ToolExecutorInterface { diff --git a/src/mcp-sdk/src/Capability/Prompt/CollectionInterface.php b/src/mcp-sdk/src/Capability/Prompt/CollectionInterface.php index 377585c52..71df2162f 100644 --- a/src/mcp-sdk/src/Capability/Prompt/CollectionInterface.php +++ b/src/mcp-sdk/src/Capability/Prompt/CollectionInterface.php @@ -1,6 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Prompt; interface CollectionInterface { diff --git a/src/mcp-sdk/src/Capability/Prompt/IdentifierInterface.php b/src/mcp-sdk/src/Capability/Prompt/IdentifierInterface.php index 8096c178c..4b7fa035d 100644 --- a/src/mcp-sdk/src/Capability/Prompt/IdentifierInterface.php +++ b/src/mcp-sdk/src/Capability/Prompt/IdentifierInterface.php @@ -1,6 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Prompt; interface IdentifierInterface { diff --git a/src/mcp-sdk/src/Capability/Prompt/MetadataInterface.php b/src/mcp-sdk/src/Capability/Prompt/MetadataInterface.php index 6dc340403..9e262067e 100644 --- a/src/mcp-sdk/src/Capability/Prompt/MetadataInterface.php +++ b/src/mcp-sdk/src/Capability/Prompt/MetadataInterface.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Prompt; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Prompt; interface MetadataInterface extends IdentifierInterface { diff --git a/src/mcp-sdk/src/Capability/Prompt/PromptGet.php b/src/mcp-sdk/src/Capability/Prompt/PromptGet.php index 22c64f427..e729eaa92 100644 --- a/src/mcp-sdk/src/Capability/Prompt/PromptGet.php +++ b/src/mcp-sdk/src/Capability/Prompt/PromptGet.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Prompt; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Prompt; final readonly class PromptGet { diff --git a/src/mcp-sdk/src/Capability/Prompt/PromptGetResult.php b/src/mcp-sdk/src/Capability/Prompt/PromptGetResult.php index 5362680d6..a998627b8 100644 --- a/src/mcp-sdk/src/Capability/Prompt/PromptGetResult.php +++ b/src/mcp-sdk/src/Capability/Prompt/PromptGetResult.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Prompt; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Prompt; final readonly class PromptGetResult { diff --git a/src/mcp-sdk/src/Capability/Prompt/PromptGetResultMessages.php b/src/mcp-sdk/src/Capability/Prompt/PromptGetResultMessages.php index 48f85310d..7c3a69d32 100644 --- a/src/mcp-sdk/src/Capability/Prompt/PromptGetResultMessages.php +++ b/src/mcp-sdk/src/Capability/Prompt/PromptGetResultMessages.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Prompt; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Prompt; final readonly class PromptGetResultMessages { diff --git a/src/mcp-sdk/src/Capability/Prompt/PromptGetterInterface.php b/src/mcp-sdk/src/Capability/Prompt/PromptGetterInterface.php index 75f2b86e4..d877bd2d9 100644 --- a/src/mcp-sdk/src/Capability/Prompt/PromptGetterInterface.php +++ b/src/mcp-sdk/src/Capability/Prompt/PromptGetterInterface.php @@ -1,9 +1,20 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Prompt; + +use Symfony\AI\McpSdk\Exception\PromptGetException; +use Symfony\AI\McpSdk\Exception\PromptNotFoundException; interface PromptGetterInterface { diff --git a/src/mcp-sdk/src/Capability/PromptChain.php b/src/mcp-sdk/src/Capability/PromptChain.php index 49f8e1d55..761c8ce11 100644 --- a/src/mcp-sdk/src/Capability/PromptChain.php +++ b/src/mcp-sdk/src/Capability/PromptChain.php @@ -1,15 +1,26 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability; + +use Symfony\AI\McpSdk\Capability\Prompt\CollectionInterface; +use Symfony\AI\McpSdk\Capability\Prompt\IdentifierInterface; +use Symfony\AI\McpSdk\Capability\Prompt\MetadataInterface; +use Symfony\AI\McpSdk\Capability\Prompt\PromptGet; +use Symfony\AI\McpSdk\Capability\Prompt\PromptGetResult; +use Symfony\AI\McpSdk\Capability\Prompt\PromptGetterInterface; +use Symfony\AI\McpSdk\Exception\PromptGetException; +use Symfony\AI\McpSdk\Exception\PromptNotFoundException; /** * A collection of prompts. All prompts need to implement IdentifierInterface. diff --git a/src/mcp-sdk/src/Capability/Resource/CollectionInterface.php b/src/mcp-sdk/src/Capability/Resource/CollectionInterface.php index d4a4fbed9..b8bc12418 100644 --- a/src/mcp-sdk/src/Capability/Resource/CollectionInterface.php +++ b/src/mcp-sdk/src/Capability/Resource/CollectionInterface.php @@ -1,6 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Resource; interface CollectionInterface { diff --git a/src/mcp-sdk/src/Capability/Resource/IdentifierInterface.php b/src/mcp-sdk/src/Capability/Resource/IdentifierInterface.php index e3ee06e14..3ee5b93e4 100644 --- a/src/mcp-sdk/src/Capability/Resource/IdentifierInterface.php +++ b/src/mcp-sdk/src/Capability/Resource/IdentifierInterface.php @@ -1,6 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Resource; interface IdentifierInterface { diff --git a/src/mcp-sdk/src/Capability/Resource/MetadataInterface.php b/src/mcp-sdk/src/Capability/Resource/MetadataInterface.php index 253ce8c9f..dafabdbc4 100644 --- a/src/mcp-sdk/src/Capability/Resource/MetadataInterface.php +++ b/src/mcp-sdk/src/Capability/Resource/MetadataInterface.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Resource; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Resource; interface MetadataInterface extends IdentifierInterface { diff --git a/src/mcp-sdk/src/Capability/Resource/ResourceRead.php b/src/mcp-sdk/src/Capability/Resource/ResourceRead.php index 6e2ed67ec..c23ddded7 100644 --- a/src/mcp-sdk/src/Capability/Resource/ResourceRead.php +++ b/src/mcp-sdk/src/Capability/Resource/ResourceRead.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Resource; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Resource; final readonly class ResourceRead { diff --git a/src/mcp-sdk/src/Capability/Resource/ResourceReadResult.php b/src/mcp-sdk/src/Capability/Resource/ResourceReadResult.php index 4887ed0a6..f6ad7d75a 100644 --- a/src/mcp-sdk/src/Capability/Resource/ResourceReadResult.php +++ b/src/mcp-sdk/src/Capability/Resource/ResourceReadResult.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Resource; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Resource; final readonly class ResourceReadResult { diff --git a/src/mcp-sdk/src/Capability/Resource/ResourceReaderInterface.php b/src/mcp-sdk/src/Capability/Resource/ResourceReaderInterface.php index 3102ac886..ced197e52 100644 --- a/src/mcp-sdk/src/Capability/Resource/ResourceReaderInterface.php +++ b/src/mcp-sdk/src/Capability/Resource/ResourceReaderInterface.php @@ -1,9 +1,20 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Resource; + +use Symfony\AI\McpSdk\Exception\ResourceNotFoundException; +use Symfony\AI\McpSdk\Exception\ResourceReadException; interface ResourceReaderInterface { diff --git a/src/mcp-sdk/src/Capability/ResourceChain.php b/src/mcp-sdk/src/Capability/ResourceChain.php index e16d74cbb..8d46f8689 100644 --- a/src/mcp-sdk/src/Capability/ResourceChain.php +++ b/src/mcp-sdk/src/Capability/ResourceChain.php @@ -1,15 +1,26 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability; + +use Symfony\AI\McpSdk\Capability\Resource\CollectionInterface; +use Symfony\AI\McpSdk\Capability\Resource\IdentifierInterface; +use Symfony\AI\McpSdk\Capability\Resource\MetadataInterface; +use Symfony\AI\McpSdk\Capability\Resource\ResourceRead; +use Symfony\AI\McpSdk\Capability\Resource\ResourceReaderInterface; +use Symfony\AI\McpSdk\Capability\Resource\ResourceReadResult; +use Symfony\AI\McpSdk\Exception\ResourceNotFoundException; +use Symfony\AI\McpSdk\Exception\ResourceReadException; /** * A collection of resources. All resources need to implement IdentifierInterface. diff --git a/src/mcp-sdk/src/Capability/Tool/CollectionInterface.php b/src/mcp-sdk/src/Capability/Tool/CollectionInterface.php index 2140fbf2f..bd1b1252e 100644 --- a/src/mcp-sdk/src/Capability/Tool/CollectionInterface.php +++ b/src/mcp-sdk/src/Capability/Tool/CollectionInterface.php @@ -1,6 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Tool; interface CollectionInterface { diff --git a/src/mcp-sdk/src/Capability/Tool/IdentifierInterface.php b/src/mcp-sdk/src/Capability/Tool/IdentifierInterface.php index 7dd5bb2b9..05ecba124 100644 --- a/src/mcp-sdk/src/Capability/Tool/IdentifierInterface.php +++ b/src/mcp-sdk/src/Capability/Tool/IdentifierInterface.php @@ -1,6 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Tool; interface IdentifierInterface { diff --git a/src/mcp-sdk/src/Capability/Tool/MetadataInterface.php b/src/mcp-sdk/src/Capability/Tool/MetadataInterface.php index 24d870d11..adafaf2fe 100644 --- a/src/mcp-sdk/src/Capability/Tool/MetadataInterface.php +++ b/src/mcp-sdk/src/Capability/Tool/MetadataInterface.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Tool; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Tool; interface MetadataInterface extends IdentifierInterface { diff --git a/src/mcp-sdk/src/Capability/Tool/ToolCall.php b/src/mcp-sdk/src/Capability/Tool/ToolCall.php index d438dfc72..1682d6dc8 100644 --- a/src/mcp-sdk/src/Capability/Tool/ToolCall.php +++ b/src/mcp-sdk/src/Capability/Tool/ToolCall.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Tool; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Tool; final readonly class ToolCall { diff --git a/src/mcp-sdk/src/Capability/Tool/ToolCallResult.php b/src/mcp-sdk/src/Capability/Tool/ToolCallResult.php index b4b495132..4c9609a1d 100644 --- a/src/mcp-sdk/src/Capability/Tool/ToolCallResult.php +++ b/src/mcp-sdk/src/Capability/Tool/ToolCallResult.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Capability\Tool; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Tool; final readonly class ToolCallResult { diff --git a/src/mcp-sdk/src/Capability/Tool/ToolCollectionInterface.php b/src/mcp-sdk/src/Capability/Tool/ToolCollectionInterface.php index ffb378b4a..f695b0329 100644 --- a/src/mcp-sdk/src/Capability/Tool/ToolCollectionInterface.php +++ b/src/mcp-sdk/src/Capability/Tool/ToolCollectionInterface.php @@ -1,6 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Tool; interface ToolCollectionInterface { diff --git a/src/mcp-sdk/src/Capability/Tool/ToolExecutorInterface.php b/src/mcp-sdk/src/Capability/Tool/ToolExecutorInterface.php index a80c20156..4906e48f2 100644 --- a/src/mcp-sdk/src/Capability/Tool/ToolExecutorInterface.php +++ b/src/mcp-sdk/src/Capability/Tool/ToolExecutorInterface.php @@ -1,9 +1,20 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability\Tool; + +use Symfony\AI\McpSdk\Exception\ToolExecutionException; +use Symfony\AI\McpSdk\Exception\ToolNotFoundException; interface ToolExecutorInterface { diff --git a/src/mcp-sdk/src/Capability/ToolChain.php b/src/mcp-sdk/src/Capability/ToolChain.php index 6d3eb9ee0..7b48b5532 100644 --- a/src/mcp-sdk/src/Capability/ToolChain.php +++ b/src/mcp-sdk/src/Capability/ToolChain.php @@ -1,15 +1,26 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Capability; + +use Symfony\AI\McpSdk\Capability\Tool\CollectionInterface; +use Symfony\AI\McpSdk\Capability\Tool\IdentifierInterface; +use Symfony\AI\McpSdk\Capability\Tool\MetadataInterface; +use Symfony\AI\McpSdk\Capability\Tool\ToolCall; +use Symfony\AI\McpSdk\Capability\Tool\ToolCallResult; +use Symfony\AI\McpSdk\Capability\Tool\ToolExecutorInterface; +use Symfony\AI\McpSdk\Exception\ToolExecutionException; +use Symfony\AI\McpSdk\Exception\ToolNotFoundException; /** * A collection of tools. All tools need to implement IdentifierInterface. diff --git a/src/mcp-sdk/src/Exception/ExceptionInterface.php b/src/mcp-sdk/src/Exception/ExceptionInterface.php index 14b84f4a8..597451e0d 100644 --- a/src/mcp-sdk/src/Exception/ExceptionInterface.php +++ b/src/mcp-sdk/src/Exception/ExceptionInterface.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Exception; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Exception; interface ExceptionInterface { diff --git a/src/mcp-sdk/src/Exception/NotFoundExceptionInterface.php b/src/mcp-sdk/src/Exception/NotFoundExceptionInterface.php index dd0294ead..eb25edaad 100644 --- a/src/mcp-sdk/src/Exception/NotFoundExceptionInterface.php +++ b/src/mcp-sdk/src/Exception/NotFoundExceptionInterface.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Exception; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Exception; interface NotFoundExceptionInterface extends ExceptionInterface { diff --git a/src/mcp-sdk/src/Exception/PromptGetException.php b/src/mcp-sdk/src/Exception/PromptGetException.php index 0e3f60911..82b5494fe 100644 --- a/src/mcp-sdk/src/Exception/PromptGetException.php +++ b/src/mcp-sdk/src/Exception/PromptGetException.php @@ -2,9 +2,18 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Exception; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Prompt\PromptGet; +namespace Symfony\AI\McpSdk\Exception; + +use Symfony\AI\McpSdk\Capability\Prompt\PromptGet; final class PromptGetException extends \RuntimeException implements ExceptionInterface { @@ -12,6 +21,6 @@ public function __construct( public readonly PromptGet $promptGet, ?\Throwable $previous = null, ) { - parent::__construct(sprintf('Handling prompt "%s" failed with error: %s', $promptGet->name, $previous->getMessage()), previous: $previous); + parent::__construct(\sprintf('Handling prompt "%s" failed with error: %s', $promptGet->name, $previous->getMessage()), previous: $previous); } } diff --git a/src/mcp-sdk/src/Exception/PromptNotFoundException.php b/src/mcp-sdk/src/Exception/PromptNotFoundException.php index fb163b3ca..d98d8b704 100644 --- a/src/mcp-sdk/src/Exception/PromptNotFoundException.php +++ b/src/mcp-sdk/src/Exception/PromptNotFoundException.php @@ -2,15 +2,24 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Exception; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Prompt\PromptGet; +namespace Symfony\AI\McpSdk\Exception; + +use Symfony\AI\McpSdk\Capability\Prompt\PromptGet; final class PromptNotFoundException extends \RuntimeException implements NotFoundExceptionInterface { public function __construct( public readonly PromptGet $promptGet, ) { - parent::__construct(sprintf('Resource not found for uri: "%s"', $promptGet->name)); + parent::__construct(\sprintf('Resource not found for uri: "%s"', $promptGet->name)); } } diff --git a/src/mcp-sdk/src/Exception/ResourceNotFoundException.php b/src/mcp-sdk/src/Exception/ResourceNotFoundException.php index 6cc1cd7b1..2a1a4f3a4 100644 --- a/src/mcp-sdk/src/Exception/ResourceNotFoundException.php +++ b/src/mcp-sdk/src/Exception/ResourceNotFoundException.php @@ -2,15 +2,24 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Exception; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Resource\ResourceRead; +namespace Symfony\AI\McpSdk\Exception; + +use Symfony\AI\McpSdk\Capability\Resource\ResourceRead; final class ResourceNotFoundException extends \RuntimeException implements NotFoundExceptionInterface { public function __construct( public readonly ResourceRead $readRequest, ) { - parent::__construct(sprintf('Resource not found for uri: "%s"', $readRequest->uri)); + parent::__construct(\sprintf('Resource not found for uri: "%s"', $readRequest->uri)); } } diff --git a/src/mcp-sdk/src/Exception/ResourceReadException.php b/src/mcp-sdk/src/Exception/ResourceReadException.php index 669d60a80..0fbe457ff 100644 --- a/src/mcp-sdk/src/Exception/ResourceReadException.php +++ b/src/mcp-sdk/src/Exception/ResourceReadException.php @@ -2,9 +2,18 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Exception; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Resource\ResourceRead; +namespace Symfony\AI\McpSdk\Exception; + +use Symfony\AI\McpSdk\Capability\Resource\ResourceRead; final class ResourceReadException extends \RuntimeException implements ExceptionInterface { @@ -12,6 +21,6 @@ public function __construct( public readonly ResourceRead $readRequest, ?\Throwable $previous = null, ) { - parent::__construct(sprintf('Reading resource "%s" failed with error: %s', $readRequest->uri, $previous?->getMessage() ?? ''), previous: $previous); + parent::__construct(\sprintf('Reading resource "%s" failed with error: %s', $readRequest->uri, $previous?->getMessage() ?? ''), previous: $previous); } } diff --git a/src/mcp-sdk/src/Exception/ToolExecutionException.php b/src/mcp-sdk/src/Exception/ToolExecutionException.php index 04c7efac1..ff9e1d4ed 100644 --- a/src/mcp-sdk/src/Exception/ToolExecutionException.php +++ b/src/mcp-sdk/src/Exception/ToolExecutionException.php @@ -2,9 +2,18 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Exception; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Tool\ToolCall; +namespace Symfony\AI\McpSdk\Exception; + +use Symfony\AI\McpSdk\Capability\Tool\ToolCall; final class ToolExecutionException extends \RuntimeException implements ExceptionInterface { @@ -12,6 +21,6 @@ public function __construct( public readonly ToolCall $toolCall, ?\Throwable $previous = null, ) { - parent::__construct(sprintf('Execution of tool "%s" failed with error: %s', $toolCall->name, $previous?->getMessage() ?? ''), previous: $previous); + parent::__construct(\sprintf('Execution of tool "%s" failed with error: %s', $toolCall->name, $previous?->getMessage() ?? ''), previous: $previous); } } diff --git a/src/mcp-sdk/src/Exception/ToolNotFoundException.php b/src/mcp-sdk/src/Exception/ToolNotFoundException.php index e8118cf51..7aa2a541b 100644 --- a/src/mcp-sdk/src/Exception/ToolNotFoundException.php +++ b/src/mcp-sdk/src/Exception/ToolNotFoundException.php @@ -2,15 +2,24 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Exception; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Tool\ToolCall; +namespace Symfony\AI\McpSdk\Exception; + +use Symfony\AI\McpSdk\Capability\Tool\ToolCall; final class ToolNotFoundException extends \RuntimeException implements NotFoundExceptionInterface { public function __construct( public readonly ToolCall $toolCall, ) { - parent::__construct(sprintf('Tool not found for call: "%s"', $toolCall->name)); + parent::__construct(\sprintf('Tool not found for call: "%s"', $toolCall->name)); } } diff --git a/src/mcp-sdk/src/Message/Error.php b/src/mcp-sdk/src/Message/Error.php index 294ecd5c6..61f9327ad 100644 --- a/src/mcp-sdk/src/Message/Error.php +++ b/src/mcp-sdk/src/Message/Error.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Message; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Message; final readonly class Error implements \JsonSerializable { diff --git a/src/mcp-sdk/src/Message/Factory.php b/src/mcp-sdk/src/Message/Factory.php index baf683e45..1dc9e5297 100644 --- a/src/mcp-sdk/src/Message/Factory.php +++ b/src/mcp-sdk/src/Message/Factory.php @@ -2,13 +2,22 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Message; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Message; final class Factory { public function create(string $json): Request|Notification { - $data = json_decode($json, true, flags: JSON_THROW_ON_ERROR); + $data = json_decode($json, true, flags: \JSON_THROW_ON_ERROR); if (!isset($data['method'])) { throw new \InvalidArgumentException('Invalid JSON-RPC request, missing method'); diff --git a/src/mcp-sdk/src/Message/Notification.php b/src/mcp-sdk/src/Message/Notification.php index 74f9c3d5d..05d60ca82 100644 --- a/src/mcp-sdk/src/Message/Notification.php +++ b/src/mcp-sdk/src/Message/Notification.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Message; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Message; final readonly class Notification implements \JsonSerializable, \Stringable { @@ -40,6 +49,6 @@ public function jsonSerialize(): array public function __toString(): string { - return sprintf('%s', $this->method); + return \sprintf('%s', $this->method); } } diff --git a/src/mcp-sdk/src/Message/Request.php b/src/mcp-sdk/src/Message/Request.php index 97bd1399d..2a64f8be3 100644 --- a/src/mcp-sdk/src/Message/Request.php +++ b/src/mcp-sdk/src/Message/Request.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Message; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Message; final class Request implements \JsonSerializable, \Stringable { @@ -43,6 +52,6 @@ public function jsonSerialize(): array public function __toString(): string { - return sprintf('%s: %s', $this->id, $this->method); + return \sprintf('%s: %s', $this->id, $this->method); } } diff --git a/src/mcp-sdk/src/Message/Response.php b/src/mcp-sdk/src/Message/Response.php index caccb4873..85cbd002c 100644 --- a/src/mcp-sdk/src/Message/Response.php +++ b/src/mcp-sdk/src/Message/Response.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Message; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Message; final readonly class Response implements \JsonSerializable { diff --git a/src/mcp-sdk/src/Server.php b/src/mcp-sdk/src/Server.php index d6eb39f2c..2fbcaa740 100644 --- a/src/mcp-sdk/src/Server.php +++ b/src/mcp-sdk/src/Server.php @@ -2,12 +2,21 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk; -use PhpLlm\McpSdk\Server\JsonRpcHandler; -use PhpLlm\McpSdk\Server\TransportInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; +use Symfony\AI\McpSdk\Server\JsonRpcHandler; +use Symfony\AI\McpSdk\Server\TransportInterface; final readonly class Server { diff --git a/src/mcp-sdk/src/Server/JsonRpcHandler.php b/src/mcp-sdk/src/Server/JsonRpcHandler.php index 825688768..3d453161a 100644 --- a/src/mcp-sdk/src/Server/JsonRpcHandler.php +++ b/src/mcp-sdk/src/Server/JsonRpcHandler.php @@ -2,14 +2,23 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Server; -use PhpLlm\McpSdk\Message\Error; -use PhpLlm\McpSdk\Message\Factory; -use PhpLlm\McpSdk\Message\Notification; -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; use Psr\Log\LoggerInterface; +use Symfony\AI\McpSdk\Message\Error; +use Symfony\AI\McpSdk\Message\Factory; +use Symfony\AI\McpSdk\Message\Notification; +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; /** * @final @@ -68,7 +77,7 @@ public function process(string $message): ?string } catch (\DomainException) { return null; } catch (\InvalidArgumentException $e) { - $this->logger->warning(sprintf('Failed to create response: %s', $e->getMessage()), ['exception' => $e]); + $this->logger->warning(\sprintf('Failed to create response: %s', $e->getMessage()), ['exception' => $e]); return $this->encodeResponse(Error::methodNotFound($message->id ?? 0, $e->getMessage())); } @@ -85,10 +94,10 @@ private function encodeResponse(Response|Error|null $response): ?string $this->logger->info('Encoding response', ['response' => $response]); if ($response instanceof Response && [] === $response->result) { - return json_encode($response, JSON_THROW_ON_ERROR | JSON_FORCE_OBJECT); + return json_encode($response, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT); } - return json_encode($response, JSON_THROW_ON_ERROR); + return json_encode($response, \JSON_THROW_ON_ERROR); } private function handleNotification(Notification $notification): null @@ -99,7 +108,7 @@ private function handleNotification(Notification $notification): null } } - $this->logger->warning(sprintf('No handler found for "%s".', $notification->method), ['notification' => $notification]); + $this->logger->warning(\sprintf('No handler found for "%s".', $notification->method), ['notification' => $notification]); return null; } @@ -112,6 +121,6 @@ private function handleRequest(Request $request): Response|Error } } - throw new \InvalidArgumentException(sprintf('No handler found for method "%s".', $request->method)); + throw new \InvalidArgumentException(\sprintf('No handler found for method "%s".', $request->method)); } } diff --git a/src/mcp-sdk/src/Server/NotificationHandler/BaseNotificationHandler.php b/src/mcp-sdk/src/Server/NotificationHandler/BaseNotificationHandler.php index 96d09cc04..9af39cedd 100644 --- a/src/mcp-sdk/src/Server/NotificationHandler/BaseNotificationHandler.php +++ b/src/mcp-sdk/src/Server/NotificationHandler/BaseNotificationHandler.php @@ -2,16 +2,25 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\NotificationHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Message\Notification; -use PhpLlm\McpSdk\Server\NotificationHandlerInterface; +namespace Symfony\AI\McpSdk\Server\NotificationHandler; + +use Symfony\AI\McpSdk\Message\Notification; +use Symfony\AI\McpSdk\Server\NotificationHandlerInterface; abstract class BaseNotificationHandler implements NotificationHandlerInterface { public function supports(Notification $message): bool { - return $message->method === sprintf('notifications/%s', $this->supportedNotification()); + return $message->method === \sprintf('notifications/%s', $this->supportedNotification()); } abstract protected function supportedNotification(): string; diff --git a/src/mcp-sdk/src/Server/NotificationHandler/InitializedHandler.php b/src/mcp-sdk/src/Server/NotificationHandler/InitializedHandler.php index afa5da189..036439034 100644 --- a/src/mcp-sdk/src/Server/NotificationHandler/InitializedHandler.php +++ b/src/mcp-sdk/src/Server/NotificationHandler/InitializedHandler.php @@ -2,9 +2,18 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\NotificationHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Message\Notification; +namespace Symfony\AI\McpSdk\Server\NotificationHandler; + +use Symfony\AI\McpSdk\Message\Notification; final class InitializedHandler extends BaseNotificationHandler { diff --git a/src/mcp-sdk/src/Server/NotificationHandlerInterface.php b/src/mcp-sdk/src/Server/NotificationHandlerInterface.php index d2d71d3e8..d5bd9bb0a 100644 --- a/src/mcp-sdk/src/Server/NotificationHandlerInterface.php +++ b/src/mcp-sdk/src/Server/NotificationHandlerInterface.php @@ -2,9 +2,18 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Message\Notification; +namespace Symfony\AI\McpSdk\Server; + +use Symfony\AI\McpSdk\Message\Notification; interface NotificationHandlerInterface { diff --git a/src/mcp-sdk/src/Server/RequestHandler/BaseRequestHandler.php b/src/mcp-sdk/src/Server/RequestHandler/BaseRequestHandler.php index d7aad40f6..dee6dd6d1 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/BaseRequestHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/BaseRequestHandler.php @@ -2,10 +2,19 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Server\RequestHandlerInterface; +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Server\RequestHandlerInterface; abstract class BaseRequestHandler implements RequestHandlerInterface { diff --git a/src/mcp-sdk/src/Server/RequestHandler/InitializeHandler.php b/src/mcp-sdk/src/Server/RequestHandler/InitializeHandler.php index 4740d6dc8..68e2f66b3 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/InitializeHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/InitializeHandler.php @@ -2,10 +2,19 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; final class InitializeHandler extends BaseRequestHandler { diff --git a/src/mcp-sdk/src/Server/RequestHandler/PingHandler.php b/src/mcp-sdk/src/Server/RequestHandler/PingHandler.php index e29874031..afb9cdb9d 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/PingHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/PingHandler.php @@ -2,10 +2,19 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; final class PingHandler extends BaseRequestHandler { diff --git a/src/mcp-sdk/src/Server/RequestHandler/PromptGetHandler.php b/src/mcp-sdk/src/Server/RequestHandler/PromptGetHandler.php index a956e25b9..c138c25f4 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/PromptGetHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/PromptGetHandler.php @@ -2,14 +2,23 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Prompt\PromptGet; -use PhpLlm\McpSdk\Capability\Prompt\PromptGetterInterface; -use PhpLlm\McpSdk\Exception\ExceptionInterface; -use PhpLlm\McpSdk\Message\Error; -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Capability\Prompt\PromptGet; +use Symfony\AI\McpSdk\Capability\Prompt\PromptGetterInterface; +use Symfony\AI\McpSdk\Exception\ExceptionInterface; +use Symfony\AI\McpSdk\Message\Error; +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; final class PromptGetHandler extends BaseRequestHandler { diff --git a/src/mcp-sdk/src/Server/RequestHandler/PromptListHandler.php b/src/mcp-sdk/src/Server/RequestHandler/PromptListHandler.php index 86799a53c..3c7bd41ef 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/PromptListHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/PromptListHandler.php @@ -2,13 +2,22 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Prompt\CollectionInterface; -use PhpLlm\McpSdk\Capability\Prompt\MetadataInterface; -use PhpLlm\McpSdk\Message\Notification; -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Capability\Prompt\CollectionInterface; +use Symfony\AI\McpSdk\Capability\Prompt\MetadataInterface; +use Symfony\AI\McpSdk\Message\Notification; +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; final class PromptListHandler extends BaseRequestHandler { diff --git a/src/mcp-sdk/src/Server/RequestHandler/ResourceListHandler.php b/src/mcp-sdk/src/Server/RequestHandler/ResourceListHandler.php index dd8aed06f..3317d7134 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/ResourceListHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/ResourceListHandler.php @@ -2,13 +2,22 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; - -use PhpLlm\McpSdk\Capability\Resource\CollectionInterface; -use PhpLlm\McpSdk\Capability\Resource\MetadataInterface; -use PhpLlm\McpSdk\Message\Notification; -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Capability\Resource\CollectionInterface; +use Symfony\AI\McpSdk\Capability\Resource\MetadataInterface; +use Symfony\AI\McpSdk\Message\Notification; +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; final class ResourceListHandler extends BaseRequestHandler { diff --git a/src/mcp-sdk/src/Server/RequestHandler/ResourceReadHandler.php b/src/mcp-sdk/src/Server/RequestHandler/ResourceReadHandler.php index b02740ddd..38dea7248 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/ResourceReadHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/ResourceReadHandler.php @@ -2,14 +2,23 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; - -use PhpLlm\McpSdk\Capability\Resource\ResourceRead; -use PhpLlm\McpSdk\Capability\Resource\ResourceReaderInterface; -use PhpLlm\McpSdk\Exception\ExceptionInterface; -use PhpLlm\McpSdk\Message\Error; -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Capability\Resource\ResourceRead; +use Symfony\AI\McpSdk\Capability\Resource\ResourceReaderInterface; +use Symfony\AI\McpSdk\Exception\ExceptionInterface; +use Symfony\AI\McpSdk\Message\Error; +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; final class ResourceReadHandler extends BaseRequestHandler { diff --git a/src/mcp-sdk/src/Server/RequestHandler/ToolCallHandler.php b/src/mcp-sdk/src/Server/RequestHandler/ToolCallHandler.php index 4cab6e104..3590a555f 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/ToolCallHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/ToolCallHandler.php @@ -2,14 +2,23 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Tool\ToolCall; -use PhpLlm\McpSdk\Capability\Tool\ToolExecutorInterface; -use PhpLlm\McpSdk\Exception\ExceptionInterface; -use PhpLlm\McpSdk\Message\Error; -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Capability\Tool\ToolCall; +use Symfony\AI\McpSdk\Capability\Tool\ToolExecutorInterface; +use Symfony\AI\McpSdk\Exception\ExceptionInterface; +use Symfony\AI\McpSdk\Message\Error; +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; final class ToolCallHandler extends BaseRequestHandler { diff --git a/src/mcp-sdk/src/Server/RequestHandler/ToolListHandler.php b/src/mcp-sdk/src/Server/RequestHandler/ToolListHandler.php index fd4f717ef..8432cd4b5 100644 --- a/src/mcp-sdk/src/Server/RequestHandler/ToolListHandler.php +++ b/src/mcp-sdk/src/Server/RequestHandler/ToolListHandler.php @@ -2,12 +2,21 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\RequestHandler; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Capability\Tool\CollectionInterface; -use PhpLlm\McpSdk\Capability\Tool\MetadataInterface; -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +namespace Symfony\AI\McpSdk\Server\RequestHandler; + +use Symfony\AI\McpSdk\Capability\Tool\CollectionInterface; +use Symfony\AI\McpSdk\Capability\Tool\MetadataInterface; +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; final class ToolListHandler extends BaseRequestHandler { diff --git a/src/mcp-sdk/src/Server/RequestHandlerInterface.php b/src/mcp-sdk/src/Server/RequestHandlerInterface.php index 80fe78335..ca37dd63f 100644 --- a/src/mcp-sdk/src/Server/RequestHandlerInterface.php +++ b/src/mcp-sdk/src/Server/RequestHandlerInterface.php @@ -2,11 +2,20 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Message\Error; -use PhpLlm\McpSdk\Message\Request; -use PhpLlm\McpSdk\Message\Response; +namespace Symfony\AI\McpSdk\Server; + +use Symfony\AI\McpSdk\Message\Error; +use Symfony\AI\McpSdk\Message\Request; +use Symfony\AI\McpSdk\Message\Response; interface RequestHandlerInterface { diff --git a/src/mcp-sdk/src/Server/Transport/Sse/Store/CachePoolStore.php b/src/mcp-sdk/src/Server/Transport/Sse/Store/CachePoolStore.php index d7683050c..9ce41d718 100644 --- a/src/mcp-sdk/src/Server/Transport/Sse/Store/CachePoolStore.php +++ b/src/mcp-sdk/src/Server/Transport/Sse/Store/CachePoolStore.php @@ -2,10 +2,19 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\Transport\Sse\Store; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Server\Transport\Sse\Store; -use PhpLlm\McpSdk\Server\Transport\Sse\StoreInterface; use Psr\Cache\CacheItemPoolInterface; +use Symfony\AI\McpSdk\Server\Transport\Sse\StoreInterface; use Symfony\Component\Uid\Uuid; final readonly class CachePoolStore implements StoreInterface diff --git a/src/mcp-sdk/src/Server/Transport/Sse/StoreInterface.php b/src/mcp-sdk/src/Server/Transport/Sse/StoreInterface.php index f6517e06b..b1d0cc977 100644 --- a/src/mcp-sdk/src/Server/Transport/Sse/StoreInterface.php +++ b/src/mcp-sdk/src/Server/Transport/Sse/StoreInterface.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\Transport\Sse; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Server\Transport\Sse; use Symfony\Component\Uid\Uuid; diff --git a/src/mcp-sdk/src/Server/Transport/Sse/StreamTransport.php b/src/mcp-sdk/src/Server/Transport/Sse/StreamTransport.php index 7b6d7999c..2c30d1e0a 100644 --- a/src/mcp-sdk/src/Server/Transport/Sse/StreamTransport.php +++ b/src/mcp-sdk/src/Server/Transport/Sse/StreamTransport.php @@ -2,9 +2,18 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\Transport\Sse; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -use PhpLlm\McpSdk\Server\TransportInterface; +namespace Symfony\AI\McpSdk\Server\Transport\Sse; + +use Symfony\AI\McpSdk\Server\TransportInterface; use Symfony\Component\Uid\Uuid; final readonly class StreamTransport implements TransportInterface @@ -44,9 +53,9 @@ public function close(): void private function flushEvent(string $event, string $data): void { - echo sprintf('event: %s', $event).PHP_EOL; - echo sprintf('data: %s', $data).PHP_EOL; - echo PHP_EOL; + echo \sprintf('event: %s', $event).\PHP_EOL; + echo \sprintf('data: %s', $data).\PHP_EOL; + echo \PHP_EOL; if (false !== ob_get_length()) { ob_flush(); } diff --git a/src/mcp-sdk/src/Server/Transport/Stdio/SymfonyConsoleTransport.php b/src/mcp-sdk/src/Server/Transport/Stdio/SymfonyConsoleTransport.php index 778b2a840..281737d2b 100644 --- a/src/mcp-sdk/src/Server/Transport/Stdio/SymfonyConsoleTransport.php +++ b/src/mcp-sdk/src/Server/Transport/Stdio/SymfonyConsoleTransport.php @@ -2,9 +2,18 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server\Transport\Stdio; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Server\Transport\Stdio; -use PhpLlm\McpSdk\Server\TransportInterface; +use Symfony\AI\McpSdk\Server\TransportInterface; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\StreamableInputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -33,14 +42,14 @@ public function isConnected(): bool public function receive(): \Generator { - $stream = $this->input instanceof StreamableInputInterface ? $this->input->getStream() ?? STDIN : STDIN; + $stream = $this->input instanceof StreamableInputInterface ? $this->input->getStream() ?? \STDIN : \STDIN; $line = fgets($stream); if (false === $line) { return; } - $this->buffer .= STDIN === $stream ? rtrim($line).PHP_EOL : $line; - if (str_contains($this->buffer, PHP_EOL)) { - $lines = explode(PHP_EOL, $this->buffer); + $this->buffer .= \STDIN === $stream ? rtrim($line).\PHP_EOL : $line; + if (str_contains($this->buffer, \PHP_EOL)) { + $lines = explode(\PHP_EOL, $this->buffer); $this->buffer = array_pop($lines); yield from $lines; diff --git a/src/mcp-sdk/src/Server/TransportInterface.php b/src/mcp-sdk/src/Server/TransportInterface.php index 6dd8b867c..0ce64ceaf 100644 --- a/src/mcp-sdk/src/Server/TransportInterface.php +++ b/src/mcp-sdk/src/Server/TransportInterface.php @@ -2,7 +2,16 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Server; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Server; interface TransportInterface { diff --git a/src/mcp-sdk/tests/Fixtures/InMemoryTransport.php b/src/mcp-sdk/tests/Fixtures/InMemoryTransport.php index 82fbb5326..eda931df9 100644 --- a/src/mcp-sdk/tests/Fixtures/InMemoryTransport.php +++ b/src/mcp-sdk/tests/Fixtures/InMemoryTransport.php @@ -1,8 +1,19 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Tests\Fixtures; + +use Symfony\AI\McpSdk\Server\TransportInterface; class InMemoryTransport implements TransportInterface { diff --git a/src/mcp-sdk/tests/Message/ErrorTest.php b/src/mcp-sdk/tests/Message/ErrorTest.php index 23745b533..7ccfed6f0 100644 --- a/src/mcp-sdk/tests/Message/ErrorTest.php +++ b/src/mcp-sdk/tests/Message/ErrorTest.php @@ -2,10 +2,19 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Tests\Message; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Tests\Message; -use PhpLlm\McpSdk\Message\Error; use PHPUnit\Framework\TestCase; +use Symfony\AI\McpSdk\Message\Error; final class ErrorTest extends TestCase { diff --git a/src/mcp-sdk/tests/Message/FactoryTest.php b/src/mcp-sdk/tests/Message/FactoryTest.php index 8a7c632e7..752114031 100644 --- a/src/mcp-sdk/tests/Message/FactoryTest.php +++ b/src/mcp-sdk/tests/Message/FactoryTest.php @@ -2,12 +2,21 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Tests\Message; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Tests\Message; -use PhpLlm\McpSdk\Message\Factory; -use PhpLlm\McpSdk\Message\Notification; -use PhpLlm\McpSdk\Message\Request; use PHPUnit\Framework\TestCase; +use Symfony\AI\McpSdk\Message\Factory; +use Symfony\AI\McpSdk\Message\Notification; +use Symfony\AI\McpSdk\Message\Request; final class FactoryTest extends TestCase { diff --git a/src/mcp-sdk/tests/Message/ResponseTest.php b/src/mcp-sdk/tests/Message/ResponseTest.php index b35e2b172..85fac0607 100644 --- a/src/mcp-sdk/tests/Message/ResponseTest.php +++ b/src/mcp-sdk/tests/Message/ResponseTest.php @@ -2,10 +2,19 @@ declare(strict_types=1); -namespace PhpLlm\McpSdk\Tests\Message; +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Tests\Message; -use PhpLlm\McpSdk\Message\Response; use PHPUnit\Framework\TestCase; +use Symfony\AI\McpSdk\Message\Response; final class ResponseTest extends TestCase { diff --git a/src/mcp-sdk/tests/ServerTest.php b/src/mcp-sdk/tests/ServerTest.php index d211410ec..9ff63e4cf 100644 --- a/src/mcp-sdk/tests/ServerTest.php +++ b/src/mcp-sdk/tests/ServerTest.php @@ -1,13 +1,24 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\AI\McpSdk\Tests; -use PhpLlm\McpSdk\Server; -use PhpLlm\McpSdk\Server\JsonRpcHandler; -use PhpLlm\McpSdk\Tests\Fixtures\InMemoryTransport; use PHPUnit\Framework\MockObject\Stub\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; +use Symfony\AI\McpSdk\Server; +use Symfony\AI\McpSdk\Server\JsonRpcHandler; +use Symfony\AI\McpSdk\Tests\Fixtures\InMemoryTransport; class ServerTest extends TestCase {