Skip to content

Extract protocol versions to shared enum for client reuse#215

Merged
pushpak1300 merged 1 commit into
mainfrom
extract-protocol-version-enum
May 15, 2026
Merged

Extract protocol versions to shared enum for client reuse#215
pushpak1300 merged 1 commit into
mainfrom
extract-protocol-version-enum

Conversation

@pushpak1300
Copy link
Copy Markdown
Member

@pushpak1300 pushpak1300 commented May 14, 2026

Currently the list of MCP protocol versions the package speaks is hardcoded inside Server.php:

protected array $supportedProtocolVersion = [
    '2025-11-25',
    '2025-06-18',
    '2025-03-26',
    '2024-11-05',
];

The upcoming MCP client (per the shipping plan) needs the same information — both sides need to agree on what versions exist, and the client needs to know which one is "latest" to send during the initialize handshake. Duplicating the list in two places will inevitably drift.

This PR moves the list into a shared enum, so server and client read from one place:

use Laravel\Mcp\Enums\ProtocolVersion;

ProtocolVersion::LATEST;        // V2025_11_25 (for the future client)
ProtocolVersion::supported();   // ['2025-11-25', '2025-06-18', '2025-03-26', '2024-11-05']

Servers that don't override the property continue to advertise the full supported list — no behavior change. If you want to pin a server to a single version, the override path stays the same as today:

class MyServer extends Server
{
    protected array $supportedProtocolVersion = [
        ProtocolVersion::V2025_11_25->value,
    ];
}

@pushpak1300 pushpak1300 marked this pull request as ready for review May 14, 2026 12:40
@pushpak1300 pushpak1300 requested review from joetannenbaum and nunomaduro and removed request for nunomaduro May 15, 2026 15:10
@pushpak1300 pushpak1300 merged commit 99fa8e4 into main May 15, 2026
24 checks passed
@pushpak1300 pushpak1300 deleted the extract-protocol-version-enum branch May 15, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants