Skip to content

Commit 44ab5f6

Browse files
authored
Merge branch 'main' into fix-355-type-error-lifespan-context
2 parents a96700a + 4e11f28 commit 44ab5f6

File tree

8 files changed

+889
-30
lines changed

8 files changed

+889
-30
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ jobs:
1414

1515
- name: Install uv
1616
uses: astral-sh/setup-uv@v3
17-
18-
- name: "Set up Python"
19-
uses: actions/setup-python@v5
2017
with:
21-
python-version-file: ".python-version"
18+
enable-cache: true
2219

23-
- name: Install the project
24-
run: uv sync --frozen --all-extras --dev
20+
- name: Set up Python 3.12
21+
run: uv python install 3.12
2522

2623
- name: Build
2724
run: uv build
@@ -53,3 +50,28 @@ jobs:
5350

5451
- name: Publish package distributions to PyPI
5552
uses: pypa/gh-action-pypi-publish@release/v1
53+
54+
docs-publish:
55+
runs-on: ubuntu-latest
56+
needs: ["pypi-publish"]
57+
permissions:
58+
contents: write
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Configure Git Credentials
62+
run: |
63+
git config user.name github-actions[bot]
64+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
65+
- name: "Set up Python"
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version-file: ".python-version"
69+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
70+
- uses: actions/cache@v4
71+
with:
72+
key: mkdocs-material-${{ env.cache_id }}
73+
path: .cache
74+
restore-keys: |
75+
mkdocs-material-
76+
- run: uv sync --frozen --group docs
77+
- run: uv run --no-sync mkdocs gh-deploy --force

.github/workflows/shared.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,11 @@ jobs:
1414
with:
1515
enable-cache: true
1616

17-
- name: "Set up Python"
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version-file: ".python-version"
21-
2217
- name: Install the project
23-
run: uv sync --frozen --all-extras --dev
18+
run: uv sync --frozen --all-extras --dev --python 3.12
2419

2520
- name: Run ruff format check
26-
run: uv run --frozen ruff check .
21+
run: uv run --no-sync ruff check .
2722

2823
typecheck:
2924
runs-on: ubuntu-latest
@@ -35,19 +30,17 @@ jobs:
3530
with:
3631
enable-cache: true
3732

38-
- name: "Set up Python"
39-
uses: actions/setup-python@v5
40-
with:
41-
python-version-file: ".python-version"
42-
4333
- name: Install the project
44-
run: uv sync --frozen --all-extras --dev
34+
run: uv sync --frozen --all-extras --dev --python 3.12
4535

4636
- name: Run pyright
47-
run: uv run --frozen pyright
37+
run: uv run --no-sync pyright
4838

49-
build:
39+
test:
5040
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
python-version: ["3.10", "3.11", "3.12", "3.13"]
5144

5245
steps:
5346
- uses: actions/checkout@v4
@@ -57,13 +50,8 @@ jobs:
5750
with:
5851
enable-cache: true
5952

60-
- name: "Set up Python"
61-
uses: actions/setup-python@v5
62-
with:
63-
python-version-file: ".python-version"
64-
6553
- name: Install the project
66-
run: uv sync --frozen --all-extras --dev
54+
run: uv sync --frozen --all-extras --dev --python ${{ matrix.python-version }}
6755

6856
- name: Run pytest
69-
run: uv run --frozen pytest
57+
run: uv run --no-sync pytest

.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: mcp

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# MCP Server
2+
3+
This is the MCP Server implementation in Python.
4+
5+
It only contains the [API Reference](api.md) for the time being.

