Embedded MCP (FastMCP) documentation UI for FastAPI apps.
Project description
fastapi-mcp-docs
Embed an interactive MCP documentation UI inside a FastAPI app (inspired by MCP Inspector), mounted at /mcp-docs.
Install
pip install fastapi-mcp-docs
For tests:
pip install "fastapi-mcp-docs[test]"
Usage
from fastapi import FastAPI
from fastapi_mcp_docs import mount_mcp_docs
app = FastAPI()
# `mcp` can be a FastMCP/MCP server object that exposes tools (and optionally prompts/resources)
# and supports tool calling via `call_tool(...)` / `call(...)`.
mcp = ...
mount_mcp_docs(app, mcp, docs_url="/mcp-docs", mcp_url="/mcp")
Then open:
GET /mcp-docsfor the UIGET /mcp-docs/schemafor discovered tools/prompts/resourcesPOST /mcp-docs/callto call a tool from the UIGET /mcp-docs/configto export anmcp.jsonsnippet for clients
Notes on compatibility
fastapi-mcp-docs aims to work with different MCP server implementations by using light introspection:
- Discovery: tries
list_tools()/tools,list_prompts()/prompts,list_resources()/resources - Calling: tries
call_tool(name, arguments)thencall(name, arguments)
If your server uses different method/attribute names, you can wrap it in a small adapter that provides the above methods.
Example app
Run:
pip install "fastapi-mcp-docs[example]"
python -m uvicorn examples.app:app --reload
Then open http://localhost:8000/mcp-docs.
Publishing to PyPI
This repository includes an automatic publishing workflow that runs on GitHub Releases.
- Create a new GitHub Release (e.g.
v0.1.0) and the workflow will build and publish to PyPI. - Configure one of the following:
- Trusted Publishing (recommended): enable GitHub Actions trusted publishing for the
fastapi-mcp-docsproject on PyPI. - API token: add
PYPI_API_TOKENas a repository secret.
- Trusted Publishing (recommended): enable GitHub Actions trusted publishing for the
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 fastapi_mcp_docs-0.1.1.tar.gz.
File metadata
- Download URL: fastapi_mcp_docs-0.1.1.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5154d29a40fda031a70c1176a672e80b59181e8e281a2a29a95c899a6890a6c2
|
|
| MD5 |
da8eafc4deca0c34d0919e9f794c6fe5
|
|
| BLAKE2b-256 |
693efebf99ac0a3b79d640e8f329914ae9c513f4b6ccaf65fd983d42fa0f4e25
|
Provenance
The following attestation bundles were made for fastapi_mcp_docs-0.1.1.tar.gz:
Publisher:
publish.yml on valenti1234/fastapi-mcp-docs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_mcp_docs-0.1.1.tar.gz -
Subject digest:
5154d29a40fda031a70c1176a672e80b59181e8e281a2a29a95c899a6890a6c2 - Sigstore transparency entry: 1374496949
- Sigstore integration time:
-
Permalink:
valenti1234/fastapi-mcp-docs@f4dd4f54e3422335ad37b0513991e81be4d7efba -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/valenti1234
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4dd4f54e3422335ad37b0513991e81be4d7efba -
Trigger Event:
release
-
Statement type:
File details
Details for the file fastapi_mcp_docs-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fastapi_mcp_docs-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05b6dfa28f465fbdbc79289535d66fb2bd1e6ed9cb24bc5635da3139a9ac2acc
|
|
| MD5 |
41f8e0ea4e1c57bb5fbdd147aa511328
|
|
| BLAKE2b-256 |
410d54f8a752d563c5e5c86c58ef8f493b8e082efde9f5eca5fb12aec436fb7b
|
Provenance
The following attestation bundles were made for fastapi_mcp_docs-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on valenti1234/fastapi-mcp-docs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_mcp_docs-0.1.1-py3-none-any.whl -
Subject digest:
05b6dfa28f465fbdbc79289535d66fb2bd1e6ed9cb24bc5635da3139a9ac2acc - Sigstore transparency entry: 1374497027
- Sigstore integration time:
-
Permalink:
valenti1234/fastapi-mcp-docs@f4dd4f54e3422335ad37b0513991e81be4d7efba -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/valenti1234
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4dd4f54e3422335ad37b0513991e81be4d7efba -
Trigger Event:
release
-
Statement type: