mrkeyoor.com_
Thu 17 Sept 07:00 UTC
AI Toolsevaluationupdated 26 Aug 2026

fastapi_mcp review

FastAPI-MCP turns selected routes from an existing FastAPI application into tools that an AI client can call through Model Context Protocol. It keeps request schemas, route documentation, and FastAPI dependencies in the path, which saves teams from maintaining a second tool server by hand.

+2stars / 7d
Verdict

Our FastAPI-MCP run finished with 12 of 66 tests passing, while 32 failed and 22 stopped during collection or setup, so a production trial needs its own end-to-end transport check. The idea is attractive for a FastAPI team with carefully selected routes, pinned dependencies, and explicit authentication. Do not use release 0.4.0 as a blind adapter over a sensitive API or assume it follows the current MCP Python SDK.

We ran it

Lab card: what happened when we ran fastapi_mcpScreenshot of fastapi_mcp (fastapi-mcp.tadata.com)
Install✓ · 28s70 packages · 71 MB
Build✓ · 8s
Tests✗ · 55s12 passed · 32 failed · 22 errors of 66 (pytest)
Known vulns0(pip-audit)
Repo84 files~6,154 lines of source · 0.6 MB · 2 CI workflows · tests dir

Answers from our run

Does fastapi_mcp build from source?

Dependencies installed in 28 seconds (70 packages), and the build succeeded in 8 seconds. We cloned commit e5cad13 into a clean Debian container with 3 CPUs and no project-specific setup.

Do fastapi_mcp's tests pass?

Not all of them: 12 of 66 passed and 32 failed when we ran the project's own test command (pytest), with 22 collection errors. Some failures need services or credentials a bare container does not have.

Does fastapi_mcp have known vulnerabilities in its dependencies?

pip-audit found none in the dependency tree at the time of our run.

Who should not use fastapi_mcp?

Teams that expect a current release to track MCP Python SDK 2.0: issue 323 asks for that support, while release 0.4.0 targets the older session model.

What are the alternatives to fastapi_mcp?

FastMCP, MCP Python SDK, OpenAPI MCP Server. Our FastAPI-MCP run finished with 12 of 66 tests passing, while 32 failed and 22 stopped during collection or setup, so a production trial needs its own end-to-end transport check.

Setup3/528-second install, but real transport tests did not start
Docs4/5Clear mounting, filtering, transport, and OAuth examples
Community4/511,986 stars and issue reports continued after the last code push
Maturity2/5Alpha package with transport failures and SDK compatibility gaps

Discussed on

  1. hnShow HN: FastAPI-MCP to expose FastAPI endpoints as MCP tools7 points
  2. hnShow HN: Open-source project to convert FastAPIs to MCP servers7 points

Who it’s for

FastAPI teams that want to expose a small, deliberate set of existing routes to MCP clients.
Python developers who want route schemas and FastAPI dependency checks reused in agent tools.
Operators who need Streamable HTTP or older SSE transport mounted beside an API or in a separate ASGI app.

Who it’s NOT for

Teams that expect a current release to track MCP Python SDK 2.0: issue 323 asks for that support, while release 0.4.0 targets the older session model.
APIs with recursive Pydantic models unless they test initialization first: issue 287 reports a startup-blocking RecursionError for a self-referencing schema.
Anyone who assumes mounting the server makes every tool private: the authentication guide makes the rejection dependency optional, and issue 324 reports anonymous HTTP tool access without AuthConfig.
Services that depend on top-level array bodies or repeated parameter names across path and body: issue 319 documents lost schemas and values in those cases.

Setup reality

Our sandbox install succeeded in 28 seconds, adding 70 packages and using 71 MB. The build passed in 8 seconds. Tests ended with exit code 1 after 55 seconds: 12 passed, 32 failed, and 22 hit collection or setup errors out of 66. Pip-audit found 0 known vulnerabilities.

Basic mounting needs Python 3.10 or newer plus an existing FastAPI app. Token passthrough uses the client's Authorization header; enforced rejection needs an AuthConfig dependency. Full OAuth also needs provider metadata, client credentials, scopes, callback setup, and often an mcp-remote bridge.

HTTP and SSE are both available, with HTTP recommended by the project. Our failing log repeatedly said the real HTTP and SSE test servers did not start after 20 attempts. The log does not establish why, so deployments should prove both startup and a real tool call in their own network environment.

Existing FastAPI routes become MCP tools

FastAPI-MCP reads a FastAPI application's OpenAPI information and exposes chosen operations as Model Context Protocol tools. Request models, response descriptions, operation IDs, tags, and FastAPI dependencies stay connected to the original routes. That is the useful part: a team can add an agent interface without copying every input schema into a second server. The MCP endpoint can live on the API application or on another FastAPI app.

Conversion still requires editorial judgment. The configuration accepts included or excluded operation IDs and tags, and the project's own best-practices page warns against exposing every route. It specifically advises caution with PUT and DELETE operations because a model can call the wrong tool. Automatic generation removes duplicate wiring, but it does not decide which business actions are safe for an agent.

