McpProtocol class

MCP protocol versions and constants

Constructors

McpProtocol()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isVersionSupported(String version) bool
Check if a version is supported
negotiateVersion(List<String> clientVersions, List<String> serverVersions) String?
Get the best common version from client and server versions
requiresProtocolHeader(String version) bool
Whether the negotiated version requires the MCP-Protocol-Version HTTP header on every post-handshake request (mandatory from 2025-06-18).
supportsBatching(String version) bool
Whether the negotiated version supports JSON-RPC batching. Removed in 2025-06-18.
supportsElicitation(String version) bool
Whether the negotiated version understands elicitation/create (introduced 2025-06-18).

Constants

defaultVersion → const String
Default protocol version (latest supported).
errorInternal → const int
errorInvalidParams → const int
errorInvalidRequest → const int
errorMethodNotFound → const int
errorParse → const int
Standard error codes
errorPromptNotFound → const int
errorProtocolError → const int
errorResourceAccessDenied → const int
errorResourceNotFound → const int
MCP-specific error codes
errorToolExecutionFailed → const int
errorToolNotFound → const int
jsonRpcVersion → const String
JSON-RPC version
methodAuthorize → const String
Authorization methods (2025-03-26)
methodCallTool → const String
methodCancelled → const String
methodCancelTool → const String
methodCapabilitiesUpdate → const String
2025-03-26 New methods
methodComplete → const String
methodGetPrompt → const String
methodInitialize → const String
Standard MCP methods
methodInitialized → const String
methodListPrompts → const String
methodListResources → const String
methodListResourceTemplates → const String
methodListRoots → const String
methodListTools → const String
methodLog → const String
methodProgress → const String
Notifications
methodPromptListChanged → const String
methodReadResource → const String
methodRefresh → const String
methodResourceListChanged → const String
methodResourceUpdated → const String
methodRevoke → const String
methodRootListChanged → const String
methodSetLevel → const String
methodShutdown → const String
methodSubscribeResource → const String
methodToken → const String
methodToolListChanged → const String
methodUnsubscribeResource → const String
progressTokenNumber → const String
progressTokenString → const String
Progress token types
supportedVersions → const List<String>
Supported protocol versions in order of preference (newest first).
v2024_11_05 → const String
Protocol version 2024-11-05
v2025_03_26 → const String
Protocol version 2025-03-26
v2025_06_18 → const String
Protocol version 2025-06-18 — adds elicitation, structured tool output, resource_link, OAuth Resource Server, MCP-Protocol-Version header. Removes JSON-RPC batching.
v2025_11_25 → const String
Protocol version 2025-11-25 — adds icons, sampling tool calling (tools / toolChoice), URL-mode elicitation, OIDC Discovery, Client ID Metadata Documents, default values in elicitation primitives.