Skip to main content
Glama

FastAPI-MCP

by tadata-org

Merkmale

  • Integrierte Authentifizierung unter Verwendung Ihrer vorhandenen FastAPI-Abhängigkeiten!
  • FastAPI-native: Nicht nur ein weiterer OpenAPI -> MCP-Konverter
  • Keine/minimale Konfiguration erforderlich – richten Sie es einfach auf Ihre FastAPI-App und es funktioniert
  • Beibehalten der Schemata Ihrer Anforderungs- und Antwortmodelle
  • Bewahren Sie die Dokumentation aller Ihrer Endpunkte auf, genau wie in Swagger
  • Flexible Bereitstellung – Binden Sie Ihren MCP-Server in dieselbe App ein oder stellen Sie ihn separat bereit
  • ASGI-Transport - Nutzt die ASGI-Schnittstelle von FastAPI direkt für eine effiziente Kommunikation

Installation

Wir empfehlen die Verwendung von uv , einem schnellen Python-Paketinstallationsprogramm:

uv add fastapi-mcp

Alternativ können Sie mit pip installieren:

pip install fastapi-mcp

Grundlegende Verwendung

Die einfachste Möglichkeit, FastAPI-MCP zu verwenden, besteht darin, Ihrer FastAPI-Anwendung direkt einen MCP-Server hinzuzufügen:

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

Das war's! Ihr automatisch generierter MCP-Server ist jetzt unter https://app.base.url/mcp verfügbar.

Dokumentation, Beispiele und erweiterte Nutzung

FastAPI-MCP bietet eine umfassende Dokumentation . Im Beispielverzeichnis finden Sie außerdem Codebeispiele, die diese Funktionen in Aktion demonstrieren.

FastAPI-First-Ansatz

FastAPI-MCP ist als native Erweiterung von FastAPI konzipiert und nicht nur als Konverter, der MCP-Tools aus Ihrer API generiert. Dieser Ansatz bietet mehrere wichtige Vorteile:

  • Native Abhängigkeiten : Sichern Sie Ihre MCP-Endpunkte mit vertrauten FastAPI Depends() zur Authentifizierung und Autorisierung
  • ASGI-Transport : Kommuniziert direkt mit Ihrer FastAPI-App über die ASGI-Schnittstelle, sodass keine HTTP-Aufrufe vom MCP an Ihre API erforderlich sind
  • Einheitliche Infrastruktur : Ihre FastAPI-App muss nicht separat vom MCP-Server ausgeführt werden (obwohl auch eine separate Bereitstellung unterstützt wird).

Diese Designphilosophie gewährleistet minimale Reibung beim Hinzufügen von MCP-Funktionen zu Ihren vorhandenen FastAPI-Diensten.

Entwicklung und Mitwirkung

Vielen Dank, dass Sie zu FastAPI-MCP beitragen möchten! Wir ermutigen die Community, Probleme zu melden und Pull Requests zu erstellen.

Bevor Sie beginnen, lesen Sie bitte unseren Beitragsleitfaden .

Gemeinschaft

Treten Sie der MCParty Slack-Community bei, um sich mit anderen MCP-Enthusiasten zu vernetzen, Fragen zu stellen und Ihre Erfahrungen mit FastAPI-MCP zu teilen.

Anforderungen

  • Python 3.10+ (empfohlen 3.12)
  • UV

Lizenz

MIT-Lizenz. Copyright (c) 2024 Tadata Inc.

-
security - not tested
A
license - permissive license
-
quality - not tested

Ein Tool ohne Konfiguration, das FastAPI-Endpunkte automatisch als Model Context Protocol (MCP)-Tools verfügbar macht, sodass LLM-Systeme wie Claude ohne zusätzliche Codierung mit Ihrer API interagieren können.

  1. Installation
    1. Grundlegende Verwendung
      1. Dokumentation, Beispiele und erweiterte Nutzung
        1. FastAPI-First-Ansatz
          1. Entwicklung und Mitwirkung
            1. Gemeinschaft
              1. Anforderungen
                1. Lizenz

                  Related MCP Servers

                  • -
                    security
                    F
                    license
                    -
                    quality
                    A MCP server that exposes OpenAPI schema information to LLMs like Claude. This server allows an LLM to explore and understand large OpenAPI schemas through a set of specialized tools, without needing to load the whole schema into the context
                    Last updated -
                    37
                    5
                    JavaScript
                    • Apple
                    • Linux
                  • -
                    security
                    F
                    license
                    -
                    quality
                    A simple application demonstrating Model Context Protocol (MCP) integration with FastAPI and Streamlit, allowing users to interact with LLMs through a clean interface.
                    Last updated -
                    3
                    Python
                    • Linux
                  • A
                    security
                    A
                    license
                    A
                    quality
                    A Model Context Protocol server that loads multiple OpenAPI specifications and exposes them to LLM-powered IDE integrations, enabling AI to understand and work with your APIs directly in development tools like Cursor.
                    Last updated -
                    7
                    292
                    7
                    TypeScript
                    MIT License
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A zero-configuration tool that automatically converts FastAPI endpoints into Model Context Protocol (MCP) tools, enabling AI systems to interact with your API through natural language.
                    Last updated -
                    1
                    Python
                    MIT License

                  View all related MCP servers

                  MCP directory API

                  We provide all the information about MCP servers via our MCP API.

                  curl -X GET 'https://glama.ai/api/mcp/v1/servers/tadata-org/fastapi_mcp'

                  If you have feedback or need assistance with the MCP directory API, please join our Discord server