Skip to main content

Embedded MCP (FastMCP) documentation UI for FastAPI apps.

Project description

fastapi-mcp-docs

License: MIT Python FastAPI CI GitHub Repo

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-docs for the UI
  • GET /mcp-docs/schema for discovered tools/prompts/resources
  • POST /mcp-docs/call to call a tool from the UI
  • GET /mcp-docs/config to export an mcp.json snippet 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) then call(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-docs project on PyPI.
    • API token: add PYPI_API_TOKEN as a repository secret.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_mcp_docs-0.1.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_mcp_docs-0.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

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

Hashes for fastapi_mcp_docs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5154d29a40fda031a70c1176a672e80b59181e8e281a2a29a95c899a6890a6c2
MD5 da8eafc4deca0c34d0919e9f794c6fe5
BLAKE2b-256 693efebf99ac0a3b79d640e8f329914ae9c513f4b6ccaf65fd983d42fa0f4e25

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_mcp_docs-0.1.1.tar.gz:

Publisher: publish.yml on valenti1234/fastapi-mcp-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastapi_mcp_docs-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_mcp_docs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 05b6dfa28f465fbdbc79289535d66fb2bd1e6ed9cb24bc5635da3139a9ac2acc
MD5 41f8e0ea4e1c57bb5fbdd147aa511328
BLAKE2b-256 410d54f8a752d563c5e5c86c58ef8f493b8e082efde9f5eca5fb12aec436fb7b

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page