mkdocs.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
site_name: MCP Server
2+
site_description: MCP Server
3+
strict: true
4+
5+
repo_name: modelcontextprotocol/python-sdk
6+
repo_url: https://github.com/modelcontextprotocol/python-sdk
7+
edit_uri: edit/main/docs/
8+
9+
# TODO(Marcelo): Add Anthropic copyright?
10+
# copyright: © Model Context Protocol 2025 to present
11+
12+
nav:
13+
- Home: index.md
14+
- API Reference: api.md
15+
16+
theme:
17+
name: "material"
18+
palette:
19+
- media: "(prefers-color-scheme)"
20+
scheme: default
21+
primary: black
22+
accent: black
23+
toggle:
24+
icon: material/lightbulb
25+
name: "Switch to light mode"
26+
- media: "(prefers-color-scheme: light)"
27+
scheme: default
28+
primary: black
29+
accent: black
30+
toggle:
31+
icon: material/lightbulb-outline
32+
name: "Switch to dark mode"
33+
- media: "(prefers-color-scheme: dark)"
34+
scheme: slate
35+
primary: white
36+
accent: white
37+
toggle:
38+
icon: material/lightbulb-auto-outline
39+
name: "Switch to system preference"
40+
features:
41+
- search.suggest
42+
- search.highlight
43+
- content.tabs.link
44+
- content.code.annotate
45+
- content.code.copy
46+
- content.code.select
47+
- navigation.path
48+
- navigation.indexes
49+
- navigation.sections
50+
- navigation.tracking
51+
- toc.follow
52+
# logo: "img/logo-white.svg"
53+
# TODO(Marcelo): Add a favicon.
54+
# favicon: "favicon.ico"
55+
56+
# https://www.mkdocs.org/user-guide/configuration/#validation
57+
validation:
58+
omitted_files: warn
59+
absolute_links: warn
60+
unrecognized_links: warn
61+
anchors: warn
62+
63+
markdown_extensions:
64+
- tables
65+
- admonition
66+
- attr_list
67+
- md_in_html
68+
- pymdownx.details
69+
- pymdownx.caret
70+
- pymdownx.critic
71+
- pymdownx.mark
72+
- pymdownx.superfences
73+
- pymdownx.snippets
74+
- pymdownx.tilde
75+
- pymdownx.inlinehilite
76+
- pymdownx.highlight:
77+
pygments_lang_class: true
78+
- pymdownx.extra:
79+
pymdownx.superfences:
80+
custom_fences:
81+
- name: mermaid
82+
class: mermaid
83+
format: !!python/name:pymdownx.superfences.fence_code_format
84+
- pymdownx.emoji:
85+
emoji_index: !!python/name:material.extensions.emoji.twemoji
86+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
87+
options:
88+
custom_icons:
89+
- docs/.overrides/.icons
90+
- pymdownx.tabbed:
91+
alternate_style: true
92+
- pymdownx.tasklist:
93+
custom_checkbox: true
94+
- sane_lists # this means you can start a list from any number
95+
96+
watch:
97+
- src/mcp
98+
99+
plugins:
100+
- search
101+
- social
102+
- glightbox
103+
- mkdocstrings:
104+
handlers:
105+
python:
106+
paths: [src/mcp]
107+
options:
108+
relative_crossrefs: true
109+
members_order: source
110+
separate_signature: true
111+
show_signature_annotations: true
112+
signature_crossrefs: true
113+
group_by_category: false
114+
# 3 because docs are in pages with an H2 just above them
115+
heading_level: 3
116+
import:
117+
- url: https://docs.python.org/3/objects.inv
118+
- url: https://docs.pydantic.dev/latest/objects.inv
119+
- url: https://typing-extensions.readthedocs.io/en/latest/objects.inv

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ mcp = "mcp.cli:app [cli]"
4242

4343
[tool.uv]
4444
resolution = "lowest-direct"
45-
dev-dependencies = [
45+
default-groups = ["dev", "docs"]
46+
47+
[dependency-groups]
48+
dev = [
4649
"pyright>=1.1.391",
4750
"pytest>=8.3.4",
4851
"ruff>=0.8.5",
@@ -51,6 +54,13 @@ dev-dependencies = [
5154
"pytest-xdist>=3.6.1",
5255
"pytest-examples>=0.0.14",
5356
]
57+
docs = [
58+
"mkdocs>=1.6.1",
59+
"mkdocs-glightbox>=0.4.0",
60+
"mkdocs-material[imaging]>=9.5.45",
61+
"mkdocstrings-python>=1.12.2",
62+
]
63+
5464

5565
[build-system]
5666
requires = ["hatchling", "uv-dynamic-versioning"]

0 commit comments

Comments
 (0)