Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions docs/spec/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ This sequence ensures that both parties are aware of each other's capabilities a
## Initialization
The initialization process **MUST** begin with the client sending an `initialize` request to the server. This request **MUST** include:

- The *protocol version* supported by the client as a numeric integer
- The *protocol version* supported by the client, as a string
- The client's capabilities
- Information about the client implementation

Protocol versions are represented as strings in the format `YYYY-MM-DD` (year–month–day, all zero-padded), and can be lexicographically compared—for example, `2024-10-07` is greater than `2024-10-06`.

{{<tabs items="Spec (TS),Example">}}
{{<tab>}}
```typescript
export interface InitializeRequest extends Request {
method: "initialize";
params: {
protocolVersion: number;
protocolVersion: string;
capabilities: ClientCapabilities;
clientInfo: Implementation;
};
Expand All @@ -72,7 +74,7 @@ export interface InitializeRequest extends Request {
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": 1,
"protocolVersion": "2024-10-07",
"capabilities": {
"experimental": {},
"sampling": {}
Expand All @@ -98,7 +100,7 @@ The server **MUST** respond to the initialize request with an `InitializeResult`
{{<tab>}}
```typescript
export interface InitializeResult extends Result {
protocolVersion: number;
protocolVersion: string;
capabilities: ServerCapabilities;
serverInfo: Implementation;
}
Expand All @@ -110,7 +112,7 @@ The server **MUST** respond to the initialize request with an `InitializeResult`
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": 1,
"protocolVersion": "2024-10-07",
"capabilities": {
"experimental": {},
"logging": {},
Expand All @@ -130,7 +132,7 @@ The server **MUST** respond to the initialize request with an `InitializeResult`
{{</tab>}}
{{</tabs>}}

If the server cannot support the protocol version requested by the client, it **SHOULD** respond with an error.
The server may choose a different protocol version than the client has requested. In such cases, it is up to the client whether to proceed with the connection or abort.

## Capability Exchange

Expand Down
6 changes: 2 additions & 4 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,8 @@
"$ref": "#/definitions/Implementation"
},
"protocolVersion": {
"const": 1,
"description": "The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.",
"type": "integer"
"type": "string"
}
},
"required": [
Expand Down Expand Up @@ -492,9 +491,8 @@
"$ref": "#/definitions/ServerCapabilities"
},
"protocolVersion": {
"const": 1,
"description": "The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.",
"type": "integer"
"type": "string"
},
"serverInfo": {
"$ref": "#/definitions/Implementation"
Expand Down
6 changes: 3 additions & 3 deletions schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export interface JSONRPCError {
export type EmptyResult = Result;

/* Initialization */
export const PROTOCOL_VERSION = 1;
export const LATEST_PROTOCOL_VERSION = "2024-10-07";
/**
* This request is sent from the client to the server when it first connects, asking it to begin initialization.
*/
Expand All @@ -119,7 +119,7 @@ export interface InitializeRequest extends Request {
/**
* The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
*/
protocolVersion: typeof PROTOCOL_VERSION;
protocolVersion: string;
capabilities: ClientCapabilities;
clientInfo: Implementation;
};
Expand All @@ -132,7 +132,7 @@ export interface InitializeResult extends Result {
/**
* The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
*/
protocolVersion: typeof PROTOCOL_VERSION;
protocolVersion: string;
capabilities: ServerCapabilities;
serverInfo: Implementation;
}
Expand Down