Skip to content

Commit 2fa7051

Browse files
authored
Merge branch 'main' into main
2 parents b4cc3d7 + 4a2d83a commit 2fa7051

File tree

5 files changed

+59
-41
lines changed

5 files changed

+59
-41
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77

88
jobs:
99
claude-review:
10+
# Fork PRs don't have access to secrets or OIDC tokens, so the action
11+
# cannot authenticate. See https://github.com/anthropics/claude-code-action/issues/339
12+
if: github.event.pull_request.head.repo.fork == false
1013
runs-on: ubuntu-latest
1114
permissions:
1215
contents: read

docs/migration.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,22 @@ The following deprecated type aliases and classes have been removed from `mcp.ty
6060
|---------|-------------|
6161
| `Content` | `ContentBlock` |
6262
| `ResourceReference` | `ResourceTemplateReference` |
63+
| `Cursor` | Use `str` directly |
64+
| `MethodT` | Internal TypeVar, not intended for public use |
65+
| `RequestParamsT` | Internal TypeVar, not intended for public use |
66+
| `NotificationParamsT` | Internal TypeVar, not intended for public use |
6367

6468
**Before (v1):**
6569

6670
```python
67-
from mcp.types import Content, ResourceReference
71+
from mcp.types import Content, ResourceReference, Cursor
6872
```
6973

7074
**After (v2):**
7175

7276
```python
7377
from mcp.types import ContentBlock, ResourceTemplateReference
78+
# Use `str` instead of `Cursor` for pagination cursors
7479
```
7580

7681
### `args` parameter removed from `ClientSessionGroup.call_tool()`

src/mcp/client/session.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,7 @@ async def get_prompt(
365365
) -> types.GetPromptResult:
366366
"""Send a prompts/get request."""
367367
return await self.send_request(
368-
types.GetPromptRequest(
369-
params=types.GetPromptRequestParams(name=name, arguments=arguments, _meta=meta),
370-
),
368+
types.GetPromptRequest(params=types.GetPromptRequestParams(name=name, arguments=arguments, _meta=meta)),
371369
types.GetPromptResult,
372370
)
373371

src/mcp/types/__init__.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
"""MCP types package."""
1+
"""This module defines the types for the MCP protocol.
2+
3+
Check the latest schema at:
4+
https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-11-25/schema.json
5+
"""
26

37
# Re-export everything from _types for backward compatibility
48
from mcp.types._types import (
@@ -43,7 +47,6 @@
4347
CreateMessageResult,
4448
CreateMessageResultWithTools,
4549
CreateTaskResult,
46-
Cursor,
4750
ElicitationCapability,
4851
ElicitationRequiredErrorData,
4952
ElicitCompleteNotification,
@@ -90,12 +93,10 @@
9093
LoggingLevel,
9194
LoggingMessageNotification,
9295
LoggingMessageNotificationParams,
93-
MethodT,
9496
ModelHint,
9597
ModelPreferences,
9698
Notification,
9799
NotificationParams,
98-
NotificationParamsT,
99100
PaginatedRequest,
100101
PaginatedRequestParams,
101102
PaginatedResult,
@@ -116,7 +117,6 @@
116117
Request,
117118
RequestParams,
118119
RequestParamsMeta,
119-
RequestParamsT,
120120
Resource,
121121
ResourceContents,
122122
ResourceLink,
@@ -219,15 +219,11 @@
219219
"TASK_STATUS_WORKING",
220220
# Type aliases and variables
221221
"ContentBlock",
222-
"Cursor",
223222
"ElicitRequestedSchema",
224223
"ElicitRequestParams",
225224
"IncludeContext",
226225
"LoggingLevel",
227-
"MethodT",
228-
"NotificationParamsT",
229226
"ProgressToken",
230-
"RequestParamsT",
231227
"Role",
232228
"SamplingContent",
233229
"SamplingMessageContentBlock",

src/mcp/types/_types.py

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@
1010
from mcp.types.jsonrpc import RequestId
1111

1212
LATEST_PROTOCOL_VERSION = "2025-11-25"
13+
"""The latest version of the Model Context Protocol.
1314
15+
You can find the latest specification at https://modelcontextprotocol.io/specification/latest.
1416
"""
15-
The default negotiated version of the Model Context Protocol when no version is specified.
16-
We need this to satisfy the MCP specification, which requires the server to assume a
17-
specific version if none is provided by the client. See section "Protocol Version Header" at
18-
https://modelcontextprotocol.io/specification
19-
"""
17+
2018
DEFAULT_NEGOTIATED_VERSION = "2025-03-26"
19+
"""The default negotiated version of the Model Context Protocol when no version is specified.
20+
21+
We need this to satisfy the MCP specification, which requires the server to assume a specific version if none is
22+
provided by the client.
23+
24+
See the "Protocol Version Header" at
25+
https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#protocol-version-header).
26+
"""
2127

2228
ProgressToken = str | int
23-
Cursor = str
2429
Role = Literal["user", "assistant"]
2530

2631
TaskExecutionMode = Literal["forbidden", "optional", "required"]
@@ -50,6 +55,7 @@ class RequestParamsMeta(TypedDict, extra_items=Any):
5055

5156
class TaskMetadata(MCPModel):
5257
"""Metadata for augmenting a request with task execution.
58+
5359
Include this in the `task` field of the request parameters.
5460
"""
5561

@@ -72,9 +78,9 @@ class RequestParams(MCPModel):
7278

7379

7480
class PaginatedRequestParams(RequestParams):
75-
cursor: Cursor | None = None
76-
"""
77-
An opaque token representing the current pagination position.
81+
cursor: str | None = None
82+
"""An opaque token representing the current pagination position.
83+
7884
If provided, the server should return results starting after this cursor.
7985
"""
8086

@@ -124,7 +130,7 @@ class Result(MCPModel):
124130

125131

126132
class PaginatedResult(Result):
127-
next_cursor: Cursor | None = None
133+
next_cursor: str | None = None
128134
"""
129135
An opaque token representing the pagination position after the last returned result.
130136
If present, there may be more results available.
@@ -369,16 +375,22 @@ class ServerCapabilities(MCPModel):
369375

370376
experimental: dict[str, dict[str, Any]] | None = None
371377
"""Experimental, non-standard capabilities that the server supports."""
378+
372379
logging: LoggingCapability | None = None
373380
"""Present if the server supports sending log messages to the client."""
381+
374382
prompts: PromptsCapability | None = None
375383
"""Present if the server offers any prompt templates."""
384+
376385
resources: ResourcesCapability | None = None
377386
"""Present if the server offers any resources to read."""
387+
378388
tools: ToolsCapability | None = None
379389
"""Present if the server offers any tools to call."""
390+
380391
completions: CompletionsCapability | None = None
381392
"""Present if the server offers autocompletion suggestions for prompts and resources."""
393+
382394
tasks: ServerTasksCapability | None = None
383395
"""Present if the server supports task-augmented requests."""
384396

@@ -413,8 +425,8 @@ class Task(MCPModel):
413425
"""Current task state."""
414426

415427
status_message: str | None = None
416-
"""
417-
Optional human-readable message describing the current task state.
428+
"""Optional human-readable message describing the current task state.
429+
418430
This can provide context for any status, including:
419431
- Reasons for "cancelled" status
420432
- Summaries for "completed" status
@@ -583,16 +595,14 @@ class ProgressNotificationParams(NotificationParams):
583595
total: float | None = None
584596
"""Total number of items to process (or total progress required), if known."""
585597
message: str | None = None
586-
"""
587-
Message related to progress. This should provide relevant human readable
588-
progress information.
598+
"""Message related to progress.
599+
600+
This should provide relevant human readable progress information.
589601
"""
590602

591603

592604
class ProgressNotification(Notification[ProgressNotificationParams, Literal["notifications/progress"]]):
593-
"""An out-of-band notification used to inform the receiver of a progress update for a
594-
long-running request.
595-
"""
605+
"""An out-of-band notification used to inform the receiver of a progress update for a long-running request."""
596606

597607
method: Literal["notifications/progress"] = "notifications/progress"
598608
params: ProgressNotificationParams
@@ -614,20 +624,24 @@ class Resource(BaseMetadata):
614624

615625
uri: str
616626
"""The URI of this resource."""
627+
617628
description: str | None = None
618629
"""A description of what this resource represents."""
630+
619631
mime_type: str | None = None
620632
"""The MIME type of this resource, if known."""
633+
621634
size: int | None = None
622-
"""
623-
The size of the raw resource content, in bytes (i.e., before base64 encoding
624-
or any tokenization), if known.
635+
"""The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
625636
626637
This can be used by Hosts to display file sizes and estimate context window usage.
627638
"""
639+
628640
icons: list[Icon] | None = None
629641
"""An optional list of icons for this resource."""
642+
630643
annotations: Annotations | None = None
644+
631645
meta: Meta | None = Field(alias="_meta", default=None)
632646
"""
633647
See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
@@ -639,20 +653,22 @@ class ResourceTemplate(BaseMetadata):
639653
"""A template description for resources available on the server."""
640654

641655
uri_template: str
642-
"""
643-
A URI template (according to RFC 6570) that can be used to construct resource
644-
URIs.
645-
"""
656+
"""A URI template (according to RFC 6570) that can be used to construct resource URIs."""
657+
646658
description: str | None = None
647659
"""A human-readable description of what this template is for."""
660+
648661
mime_type: str | None = None
662+
"""The MIME type for all resources that match this template.
663+
664+
This should only be included if all resources matching this template have the same type.
649665
"""
650-
The MIME type for all resources that match this template. This should only be
651-
included if all resources matching this template have the same type.
652-
"""
666+
653667
icons: list[Icon] | None = None
654668
"""An optional list of icons for this resource template."""
669+
655670
annotations: Annotations | None = None
671+
656672
meta: Meta | None = Field(alias="_meta", default=None)
657673
"""
658674
See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)

0 commit comments

Comments
 (0)