HTTP is recommended, while SSE remains for older clients

Release 0.4.0 added Streamable HTTP and deprecated the generic mount() method in favor of mount_http() or mount_sse(). HTTP is the documented default, while SSE remains for compatibility. Both can mount at a custom path or on a router, and a separate deployment can run the source API and MCP app on different ports. This is a practical fit for teams already comfortable with ASGI routing.

Protocol age is now a concern. The last repository push was November 24, 2025, and the latest release was published July 28, 2025. Issue 323, opened in August 2026, asks for MCP Python SDK 2.0 support and says the current package assumes the older session lifecycle. The repository had 11,986 stars and 166 combined issues and pull requests when fetched, so interest is substantial even though the published line has not moved with recent SDK changes.

What happened when we ran it

Our sandbox installed commit e5cad13 in 28 seconds. It added 70 packages, occupied 71 MB, and built successfully in 8 seconds. Pip-audit reported 0 known vulnerabilities. The checkout itself contained 84 files and about 6,154 lines of source, with 2 CI workflow files and a tests directory but no Dockerfile.

The test step failed after 55 seconds. Pytest recorded 12 passed, 32 failed, and 22 collection or setup errors out of 66. The tail repeatedly named HTTP and SSE real-transport cases, each ending with RuntimeError: Server failed to start after 20 attempts. That message proves the test servers did not come up in our unprivileged Debian container. It does not say whether the block was networking, process startup, dependency behavior, or something else.

A passing build therefore answers only part of the adoption question. The package can be installed and assembled in a small environment, but our run did not establish a working client-to-tool round trip. Before attaching it to a real API, reproduce the intended transport with the exact Python and MCP dependency versions, then exercise initialization, tool listing, an authenticated call, and shutdown.

Authentication works only when you require it

The authentication guide supports simple token forwarding and a fuller OAuth 2 flow. Existing FastAPI dependencies can inspect the forwarded Authorization header. For OAuth, AuthConfig accepts issuer and authorization metadata, audience, client credentials, default scopes, and custom provider metadata. Compatibility proxies can fill gaps such as dynamic client registration, missing scopes, or audience values, while mcp-remote may need a fixed callback port.

The important default is easy to miss: rejecting requests with no Authorization header is optional. The guide tells users to add an AuthConfig dependency if they want that behavior. Issue 324 reports that an HTTP server mounted without AuthConfig allowed an anonymous client to initialize, list tools, and call a wrapped route. That report matches the documented configuration model, so a security review should treat MCP mounting and access control as separate changes.

Complex schemas need a conversion test before rollout

OpenAPI conversion is where convenience meets edge cases. Issue 319 reports that top-level arrays and primitive request bodies can disappear because conversion looks for object properties. The same report describes collisions when a path parameter and body field share a name: the path value is removed before the remaining arguments become the body. Either case can make a valid FastAPI route unusable through its generated tool.

Issue 287 covers a harsher failure. A self-referencing Pydantic model caused recursion during schema resolution and prevented the MCP server from starting, rather than dropping only the affected route. Issue 304 says optional list schemas can lose their items definition, leading clients including Claude Code to reject the tool. These are specific reasons to generate and inspect the tool catalog from your own application, especially if its models use recursive unions or nested optional collections.

The best fit is a narrow, pinned adapter

FastAPI-MCP is most convincing when an application already has a clean OpenAPI surface and the team wants a dozen read-oriented tools, not hundreds of raw routes. Its filters, direct ASGI calls, separate-app option, and reuse of FastAPI dependencies reduce repeated code. The MIT license also leaves teams free to inspect and patch the adapter while waiting for upstream releases.

Release 0.4.0 should be pinned alongside a compatible MCP SDK, and the generated schemas should become deploy-time artifacts that reviewers can compare. Our 32 failures and 22 setup errors make that discipline necessary, not ceremonial. If protocol currency matters more than route reuse, the official SDK or FastMCP gives you more control. If route reuse wins, keep the exposed set small and make unauthenticated calls part of the acceptance test.

Alternatives

ProjectWhat it isPick it when
FastMCP gh↗A Python framework for writing MCP servers and clients directly.pick this instead when the MCP interface deserves its own explicit tool design rather than automatic conversion from FastAPI routes.
MCP Python SDK gh↗The official Python implementation for MCP clients and servers.pick this instead when protocol currency and direct control matter more than FastAPI route conversion.
OpenAPI MCP ServerA generic OpenAPI-to-MCP adapter can sit in front of APIs written in any framework.pick this instead when your service fleet is not centered on FastAPI or you cannot load the application object in the MCP process.

Sources

  1. FastAPI-MCP README
  2. FastAPI-MCP authentication guide
  3. FastAPI-MCP v0.4.0 release
  4. Issue 323: MCP Python SDK v2 support
  5. Issue 324: unauthenticated HTTP access report
  6. Issue 319: request body conversion
  7. Issue 287: recursive schema crash

More ai tools reviews

yolov5 · eve · MemOS · LongCat-Video · Concat · DLSS5-Feeder · the whole board →