Skip to content

Commit 9911481

Browse files
docs: fix GitHub links to point to v1.x branch
Update all documentation links from blob/main to blob/v1.x since these docs are published from the v1.x branch. - 34 GitHub URLs updated across docs/*.md - 5 bare relative links converted to absolute GitHub URLs - mkdocs.yml edit_uri updated to v1.x - scripts/update_readme_snippets.py base URL updated to v1.x - mkdocs build passes clean in strict mode
1 parent ed4e22b commit 9911481

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

docs/authorization.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ if __name__ == "__main__":
6161
mcp.run(transport="streamable-http")
6262
```
6363

64-
_Full example: [examples/snippets/servers/oauth_server.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/oauth_server.py)_
64+
_Full example: [examples/snippets/servers/oauth_server.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/oauth_server.py)_
6565
<!-- /snippet-source -->
6666

67-
For a complete example with separate Authorization Server and Resource Server implementations, see [`examples/servers/simple-auth/`](examples/servers/simple-auth/).
67+
For a complete example with separate Authorization Server and Resource Server implementations, see [`examples/servers/simple-auth/`](https://github.com/modelcontextprotocol/python-sdk/tree/v1.x/examples/servers/simple-auth).
6868

6969
**Architecture:**
7070

7171
- **Authorization Server (AS)**: Handles OAuth flows, user authentication, and token issuance
7272
- **Resource Server (RS)**: Your MCP server that validates tokens and serves protected resources
7373
- **Client**: Discovers AS through RFC 9728, obtains tokens, and uses them with the MCP server
7474

75-
See [TokenVerifier](src/mcp/server/auth/provider.py) for more details on implementing token validation.
75+
See [TokenVerifier](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/src/mcp/server/auth/provider.py) for more details on implementing token validation.
7676

7777
## Client-Side Authentication
7878

@@ -171,7 +171,7 @@ if __name__ == "__main__":
171171
run()
172172
```
173173

174-
_Full example: [examples/snippets/clients/oauth_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/oauth_client.py)_
174+
_Full example: [examples/snippets/clients/oauth_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/clients/oauth_client.py)_
175175
<!-- /snippet-source -->
176176

177-
For a complete working example, see [`examples/clients/simple-auth-client/`](examples/clients/simple-auth-client/).
177+
For a complete working example, see [`examples/clients/simple-auth-client/`](https://github.com/modelcontextprotocol/python-sdk/tree/v1.x/examples/clients/simple-auth-client).

docs/client.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ if __name__ == "__main__":
8989
main()
9090
```
9191

92-
_Full example: [examples/snippets/clients/stdio_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/stdio_client.py)_
92+
_Full example: [examples/snippets/clients/stdio_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/clients/stdio_client.py)_
9393
<!-- /snippet-source -->
9494

9595
Clients can also connect using [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http):
@@ -127,7 +127,7 @@ if __name__ == "__main__":
127127
asyncio.run(main())
128128
```
129129

130-
_Full example: [examples/snippets/clients/streamable_basic.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/streamable_basic.py)_
130+
_Full example: [examples/snippets/clients/streamable_basic.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/clients/streamable_basic.py)_
131131
<!-- /snippet-source -->
132132

133133
## Client Display Utilities
@@ -205,7 +205,7 @@ if __name__ == "__main__":
205205
main()
206206
```
207207

208-
_Full example: [examples/snippets/clients/display_utilities.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/display_utilities.py)_
208+
_Full example: [examples/snippets/clients/display_utilities.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/clients/display_utilities.py)_
209209
<!-- /snippet-source -->
210210

211211
The `get_display_name()` function implements the proper precedence rules for displaying names:

docs/low-level-server.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ if __name__ == "__main__":
112112
asyncio.run(run())
113113
```
114114

115-
_Full example: [examples/snippets/servers/lowlevel/lifespan.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/lifespan.py)_
115+
_Full example: [examples/snippets/servers/lowlevel/lifespan.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/lowlevel/lifespan.py)_
116116
<!-- /snippet-source -->
117117

118118
The lifespan API provides:
@@ -193,7 +193,7 @@ if __name__ == "__main__":
193193
asyncio.run(run())
194194
```
195195

196-
_Full example: [examples/snippets/servers/lowlevel/basic.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/basic.py)_
196+
_Full example: [examples/snippets/servers/lowlevel/basic.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/lowlevel/basic.py)_
197197
<!-- /snippet-source -->
198198

199199
Caution: The `uv run mcp run` and `uv run mcp dev` tool doesn't support low-level server.
@@ -289,7 +289,7 @@ if __name__ == "__main__":
289289
asyncio.run(run())
290290
```
291291

292-
_Full example: [examples/snippets/servers/lowlevel/structured_output.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/structured_output.py)_
292+
_Full example: [examples/snippets/servers/lowlevel/structured_output.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/lowlevel/structured_output.py)_
293293
<!-- /snippet-source -->
294294

295295
Tools can return data in four ways:
@@ -374,7 +374,7 @@ if __name__ == "__main__":
374374
asyncio.run(run())
375375
```
376376

377-
_Full example: [examples/snippets/servers/lowlevel/direct_call_tool_result.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/direct_call_tool_result.py)_
377+
_Full example: [examples/snippets/servers/lowlevel/direct_call_tool_result.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/lowlevel/direct_call_tool_result.py)_
378378
<!-- /snippet-source -->
379379

380380
**Note:** When returning `CallToolResult`, you bypass the automatic content/structured conversion. You must construct the complete response yourself.
@@ -427,7 +427,7 @@ async def list_resources_paginated(request: types.ListResourcesRequest) -> types
427427
return types.ListResourcesResult(resources=page_items, nextCursor=next_cursor)
428428
```
429429

430-
_Full example: [examples/snippets/servers/pagination_example.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/pagination_example.py)_
430+
_Full example: [examples/snippets/servers/pagination_example.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/pagination_example.py)_
431431
<!-- /snippet-source -->
432432

433433
### Client-side Consumption
@@ -477,7 +477,7 @@ if __name__ == "__main__":
477477
asyncio.run(list_all_resources())
478478
```
479479

480-
_Full example: [examples/snippets/clients/pagination_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/pagination_client.py)_
480+
_Full example: [examples/snippets/clients/pagination_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/clients/pagination_client.py)_
481481
<!-- /snippet-source -->
482482

483483
### Key Points
@@ -487,4 +487,4 @@ _Full example: [examples/snippets/clients/pagination_client.py](https://github.c
487487
- **Backward compatible** - clients that don't support pagination will still work (they'll just get the first page)
488488
- **Flexible page sizes** - Each endpoint can define its own page size based on data characteristics
489489

490-
See the [simple-pagination example](examples/servers/simple-pagination) for a complete implementation.
490+
See the [simple-pagination example](https://github.com/modelcontextprotocol/python-sdk/tree/v1.x/examples/servers/simple-pagination) for a complete implementation.

docs/server.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def query_db(ctx: Context[ServerSession, AppContext]) -> str:
6767
return db.query()
6868
```
6969

70-
_Full example: [examples/snippets/servers/lifespan_example.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lifespan_example.py)_
70+
_Full example: [examples/snippets/servers/lifespan_example.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/lifespan_example.py)_
7171
<!-- /snippet-source -->
7272

7373
### Resources
@@ -98,7 +98,7 @@ def get_settings() -> str:
9898
}"""
9999
```
100100

101-
_Full example: [examples/snippets/servers/basic_resource.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/basic_resource.py)_
101+
_Full example: [examples/snippets/servers/basic_resource.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/basic_resource.py)_
102102
<!-- /snippet-source -->
103103

104104
#### Binary Resources
@@ -179,7 +179,7 @@ def get_weather(city: str, unit: str = "celsius") -> str:
179179
return f"Weather in {city}: 22degrees{unit[0].upper()}"
180180
```
181181

182-
_Full example: [examples/snippets/servers/basic_tool.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/basic_tool.py)_
182+
_Full example: [examples/snippets/servers/basic_tool.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/basic_tool.py)_
183183
<!-- /snippet-source -->
184184

185185
Tools can optionally receive a Context object by including a parameter with the `Context` type annotation. This context is automatically injected by the FastMCP framework and provides access to MCP capabilities:
@@ -209,7 +209,7 @@ async def long_running_task(task_name: str, ctx: Context[ServerSession, None], s
209209
return f"Task '{task_name}' completed"
210210
```
211211

212-
_Full example: [examples/snippets/servers/tool_progress.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/tool_progress.py)_
212+
_Full example: [examples/snippets/servers/tool_progress.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/tool_progress.py)_
213213
<!-- /snippet-source -->
214214

215215
#### Structured Output
@@ -294,7 +294,7 @@ def empty_result_tool() -> CallToolResult:
294294
return CallToolResult(content=[])
295295
```
296296

297-
_Full example: [examples/snippets/servers/direct_call_tool_result.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/direct_call_tool_result.py)_
297+
_Full example: [examples/snippets/servers/direct_call_tool_result.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/direct_call_tool_result.py)_
298298
<!-- /snippet-source -->
299299

300300
**Important:** `CallToolResult` must always be returned (no `Optional` or `Union`). For empty results, use `CallToolResult(content=[])`. For optional simple types, use `str | None` without `CallToolResult`.
@@ -400,7 +400,7 @@ def get_temperature(city: str) -> float:
400400
# Returns: {"result": 22.5}
401401
```
402402

403-
_Full example: [examples/snippets/servers/structured_output.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/structured_output.py)_
403+
_Full example: [examples/snippets/servers/structured_output.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/structured_output.py)_
404404
<!-- /snippet-source -->
405405

406406
### Prompts
@@ -429,7 +429,7 @@ def debug_error(error: str) -> list[base.Message]:
429429
]
430430
```
431431

432-
_Full example: [examples/snippets/servers/basic_prompt.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/basic_prompt.py)_
432+
_Full example: [examples/snippets/servers/basic_prompt.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/basic_prompt.py)_
433433
<!-- /snippet-source -->
434434

435435
#### Prompts with Embedded Resources
@@ -544,7 +544,7 @@ def my_resource():
544544
return "content"
545545
```
546546

547-
_Full example: [examples/fastmcp/icons_demo.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/fastmcp/icons_demo.py)_
547+
_Full example: [examples/fastmcp/icons_demo.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/fastmcp/icons_demo.py)_
548548

549549
### Images
550550

@@ -569,7 +569,7 @@ def create_thumbnail(image_path: str) -> Image:
569569
return Image(data=img.tobytes(), format="png")
570570
```
571571

572-
_Full example: [examples/snippets/servers/images.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/images.py)_
572+
_Full example: [examples/snippets/servers/images.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/images.py)_
573573
<!-- /snippet-source -->
574574

575575
### Audio
@@ -683,7 +683,7 @@ async def long_running_task(task_name: str, ctx: Context[ServerSession, None], s
683683
return f"Task '{task_name}' completed"
684684
```
685685

686-
_Full example: [examples/snippets/servers/tool_progress.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/tool_progress.py)_
686+
_Full example: [examples/snippets/servers/tool_progress.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/tool_progress.py)_
687687
<!-- /snippet-source -->
688688

689689
### Completions
@@ -774,7 +774,7 @@ if __name__ == "__main__":
774774
main()
775775
```
776776

777-
_Full example: [examples/snippets/clients/completion_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/completion_client.py)_
777+
_Full example: [examples/snippets/clients/completion_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/clients/completion_client.py)_
778778
<!-- /snippet-source -->
779779
### Elicitation
780780

@@ -883,7 +883,7 @@ async def connect_service(service_name: str, ctx: Context[ServerSession, None])
883883
)
884884
```
885885

886-
_Full example: [examples/snippets/servers/elicitation.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/elicitation.py)_
886+
_Full example: [examples/snippets/servers/elicitation.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/elicitation.py)_
887887
<!-- /snippet-source -->
888888

889889
Elicitation schemas support default values for all field types. Default values are automatically included in the JSON schema sent to clients, allowing them to pre-populate forms.
@@ -984,7 +984,7 @@ async def generate_poem(topic: str, ctx: Context[ServerSession, None]) -> str:
984984
return str(result.content)
985985
```
986986

987-
_Full example: [examples/snippets/servers/sampling.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/sampling.py)_
987+
_Full example: [examples/snippets/servers/sampling.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/sampling.py)_
988988
<!-- /snippet-source -->
989989

990990
### Logging and Notifications
@@ -1014,7 +1014,7 @@ async def process_data(data: str, ctx: Context[ServerSession, None]) -> str:
10141014
return f"Processed: {data}"
10151015
```
10161016

1017-
_Full example: [examples/snippets/servers/notifications.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/notifications.py)_
1017+
_Full example: [examples/snippets/servers/notifications.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/notifications.py)_
10181018
<!-- /snippet-source -->
10191019

10201020
#### Setting the Logging Level
@@ -1136,7 +1136,7 @@ def query_with_config(query: str, ctx: Context) -> str:
11361136
return str(result)
11371137
```
11381138

1139-
_Full lifespan example: [examples/snippets/servers/lifespan_example.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lifespan_example.py)_
1139+
_Full lifespan example: [examples/snippets/servers/lifespan_example.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/lifespan_example.py)_
11401140

11411141
## Running Your Server
11421142

@@ -1204,7 +1204,7 @@ if __name__ == "__main__":
12041204
main()
12051205
```
12061206

1207-
_Full example: [examples/snippets/servers/direct_execution.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/direct_execution.py)_
1207+
_Full example: [examples/snippets/servers/direct_execution.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/direct_execution.py)_
12081208
<!-- /snippet-source -->
12091209

12101210
Run it with:
@@ -1253,7 +1253,7 @@ if __name__ == "__main__":
12531253
mcp.run(transport="streamable-http")
12541254
```
12551255

1256-
_Full example: [examples/snippets/servers/streamable_config.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_config.py)_
1256+
_Full example: [examples/snippets/servers/streamable_config.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/streamable_config.py)_
12571257
<!-- /snippet-source -->
12581258

12591259
You can mount multiple FastMCP servers in a Starlette application:
@@ -1316,13 +1316,13 @@ app = Starlette(
13161316
# math_mcp.settings.streamable_http_path = "/"
13171317
```
13181318

1319-
_Full example: [examples/snippets/servers/streamable_starlette_mount.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_starlette_mount.py)_
1319+
_Full example: [examples/snippets/servers/streamable_starlette_mount.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/streamable_starlette_mount.py)_
13201320
<!-- /snippet-source -->
13211321

13221322
For low level server with Streamable HTTP implementations, see:
13231323

1324-
- Stateful server: [`examples/servers/simple-streamablehttp/`](examples/servers/simple-streamablehttp/)
1325-
- Stateless server: [`examples/servers/simple-streamablehttp-stateless/`](examples/servers/simple-streamablehttp-stateless/)
1324+
- Stateful server: [`examples/servers/simple-streamablehttp/`](https://github.com/modelcontextprotocol/python-sdk/tree/v1.x/examples/servers/simple-streamablehttp)
1325+
- Stateless server: [`examples/servers/simple-streamablehttp-stateless/`](https://github.com/modelcontextprotocol/python-sdk/tree/v1.x/examples/servers/simple-streamablehttp-stateless)
13261326

13271327
The streamable HTTP transport supports:
13281328

@@ -1411,7 +1411,7 @@ app = Starlette(
14111411
)
14121412
```
14131413

1414-
_Full example: [examples/snippets/servers/streamable_http_basic_mounting.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_basic_mounting.py)_
1414+
_Full example: [examples/snippets/servers/streamable_http_basic_mounting.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/streamable_http_basic_mounting.py)_
14151415
<!-- /snippet-source -->
14161416

14171417
##### Host-based routing
@@ -1458,7 +1458,7 @@ app = Starlette(
14581458
)
14591459
```
14601460

1461-
_Full example: [examples/snippets/servers/streamable_http_host_mounting.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_host_mounting.py)_
1461+
_Full example: [examples/snippets/servers/streamable_http_host_mounting.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/streamable_http_host_mounting.py)_
14621462
<!-- /snippet-source -->
14631463

14641464
##### Multiple servers with path configuration
@@ -1521,7 +1521,7 @@ app = Starlette(
15211521
)
15221522
```
15231523

1524-
_Full example: [examples/snippets/servers/streamable_http_multiple_servers.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_multiple_servers.py)_
1524+
_Full example: [examples/snippets/servers/streamable_http_multiple_servers.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/streamable_http_multiple_servers.py)_
15251525
<!-- /snippet-source -->
15261526

15271527
##### Path configuration at initialization
@@ -1563,7 +1563,7 @@ app = Starlette(
15631563
)
15641564
```
15651565

1566-
_Full example: [examples/snippets/servers/streamable_http_path_config.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_path_config.py)_
1566+
_Full example: [examples/snippets/servers/streamable_http_path_config.py](https://github.com/modelcontextprotocol/python-sdk/blob/v1.x/examples/snippets/servers/streamable_http_path_config.py)_
15671567
<!-- /snippet-source -->
15681568

15691569
#### SSE servers

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ strict: true
44

55
repo_name: modelcontextprotocol/python-sdk
66
repo_url: https://github.com/modelcontextprotocol/python-sdk
7-
edit_uri: edit/main/docs/
7+
edit_uri: edit/v1.x/docs/
88
site_url: https://modelcontextprotocol.github.io/python-sdk
99

1010
# TODO(Marcelo): Add Anthropic copyright?

scripts/update_readme_snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_github_url(file_path: str) -> str:
2525
Returns:
2626
GitHub URL
2727
"""
28-
base_url = "https://github.com/modelcontextprotocol/python-sdk/blob/main"
28+
base_url = "https://github.com/modelcontextprotocol/python-sdk/blob/v1.x"
2929
return f"{base_url}/{file_path}"
3030

3131

0 commit comments

Comments
 (0)