Skip to content
Back to search

fastapi_mcp

Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/tadata-org--fastapi-mcp/badge.svg)](/listings/tadata-org--fastapi-mcp)

HTML

<a href="/listings/tadata-org--fastapi-mcp"><img src="/api/listings/tadata-org--fastapi-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

We recommend using [uv](https://docs.astral.sh/uv/), a fast Python package installer:

uv add fastapi-mcp

Alternatively, you can install with pip:

pip install fastapi-mcp

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 117 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <p align="center"><a href="https://github.com/tadata-org/fastapi_mcp"><img src="https://github.com/user-attachments/assets/7e44e98b-a0ba-4aff-a68a-4ffee3a6189c" alt="fastapi-to-mcp" height=100/></a></p>
  2. <div align="center">
  3. <span style="font-size: 0.85em; font-weight: normal;">Built by <a href="https://tadata.com">Tadata</a></span>
  4. </div>
  5. <h1 align="center">
  6. FastAPI-MCP
  7. </h1>
  8. <div align="center">
  9. <a href="https://trendshift.io/repositories/14064" target="_blank"><img src="https://trendshift.io/api/badge/repositories/14064" alt="tadata-org%2Ffastapi_mcp | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
  10. </div>
  11. <p align="center">Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!</p>
  12. <div align="center">
  13. [![PyPI version](https://img.shields.io/pypi/v/fastapi-mcp?color=%2334D058&label=pypi%20package)](https://pypi.org/project/fastapi-mcp/)
  14. [![Python Versions](https://img.shields.io/pypi/pyversions/fastapi-mcp.svg)](https://pypi.org/project/fastapi-mcp/)
  15. [![FastAPI](https://img.shields.io/badge/FastAPI-009485.svg?logo=fastapi&logoColor=white)](#)
  16. [![CI](https://github.com/tadata-org/fastapi_mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/tadata-org/fastapi_mcp/actions/workflows/ci.yml)
  17. [![Coverage](https://codecov.io/gh/tadata-org/fastapi_mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/tadata-org/fastapi_mcp)
  18. </div>
  19. <p align="center"><a href="https://github.com/tadata-org/fastapi_mcp"><img src="https://github.com/user-attachments/assets/b205adc6-28c0-4e3c-a68b-9c1a80eb7d0c" alt="fastapi-mcp-usage" height="400"/></a></p>
  20. ## Features
  21. - **Authentication** built in, using your existing FastAPI dependencies!
  22. - **FastAPI-native:** Not just another OpenAPI -> MCP converter
  23. - **Zero/Minimal configuration** required - just point it at your FastAPI app and it works
  24. - **Preserving schemas** of your request models and response models
  25. - **Preserve documentation** of all your endpoints, just as it is in Swagger
  26. - **Flexible deployment** - Mount your MCP server to the same app, or deploy separately
  27. - **ASGI transport** - Uses FastAPI's ASGI interface directly for efficient communication
  28. ## Hosted Solution
  29. If you prefer a managed hosted solution check out [tadata.com](https://tadata.com).
  30. ## Installation
  31. We recommend using [uv](https://docs.astral.sh/uv/), a fast Python package installer:
  32. ```bash
  33. uv add fastapi-mcp
  34. ```
  35. Alternatively, you can install with pip:
  36. ```bash
  37. pip install fastapi-mcp
  38. ```
  39. ## Basic Usage
  40. The simplest way to use FastAPI-MCP is to add an MCP server directly to your FastAPI application:
  41. ```python
  42. from fastapi import FastAPI
  43. from fastapi_mcp import FastApiMCP
  44. app = FastAPI()
  45. mcp = FastApiMCP(app)
  46. # Mount the MCP server directly to your FastAPI app
  47. mcp.mount()
  48. ```
  49. That's it! Your auto-generated MCP server is now available at `https://app.base.url/mcp`.
  50. ## Documentation, Examples and Advanced Usage
  51. FastAPI-MCP provides [comprehensive documentation](https://fastapi-mcp.tadata.com/). Additionaly, check out the [examples directory](examples) for code samples demonstrating these features in action.
  52. ## FastAPI-first Approach
  53. FastAPI-MCP is designed as a native extension of FastAPI, not just a converter that generates MCP tools from your API. This approach offers several key advantages:
  54. - **Native dependencies**: Secure your MCP endpoints using familiar FastAPI `Depends()` for authentication and authorization
  55. - **ASGI transport**: Communicates directly with your FastAPI app using its ASGI interface, eliminating the need for HTTP calls from the MCP to your API
  56. - **Unified infrastructure**: Your FastAPI app doesn't need to run separately from the MCP server (though [separate deployment](https://fastapi-mcp.tadata.com/advanced/deploy#deploying-separately-from-original-fastapi-app) is also supported)
  57. This design philosophy ensures minimum friction when adding MCP capabilities to your existing FastAPI services.
  58. ## Development and Contributing
  59. Thank you for considering contributing to FastAPI-MCP! We encourage the community to post Issues and create Pull Requests.
  60. Before you get started, please see our [Contribution Guide](CONTRIBUTING.md).
  61. ## Community
  62. Join [MCParty Slack community](https://join.slack.com/t/themcparty/shared_invite/zt-30yxr1zdi-2FG~XjBA0xIgYSYuKe7~Xg) to connect with other MCP enthusiasts, ask questions, and share your experiences with FastAPI-MCP.
  63. ## Requirements
  64. - Python 3.10+ (Recommended 3.12)
  65. - uv
  66. ## License
  67. MIT License. Copyright (c) 2025 Tadata Inc.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.