ZE

Zero Config FastAPI to MCP Server

Expose FastAPI endpoints instantly as MCP server tools with zero configuration using Tadata, automating deployment and integration for faster development.

Quick Install
npx -y @tadata-org/fastapi_mcp

Overview

Zero Config FastAPI to MCP Server is a lightweight integration that automatically exposes your existing FastAPI endpoints as MCP (Model Context Protocol) tools for the Tadata platform. Instead of writing separate adapters or tool definitions, this package inspects your FastAPI app and generates MCP-compatible tool endpoints so model-driven workflows and toolchains can call your HTTP endpoints directly.

This approach speeds up development by removing boilerplate: you keep writing FastAPI routes as usual, and the integration handles mapping routes to MCP tools, registering metadata, and serving the MCP tool interface. It’s intended for developers who want to turn internal APIs into callable model tools quickly for prototyping, testing, or production workflows.

Features

  • Zero-configuration exposure of FastAPI routes as MCP tools
  • Automatic extraction of path, method, and JSON input/output shapes
  • Integration-ready with the Tadata MCP ecosystem
  • Works with existing FastAPI apps — no special route definitions required
  • Can be run directly alongside uvicorn or in containerized environments
  • Environment-driven configuration for deployment and credentials

Installation / Configuration

Install the package and its common dependencies:

pip install fastapi-mcp fastapi uvicorn tadata

Basic usage pattern (example):

# app.py
from fastapi import FastAPI
from fastapi_mcp import expose_mcp  # wrapper that registers MCP tools

app = FastAPI()

@app.post("/summarize")
async def summarize(payload: dict):
    text = payload.get("text", "")
    return {"summary": text[:100]}

# Expose all FastAPI routes as MCP tools (zero config)
expose_mcp(app)

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

Run:

python app.py

Environment variables commonly used:

VariablePurpose
TADATA_API_KEYAPI key for Tadata/Tadata MCP service
MCP_HOSTOptional override for the MCP server/registry host
PORTPort to run the FastAPI app (default often 8000)

Example Dockerfile:

FROM python:3.11-slim
WORKDIR /app
COPY pyproject.toml ./
RUN pip install --no-cache-dir fastapi-mcp uvicorn
COPY . .
CMD ["python", "app.py"]

Note: replace package names/versions to match your environment. The integration is intended to be minimal — most configuration is via environment variables or Tadata credentials when registering tools.

Available Resources

  • GitHub: https://github.com/tadata-org/fastapi_mcp — source, issues, and examples
  • Tadata docs (for MCP): consult your Tadata account or docs for MCP details and API keys

How endpoints map to MCP tools (conceptual):

FastAPI routeHTTP methodMCP tool name (derived)Input
/summarizePOSTsummarizeJSON body as dict
/items/{id}GETitems_getpath params + query params

The library extracts route metadata (path, method, request/response signatures) and registers an MCP tool entry per route so models can invoke them as tools.

Use Cases

  • Rapid prototyping: Convert internal FastAPI endpoints into callable tools for LLM-based agents without writing glue code.
    • Example: expose a /search POST endpoint so an assistant can fetch and summarize search results directly.
  • Internal developer tooling: Turn existing microservice endpoints into MCP tools for shared automation across teams.
    • Example: billing APIs can be exposed as tools for automated reconciliation scripts driven by models.
  • Testing and evaluation: Quickly create tool-equipped model evaluation harnesses that call your APIs automatically.
    • Example: run prompt-based tests that invoke your /translate endpoint as a tool and verify outputs.
  • Production integrations: Use the same FastAPI app in production while the MCP layer provides controlled tool access and telemetry for models.

Troubleshooting & Tips

  • Validate that your endpoints accept and return JSON-compatible payloads; MCP tool calls generally pass JSON data.
  • If a route uses complex Pydantic models, ensure they have clear JSON schemas so tooling can infer input shapes.
  • Use environment variables to separate local development credentials from production keys.
  • Monitor your FastAPI logs and MCP registry (Tadata dashboard) to ensure tools are registered and calls are routed properly.

For full details, example projects, and the latest updates, see the GitHub repository: https://github.com/tadata-org/fastapi_mcp.