File tree Expand file tree Collapse file tree 7 files changed +74
-7
lines changed
Expand file tree Collapse file tree 7 files changed +74
-7
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ """Generate the code reference pages and navigation."""
2+
3+ from pathlib import Path
4+
5+ import mkdocs_gen_files
6+
7+ nav = mkdocs_gen_files .Nav ()
8+
9+ root = Path (__file__ ).parent .parent .parent
10+ src = root / "src"
11+
12+ for path in sorted (src .rglob ("*.py" )):
13+ module_path = path .relative_to (src ).with_suffix ("" )
14+ doc_path = path .relative_to (src ).with_suffix (".md" )
15+ full_doc_path = Path ("api" , doc_path )
16+
17+ parts = tuple (module_path .parts )
18+
19+ if parts [- 1 ] == "__init__" :
20+ parts = parts [:- 1 ]
21+ doc_path = doc_path .with_name ("index.md" )
22+ full_doc_path = full_doc_path .with_name ("index.md" )
23+ elif parts [- 1 ].startswith ("_" ):
24+ continue
25+
26+ nav [parts ] = doc_path .as_posix ()
27+
28+ with mkdocs_gen_files .open (full_doc_path , "w" ) as fd :
29+ ident = "." .join (parts )
30+ fd .write (f"::: { ident } " )
31+
32+ mkdocs_gen_files .set_edit_path (full_doc_path , path .relative_to (root ))
33+
34+ with mkdocs_gen_files .open ("api/SUMMARY.md" , "w" ) as nav_file :
35+ nav_file .writelines (nav .build_literate_nav ())
Original file line number Diff line number Diff line change @@ -64,4 +64,4 @@ npx -y @modelcontextprotocol/inspector
6464
6565## API Reference
6666
67- Full API documentation is available in the [ API Reference] ( api.md ) .
67+ Full API documentation is available in the [ API Reference] ( api/mcp/index .md ) .
Original file line number Diff line number Diff line change @@ -883,6 +883,6 @@ The lowlevel `Server` also now exposes a `session_manager` property to access th
883883
884884If you encounter issues during migration:
885885
886- 1 . Check the [ API Reference] ( api.md ) for updated method signatures
886+ 1 . Check the [ API Reference] ( api/mcp/index .md ) for updated method signatures
8878872 . Review the [ examples] ( https://github.com/modelcontextprotocol/python-sdk/tree/main/examples ) for updated usage patterns
8888883 . Open an issue on [ GitHub] ( https://github.com/modelcontextprotocol/python-sdk/issues ) if you find a bug or need further assistance
Original file line number Diff line number Diff line change 2525 - Introduction : experimental/tasks.md
2626 - Server Implementation : experimental/tasks-server.md
2727 - Client Usage : experimental/tasks-client.md
28- - API Reference : api.md
28+ - API Reference : api/
2929
3030theme :
3131 name : " material"
@@ -115,19 +115,22 @@ plugins:
115115 - social :
116116 enabled : !ENV [ENABLE_SOCIAL_CARDS, false]
117117 - glightbox
118+ - gen-files :
119+ scripts :
120+ - docs/hooks/gen_ref_pages.py
121+ - literate-nav :
122+ nav_file : SUMMARY.md
118123 - mkdocstrings :
119124 handlers :
120125 python :
121- paths : [src/mcp ]
126+ paths : [src]
122127 options :
123128 relative_crossrefs : true
124129 members_order : source
125130 separate_signature : true
126131 show_signature_annotations : true
127132 signature_crossrefs : true
128133 group_by_category : false
129- # 3 because docs are in pages with an H2 just above them
130- heading_level : 3
131134 inventories :
132135 - url : https://docs.python.org/3/objects.inv
133136 - url : https://docs.pydantic.dev/latest/objects.inv
Original file line number Diff line number Diff line change @@ -74,7 +74,9 @@ dev = [
7474]
7575docs = [
7676 " mkdocs>=1.6.1" ,
77+ " mkdocs-gen-files>=0.5.0" ,
7778 " mkdocs-glightbox>=0.4.0" ,
79+ " mkdocs-literate-nav>=0.6.1" ,
7880 " mkdocs-material[imaging]>=9.5.45" ,
7981 " mkdocstrings-python>=2.0.1" ,
8082]
You can’t perform that action at this time.
0 commit comments