Skip to content

[MCP SDK] Add server capabilities toSymfony\AI\McpSdk\Server\RequestHandler\InitializeHandler #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ineersa
Copy link

@ineersa ineersa commented Aug 12, 2025

Q A
Bug fix? no
New feature? yes
Docs? yes
Issues Resolves #298
License MIT

Added Server capabilities classes, Enum for protocol version, updated InitializeHandler.
Added skip null values at JSON serialization.
Added InitializeHandlerTest.
Updated docs and example.

@ineersa ineersa marked this pull request as ready for review August 12, 2025 01:19
@carsonbot carsonbot added Feature New feature MCP SDK Issues & PRs about the MCP SDK Status: Needs Review labels Aug 12, 2025
*/
public function jsonSerialize(): array
{
return array_filter((array) $this, fn ($value) => null !== $value);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look nice, ideally it would be better to use centralized solution in \Symfony\AI\McpSdk\Message\Response::jsonSerialize.

Serializer with AbstractObjectNormalizer::SKIP_NULL_VALUES would fit perfectly, but it's not in dependencies list.

@OskarStark OskarStark changed the title [MCP SDK] Add server capabilities to \Symfony\AI\McpSdk\Server\RequestHandler\InitializeHandler [MCP SDK] Add server capabilities toSymfony\AI\McpSdk\Server\RequestHandler\InitializeHandler Aug 13, 2025
Comment on lines 14 to 19
enum ProtocolVersionEnum: string
{
case V2024_11_05 = '2024-11-05';
case V2025_03_26 = '2025-03-26';
case V2025_06_18 = '2025-06-18';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enum ProtocolVersionEnum: string
{
case V2024_11_05 = '2024-11-05';
case V2025_03_26 = '2025-03-26';
case V2025_06_18 = '2025-06-18';
}
enum ProtocolVersion: string
{
case VERSION_2024_11_05 = '2024-11-05';
case VERSION_2025_03_26 = '2025-03-26';
case VERSION_2025_06_18 = '2025-06-18';
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed suffix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature MCP SDK Issues & PRs about the MCP SDK Status: Needs Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MCP SDK] Add server capabilities to \Symfony\AI\McpSdk\Server\RequestHandler\InitializeHandler
3 participants