site_name: MCP Python SDK site_description: The official Python SDK for the Model Context Protocol strict: true repo_name: modelcontextprotocol/python-sdk repo_url: https://github.com/modelcontextprotocol/python-sdk edit_uri: edit/main/docs/ site_url: https://py.sdk.modelcontextprotocol.io/v2/ # TODO(Marcelo): Add Anthropic copyright? # copyright: © Model Context Protocol 2025 to present nav: - MCP Python SDK: index.md - "What's new in v2": whats-new.md - Get started: - get-started/index.md - Installation: get-started/installation.md - First steps: get-started/first-steps.md - Connect to a real host: get-started/real-host.md - Testing: get-started/testing.md - Servers: - servers/index.md - Tools: servers/tools.md - Structured Output: servers/structured-output.md - Resources: servers/resources.md - URI templates: servers/uri-templates.md - Prompts: servers/prompts.md - Completions: servers/completions.md - "Images, audio & icons": servers/media.md - Handling errors: servers/handling-errors.md - Inside your handler: - handlers/index.md - The Context: handlers/context.md - Dependencies: handlers/dependencies.md - Lifespan: handlers/lifespan.md - Elicitation: handlers/elicitation.md - Multi-round-trip requests: handlers/multi-round-trip.md - Sampling and roots: handlers/sampling-and-roots.md - Progress: handlers/progress.md - Logging: handlers/logging.md - Subscriptions: handlers/subscriptions.md - Running your server: - run/index.md - Add to an existing app: run/asgi.md - Deploy & scale: run/deploy.md - Authorization: run/authorization.md - OpenTelemetry: run/opentelemetry.md - Serving legacy clients: run/legacy-clients.md - Clients: - client/index.md - Callbacks: client/callbacks.md - Transports: client/transports.md - OAuth: client/oauth-clients.md - Identity assertion: client/identity-assertion.md - Multiple servers: client/session-groups.md - Subscriptions: client/subscriptions.md - Caching: client/caching.md - Protocol versions: protocol-versions.md - Deprecated features: deprecated.md - Advanced: - advanced/index.md - The low-level Server: advanced/low-level-server.md - Pagination: advanced/pagination.md - Middleware: advanced/middleware.md - Extensions: advanced/extensions.md - MCP Apps: advanced/apps.md - Troubleshooting: troubleshooting.md - Migration Guide: migration.md - API Reference: api/ theme: name: "material" custom_dir: docs/.overrides font: text: Inter code: JetBrains Mono icon: logo: mcp favicon: favicon.svg palette: - media: "(prefers-color-scheme)" scheme: default primary: black accent: black toggle: icon: material/lightbulb name: "Switch to light mode" - media: "(prefers-color-scheme: light)" scheme: default primary: black accent: black toggle: icon: material/lightbulb-outline name: "Switch to dark mode" - media: "(prefers-color-scheme: dark)" scheme: slate primary: black accent: white toggle: icon: material/lightbulb-auto-outline name: "Switch to system preference" features: - search.suggest - search.highlight - content.tabs.link - content.code.annotate - content.code.copy - content.code.select - navigation.footer - navigation.indexes - navigation.instant - navigation.instant.prefetch - navigation.instant.progress - navigation.path - navigation.prune - navigation.sections - navigation.top - navigation.tracking - toc.follow extra_css: - extra.css # https://www.mkdocs.org/user-guide/configuration/#validation validation: omitted_files: warn absolute_links: warn unrecognized_links: warn anchors: warn markdown_extensions: - tables - admonition - attr_list - md_in_html - pymdownx.details - pymdownx.caret - pymdownx.critic - pymdownx.mark - pymdownx.superfences # Code examples live as complete, importable, tested files under `docs_src/` # and are included into pages with `--8<-- "docs_src//tutorialNNN.py"` # (resolved against the repo root regardless of the build's working # directory; the extension's default base_path is the CWD). # `check_paths: true` + `strict: true` turn a renamed/deleted example into a # build failure instead of a silently empty code block. - pymdownx.snippets: base_path: !relative $config_dir check_paths: true - pymdownx.tilde - pymdownx.inlinehilite - pymdownx.highlight: pygments_lang_class: true - pymdownx.extra: pymdownx.superfences: custom_fences: - name: mermaid class: mermaid format: !!python/name:pymdownx.superfences.fence_code_format - pymdownx.emoji: emoji_index: !!python/name:material.extensions.emoji.twemoji emoji_generator: !!python/name:material.extensions.emoji.to_svg options: custom_icons: - docs/.overrides/.icons - pymdownx.tabbed: alternate_style: true - pymdownx.tasklist: custom_checkbox: true - sane_lists # this means you can start a list from any number watch: - src - docs_src hooks: - docs/hooks/llms_txt.py plugins: - search - social: enabled: !ENV [ENABLE_SOCIAL_CARDS, false] - glightbox - gen-files: scripts: - docs/hooks/gen_ref_pages.py - literate-nav: nav_file: SUMMARY.md - mkdocstrings: handlers: python: paths: [src, src/mcp-types] options: relative_crossrefs: true members_order: source separate_signature: true show_signature_annotations: true signature_crossrefs: true group_by_category: false inventories: - url: https://docs.python.org/3/objects.inv - url: https://docs.pydantic.dev/latest/objects.inv - url: https://typing-extensions.readthedocs.io/en/latest/objects.inv