mcp-swagger-ui
Swagger UI style documentation for MCP FastMCP servers.
Features
Given an mcp.server.fastmcp.FastMCP instance, this package:
- inspects registered tools, prompts, resources, and resource templates
- generates an OpenAPI-like JSON document
- serves the same Swagger UI style as FastAPI
/docs - shows tool and prompt arguments directly in Swagger parameter lists
- highlights required vs optional arguments in generated docs
- supports optional auth for docs endpoints
Installation
pip install mcp-swagger-ui
For local development:
cd mcp_swagger_ui
python -m venv .venv
.venv\Scripts\activate
pip install -e ".[dev]"
Quickstart
from fastapi import FastAPI, HTTPException, Header
from mcp.server.fastmcp import FastMCP
from mcp_swagger_ui import mount_mcp_docs
# your FastMCP instance
mcp = FastMCP("My MCP Server")
app = FastAPI()
def docs_auth(x_api_key: str | None = Header(default=None)) -> None:
if x_api_key != "secret-docs-key":
raise HTTPException(status_code=401, detail="Unauthorized")
mount_mcp_docs(
app,
mcp,
mount_path="/mcp-docs",
title="My MCP Server Docs",
auth_dependency=docs_auth, # optional
)
Then open:
http://localhost:8000/mcp-docshttp://localhost:8000/mcp-docs/openapi.json
What The Docs Show
The generated docs are discoverability-focused and currently document:
- tool descriptions
- prompt descriptions
- argument names, types, defaults, and required status
- response schema summaries when available
Tools, prompts, and resources are grouped by Swagger tags, while the displayed paths use only the item names such as /search_users or /summarize_text.
Testing
This project includes a pytest suite with coverage enforcement.
- minimum coverage:
90% - configured in: pyproject.toml
- command guide: TESTING.md
Release Process
This repository follows an automated open-source release flow:
- pull requests run CI
- release preparation happens in a maintainer-controlled release branch
- release PRs must include version and changelog updates
- publishing to PyPI happens only from a pushed
v*tag that matches the package version onmaster
Contributor guidance:
- keep user-facing changes documented in the PR and in docs when needed
- do not manually edit versions for normal feature PRs unless the work is explicitly release preparation
Maintainer guides:
- release process details: RELEASING.md
- test and local commands: TESTING.md
API
mount_mcp_docs(app, mcp, mount_path="/mcp-docs", title="MCP Docs", version="1.0.0", auth_dependency=None) -> Nonecreate_docs_router(mcp, title="MCP Docs", version="1.0.0", openapi_path="/openapi.json", auth_dependency=None) -> APIRouter
Compatibility
- FastMCP API alignment:
- Uses official server methods first:
list_tools(),list_prompts(),list_resources(),list_resource_templates() - Handles async and sync method returns
- Uses converter helpers (
to_mcp_tool(),to_mcp_prompt(),to_mcp_resource()) when available
- Uses official server methods first:
- A generic fallback introspection path is still present for compatibility with FastMCP-adjacent objects.
- The generated schema is OpenAPI-like and focused on discoverability/documentation.
- Tool execution against an already-mounted MCP JSON-RPC endpoint is not implemented in this package yet.
Important
- This package targets the
mcpSDK FastMCP import path:from mcp.server.fastmcp import FastMCP
- If you are using standalone
fastmcp, this package will still usually work due to API overlap.
Publishing
Publishing is automated from GitHub Releases via GitHub Actions.
Initial repository setup still requires:
- configuring PyPI Trusted Publishing for this repository
- optionally protecting the
pypiGitHub environment
Metadata
Release files for mcp-swagger-ui 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_swagger_ui-0.1.3.tar.gz | 14.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_swagger_ui-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.0 kB
Release files / mcp_swagger_ui-0.1.3.tar.gz
| Download URL | mcp_swagger_ui-0.1.3.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87d2fd6e012b98c24eaf4427e4e1b2bb11a017bf27d2bc97ce0bed1070583e71
|
|
BLAKE2b-256 checksum How to use checksums |
b9fd465d2570b99c4c208bd79f539a86eefa0e6c4c0417fc06ae1c6b1633f8ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 21, 2026.
Transparency logRelease files / mcp_swagger_ui-0.1.3-py3-none-any.whl
| Download URL | mcp_swagger_ui-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19bc5299bdb8155b2cf2e7863abaa0f34122099b62192e0d352949ef85a5e5f7
|
|
BLAKE2b-256 checksum How to use checksums |
66dba4a7ebc023d335ace1d809353b95cbb418cdd2443d08f289a23342ef6d1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 21, 2026.
Transparency logSecurity for mcp-swagger-ui 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mcp_swagger_ui-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.