Swagger-like docs UI for FastMCP tools, prompts, and resources.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_swagger_ui-0.1.3.tar.gz.
File metadata
- Download URL: mcp_swagger_ui-0.1.3.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87d2fd6e012b98c24eaf4427e4e1b2bb11a017bf27d2bc97ce0bed1070583e71
|
|
| MD5 |
51061a79b4a12c45ac08a12ab08ba940
|
|
| BLAKE2b-256 |
b9fd465d2570b99c4c208bd79f539a86eefa0e6c4c0417fc06ae1c6b1633f8ea
|
Provenance
The following attestation bundles were made for mcp_swagger_ui-0.1.3.tar.gz:
Publisher:
python-publish.yml on VasuDevAiNamaha/mcp_swagger_ui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_swagger_ui-0.1.3.tar.gz -
Subject digest:
87d2fd6e012b98c24eaf4427e4e1b2bb11a017bf27d2bc97ce0bed1070583e71 - Sigstore transparency entry: 1154576434
- Sigstore integration time:
-
Permalink:
VasuDevAiNamaha/mcp_swagger_ui@371885808c24552a13ab9ff8c8d3d3af813f9dca -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/VasuDevAiNamaha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@371885808c24552a13ab9ff8c8d3d3af813f9dca -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_swagger_ui-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mcp_swagger_ui-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19bc5299bdb8155b2cf2e7863abaa0f34122099b62192e0d352949ef85a5e5f7
|
|
| MD5 |
dcb2c0e050f379bed3e3fd49e83ff184
|
|
| BLAKE2b-256 |
66dba4a7ebc023d335ace1d809353b95cbb418cdd2443d08f289a23342ef6d1a
|
Provenance
The following attestation bundles were made for mcp_swagger_ui-0.1.3-py3-none-any.whl:
Publisher:
python-publish.yml on VasuDevAiNamaha/mcp_swagger_ui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_swagger_ui-0.1.3-py3-none-any.whl -
Subject digest:
19bc5299bdb8155b2cf2e7863abaa0f34122099b62192e0d352949ef85a5e5f7 - Sigstore transparency entry: 1154576437
- Sigstore integration time:
-
Permalink:
VasuDevAiNamaha/mcp_swagger_ui@371885808c24552a13ab9ff8c8d3d3af813f9dca -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/VasuDevAiNamaha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@371885808c24552a13ab9ff8c8d3d3af813f9dca -
Trigger Event:
push
-
Statement type: