fastapi-mcp


Namefastapi-mcp JSON
Version 0.3.7 PyPI version JSON
download
home_pageNone
SummaryAutomatic MCP server generator for FastAPI applications - converts FastAPI endpoints to MCP tools for LLM integration
upload_time2025-07-14 16:19:51
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2024 Tadata Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ai api claude conversion fastapi llm mcp modelcontextprotocol openapi tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            <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>

<div align="center">
  <span style="font-size: 0.85em; font-weight: normal;">Built by <a href="https://tadata.com">Tadata</a></span>
</div>

<h1 align="center">
  FastAPI-MCP
</h1>

<p align="center">Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!</p>
<div align="center">

[![PyPI version](https://img.shields.io/pypi/v/fastapi-mcp?color=%2334D058&label=pypi%20package)](https://pypi.org/project/fastapi-mcp/)
[![Python Versions](https://img.shields.io/pypi/pyversions/fastapi-mcp.svg)](https://pypi.org/project/fastapi-mcp/)
[![FastAPI](https://img.shields.io/badge/FastAPI-009485.svg?logo=fastapi&logoColor=white)](#)
[![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)
[![Coverage](https://codecov.io/gh/tadata-org/fastapi_mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/tadata-org/fastapi_mcp)

</div>


<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>


## Features

- **Authentication** built in, using your existing FastAPI dependencies!

- **FastAPI-native:** Not just another OpenAPI -> MCP converter

- **Zero/Minimal configuration** required - just point it at your FastAPI app and it works

- **Preserving schemas** of your request models and response models

- **Preserve documentation** of all your endpoints, just as it is in Swagger

- **Flexible deployment** - Mount your MCP server to the same app, or deploy separately

- **ASGI transport** - Uses FastAPI's ASGI interface directly for efficient communication


## Hosted Solution

If you prefer a managed hosted solution check out [tadata.com](https://tadata.com).

## Installation

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

```bash
uv add fastapi-mcp
```

Alternatively, you can install with pip:

```bash
pip install fastapi-mcp
```

## Basic Usage

The simplest way to use FastAPI-MCP is to add an MCP server directly to your FastAPI application:

```python
from fastapi import FastAPI
from fastapi_mcp import FastApiMCP

app = FastAPI()

mcp = FastApiMCP(app)

# Mount the MCP server directly to your FastAPI app
mcp.mount()
```

That's it! Your auto-generated MCP server is now available at `https://app.base.url/mcp`.

## Documentation, Examples and Advanced Usage

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.

## FastAPI-first Approach

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:

- **Native dependencies**: Secure your MCP endpoints using familiar FastAPI `Depends()` for authentication and authorization

- **ASGI transport**: Communicates directly with your FastAPI app using its ASGI interface, eliminating the need for HTTP calls from the MCP to your API

- **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)

This design philosophy ensures minimum friction when adding MCP capabilities to your existing FastAPI services.


## Development and Contributing

Thank you for considering contributing to FastAPI-MCP! We encourage the community to post Issues and create Pull Requests.

Before you get started, please see our [Contribution Guide](CONTRIBUTING.md).

## Community

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.

## Requirements

- Python 3.10+ (Recommended 3.12)
- uv

## License

MIT License. Copyright (c) 2025 Tadata Inc.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fastapi-mcp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "ai, api, claude, conversion, fastapi, llm, mcp, modelcontextprotocol, openapi, tools",
    "author": null,
    "author_email": "\"Tadata Inc.\" <itay@tadata.com>",
    "download_url": "https://files.pythonhosted.org/packages/f3/b6/dbad5a717d909562905a24fa78551b899df582276ff9b5f88c5494c9acf6/fastapi_mcp-0.3.7.tar.gz",
    "platform": null,
    "description": "<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>\n\n<div align=\"center\">\n  <span style=\"font-size: 0.85em; font-weight: normal;\">Built by <a href=\"https://tadata.com\">Tadata</a></span>\n</div>\n\n<h1 align=\"center\">\n  FastAPI-MCP\n</h1>\n\n<p align=\"center\">Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!</p>\n<div align=\"center\">\n\n[![PyPI version](https://img.shields.io/pypi/v/fastapi-mcp?color=%2334D058&label=pypi%20package)](https://pypi.org/project/fastapi-mcp/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/fastapi-mcp.svg)](https://pypi.org/project/fastapi-mcp/)\n[![FastAPI](https://img.shields.io/badge/FastAPI-009485.svg?logo=fastapi&logoColor=white)](#)\n[![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)\n[![Coverage](https://codecov.io/gh/tadata-org/fastapi_mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/tadata-org/fastapi_mcp)\n\n</div>\n\n\n<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>\n\n\n## Features\n\n- **Authentication** built in, using your existing FastAPI dependencies!\n\n- **FastAPI-native:** Not just another OpenAPI -> MCP converter\n\n- **Zero/Minimal configuration** required - just point it at your FastAPI app and it works\n\n- **Preserving schemas** of your request models and response models\n\n- **Preserve documentation** of all your endpoints, just as it is in Swagger\n\n- **Flexible deployment** - Mount your MCP server to the same app, or deploy separately\n\n- **ASGI transport** - Uses FastAPI's ASGI interface directly for efficient communication\n\n\n## Hosted Solution\n\nIf you prefer a managed hosted solution check out [tadata.com](https://tadata.com).\n\n## Installation\n\nWe recommend using [uv](https://docs.astral.sh/uv/), a fast Python package installer:\n\n```bash\nuv add fastapi-mcp\n```\n\nAlternatively, you can install with pip:\n\n```bash\npip install fastapi-mcp\n```\n\n## Basic Usage\n\nThe simplest way to use FastAPI-MCP is to add an MCP server directly to your FastAPI application:\n\n```python\nfrom fastapi import FastAPI\nfrom fastapi_mcp import FastApiMCP\n\napp = FastAPI()\n\nmcp = FastApiMCP(app)\n\n# Mount the MCP server directly to your FastAPI app\nmcp.mount()\n```\n\nThat's it! Your auto-generated MCP server is now available at `https://app.base.url/mcp`.\n\n## Documentation, Examples and Advanced Usage\n\nFastAPI-MCP provides [comprehensive documentation](https://fastapi-mcp.tadata.com/). Additionaly, check out the [examples directory](examples) for code samples demonstrating these features in action.\n\n## FastAPI-first Approach\n\nFastAPI-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:\n\n- **Native dependencies**: Secure your MCP endpoints using familiar FastAPI `Depends()` for authentication and authorization\n\n- **ASGI transport**: Communicates directly with your FastAPI app using its ASGI interface, eliminating the need for HTTP calls from the MCP to your API\n\n- **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)\n\nThis design philosophy ensures minimum friction when adding MCP capabilities to your existing FastAPI services.\n\n\n## Development and Contributing\n\nThank you for considering contributing to FastAPI-MCP! We encourage the community to post Issues and create Pull Requests.\n\nBefore you get started, please see our [Contribution Guide](CONTRIBUTING.md).\n\n## Community\n\nJoin [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.\n\n## Requirements\n\n- Python 3.10+ (Recommended 3.12)\n- uv\n\n## License\n\nMIT License. Copyright (c) 2025 Tadata Inc.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 Tadata Inc.\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Automatic MCP server generator for FastAPI applications - converts FastAPI endpoints to MCP tools for LLM integration",
    "version": "0.3.7",
    "project_urls": {
        "Bug Tracker": "https://github.com/tadata-org/fastapi_mcp/issues",
        "Changelog": "https://github.com/tadata-org/fastapi_mcp/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/tadata-org/fastapi_mcp#readme",
        "Homepage": "https://github.com/tadata-org/fastapi_mcp",
        "PyPI": "https://pypi.org/project/fastapi-mcp/",
        "Source Code": "https://github.com/tadata-org/fastapi_mcp"
    },
    "split_keywords": [
        "ai",
        " api",
        " claude",
        " conversion",
        " fastapi",
        " llm",
        " mcp",
        " modelcontextprotocol",
        " openapi",
        " tools"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1f4fd622aa42273f79719a986caf585f956b6c70008a1d8ac45081274e3e5690",
                "md5": "25d3f1974bd16e451c1544f5a5c049eb",
                "sha256": "1d4561959d4cd6df0ed8836d380b74fd9969fd9400cb6f7ed5cbd2db2f39090c"
            },
            "downloads": -1,
            "filename": "fastapi_mcp-0.3.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "25d3f1974bd16e451c1544f5a5c049eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 23278,
            "upload_time": "2025-07-14T16:19:49",
            "upload_time_iso_8601": "2025-07-14T16:19:49.994717Z",
            "url": "https://files.pythonhosted.org/packages/1f/4f/d622aa42273f79719a986caf585f956b6c70008a1d8ac45081274e3e5690/fastapi_mcp-0.3.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f3b6dbad5a717d909562905a24fa78551b899df582276ff9b5f88c5494c9acf6",
                "md5": "e552940f67dac8496b599bd0d8a24078",
                "sha256": "35de3333355e4d0f44116a4fe70613afecd5e5428bb6ddbaa041b39b33781af8"
            },
            "downloads": -1,
            "filename": "fastapi_mcp-0.3.7.tar.gz",
            "has_sig": false,
            "md5_digest": "e552940f67dac8496b599bd0d8a24078",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 165767,
            "upload_time": "2025-07-14T16:19:51",
            "upload_time_iso_8601": "2025-07-14T16:19:51.196179Z",
            "url": "https://files.pythonhosted.org/packages/f3/b6/dbad5a717d909562905a24fa78551b899df582276ff9b5f88c5494c9acf6/fastapi_mcp-0.3.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-14 16:19:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tadata-org",
    "github_project": "fastapi_mcp",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "fastapi-mcp"
}
        
Elapsed time: 0.85610s