Skip to content

Commit 4e11f28

Browse files
authored
Add mkdocs (#367)
1 parent 9ec6db2 commit 4e11f28

File tree

6 files changed

+876
-1
lines changed

6 files changed

+876
-1
lines changed

.github/workflows/publish-pypi.yml

+25
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,28 @@ jobs:
5050

5151
- name: Publish package distributions to PyPI
5252
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

docs/api.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: mcp

docs/index.md

+5
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

+119
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

+11-1
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)