MCP PHP SDK

ExtensionIdentifier implements Stringable

FinalYes

An extension identifier (SEP-2133): a `_meta` key with a mandatory vendor prefix, since an extension is something a vendor owns and an unprefixed name has no owner. Naming rules are enforced at construction, so any `ExtensionIdentifier` in hand is guaranteed well-formed.

The modelcontextprotocol/mcp second label is reserved for official extensions, so a third party naming itself io.modelcontextprotocol/tasks would be claiming to be one — see self::isReserved().

Tags
see
https://modelcontextprotocol.io/specification/2026-07-28/basic/index#meta
author

Christopher Hertel mail@christopher-hertel.de

Table of Contents

Interfaces

Stringable

Constants

OFFICIAL_PREFIX  : mixed = 'io.modelcontextprotocol/'
Prefixes the specification itself allocates.
RESERVED_LABELS  : mixed = ['modelcontextprotocol', 'mcp']
Second labels only the specification may use.
LABEL  : mixed = '[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?'
A label: starts with a letter, ends alphanumeric, hyphens inside.
NAME  : mixed = '[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?'
A name: alphanumeric at both ends, `-`, `_` and `.` inside.

Properties

$identifier  : string

Methods

__construct()  : mixed
__toString()  : string
isReserved()  : bool
Whether this identifier claims a prefix the specification reserves.
check()  : string|null

Constants

OFFICIAL_PREFIX

Prefixes the specification itself allocates.

public mixed OFFICIAL_PREFIX = 'io.modelcontextprotocol/'

RESERVED_LABELS

Second labels only the specification may use.

public mixed RESERVED_LABELS = ['modelcontextprotocol', 'mcp']

LABEL

A label: starts with a letter, ends alphanumeric, hyphens inside.

private mixed LABEL = '[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?'

NAME

A name: alphanumeric at both ends, `-`, `_` and `.` inside.

private mixed NAME = '[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?'

Properties

Methods

isReserved()

Whether this identifier claims a prefix the specification reserves.

public isReserved() : bool

Not an error on its own — the official extensions legitimately use it — but a third party doing so is misrepresenting itself, so callers that are not the SDK should refuse.

Return values
bool

check()

private static check(string $identifier) : string|null
Parameters
$identifier : string
Return values
string|null

the reason $identifier is invalid, or null when it is well-formed

On this page

Search results