Skip to content

Commit 07dce71

Browse files
committed
Serve v2 docs at the site root, with permanent per-major paths
The combined GitHub Pages site now serves the current major (v2, from main) at the root and mirrors the same build under /v2/, and builds the v1 maintenance line (from v1.x) under /v1/. Per-major paths are meant to be permanent: /v2/ stays a byte-identical copy of the root so existing /v2/... links keep resolving after a future major takes the root, the way /v1/... will for v1. main becomes the sole deployer of the combined site: the deploy workflow no longer triggers on v1.x pushes, and a v1.x docs change goes live on the next main deploy or a manual workflow_dispatch. site_url and both packages' Documentation URLs point at the root as the canonical location.
1 parent 68ca87e commit 07dce71

5 files changed

Lines changed: 27 additions & 13 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ name: Deploy Docs
33
on:
44
push:
55
branches:
6+
# main is the sole deployer of the combined site (v2 at / and /v2/, v1.x
7+
# at /v1/); the v1.x branch has no deploy workflow. A v1.x docs change is
8+
# published by the next main deploy or a manual workflow_dispatch here.
69
- main
7-
- v1.x
810
paths:
911
- docs/**
1012
# docs pages include their code blocks from these files via `--8<--`, so a
@@ -48,7 +50,7 @@ jobs:
4850
enable-cache: true
4951
version: 0.9.5
5052

51-
- name: Build combined docs (v1.x at /, main at /v2/)
53+
- name: Build combined docs (main at / and /v2/, v1.x at /v1/)
5254
run: bash scripts/build-docs.sh site
5355

5456
- name: Configure Pages

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ site_description: The official Python SDK for the Model Context Protocol
44
repo_name: modelcontextprotocol/python-sdk
55
repo_url: https://github.com/modelcontextprotocol/python-sdk
66
edit_uri: edit/main/docs/
7-
site_url: https://py.sdk.modelcontextprotocol.io/v2/
7+
site_url: https://py.sdk.modelcontextprotocol.io/
88

99
# TODO(Marcelo): Add Anthropic copyright?
1010
# copyright: © Model Context Protocol 2025 to present

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ dependencies = [
142142

143143
[project.urls]
144144
Homepage = "https://modelcontextprotocol.io"
145-
Documentation = "https://py.sdk.modelcontextprotocol.io/v2/"
145+
Documentation = "https://py.sdk.modelcontextprotocol.io/"
146146
Repository = "https://github.com/modelcontextprotocol/python-sdk"
147147
Issues = "https://github.com/modelcontextprotocol/python-sdk/issues"
148148

scripts/build-docs.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22
#
33
# Build combined v1 + v2 documentation for GitHub Pages.
44
#
5-
# v1 docs (from the v1.x branch) are placed at the site root.
6-
# v2 docs (from main) are placed under /v2/.
5+
# The current major (v2, from main) is placed at the site root and mirrored
6+
# under /v2/; the v1 maintenance line (from the v1.x branch) is placed under
7+
# /v1/. Per-major paths are permanent: /v2/ is a byte-identical copy of the
8+
# root so that /v2/... links keep resolving after a future major takes the
9+
# root, the way /v1/... does for v1 today.
710
#
811
# The two lines use different toolchains: v1.x still builds with MkDocs, while
912
# main builds with Zensical (which needs a pre-build step to materialise the API
1013
# reference and a post-build step for llms.txt — see scripts/docs/). Each branch
11-
# is fetched fresh from origin and built with its own synced `docs` group, so
12-
# the output is identical regardless of which branch triggered the workflow.
13-
# This script is intended to run in CI; for a local v2 preview use
14-
# `scripts/serve-docs.sh`.
14+
# is fetched fresh from origin and built with its own synced `docs` group. Only
15+
# main deploys the combined site (the v1.x branch carries no deploy workflow), so
16+
# a v1.x docs change goes live on the next main deploy or a manual
17+
# `workflow_dispatch` of deploy-docs.yml. This script is intended to run in CI;
18+
# for a local v2 preview use `scripts/serve-docs.sh`.
1519
#
1620
# Usage:
1721
# scripts/build-docs.sh [output-dir]
@@ -50,6 +54,9 @@ build_site() {
5054
fi
5155
}
5256

57+
# Fetch a branch fresh from origin, build its docs, and copy the result to
58+
# `dest`. The built tree stays in `worktree/site` afterwards so a caller can
59+
# mirror it to a second destination.
5360
build_branch() {
5461
local branch="$1" worktree="$2" dest="$3"
5562

@@ -70,7 +77,12 @@ build_branch() {
7077

7178
rm -rf "${OUTPUT_DIR:?}"/*
7279

73-
build_branch v1.x "$V1_WORKTREE" "$OUTPUT_DIR"
74-
build_branch main "$V2_WORKTREE" "$OUTPUT_DIR/v2"
80+
# v2 (main) at the root, then mirrored to /v2/ from the same build, then v1
81+
# under /v1/. The mirror is copied from the worktree's build directory rather
82+
# than from the root so it never picks up the /v1/ tree.
83+
build_branch main "$V2_WORKTREE" "$OUTPUT_DIR"
84+
mkdir -p "$OUTPUT_DIR/v2"
85+
cp -a "$V2_WORKTREE/site/." "$OUTPUT_DIR/v2/"
86+
build_branch v1.x "$V1_WORKTREE" "$OUTPUT_DIR/v1"
7587

7688
echo "=== Combined docs built at $OUTPUT_DIR ==="

src/mcp-types/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies = [
3131

3232
[project.urls]
3333
Homepage = "https://modelcontextprotocol.io"
34-
Documentation = "https://py.sdk.modelcontextprotocol.io/v2/"
34+
Documentation = "https://py.sdk.modelcontextprotocol.io/"
3535
Repository = "https://github.com/modelcontextprotocol/python-sdk"
3636
Issues = "https://github.com/modelcontextprotocol/python-sdk/issues"
3737

0 commit comments

Comments
 (0)