PromptisePromptise
PlatformSoonEnterprise
DocsGitHub
Talk to usGet started
Promptise - AI Framework LogoPromptise

The full-stack framework for agentic systems. Build with the framework. Run it on the platform. Launch it with our engineers.

pip install promptise

[01] Product

  • Framework
  • Platform (coming soon)
  • Enterprise
  • How it works
  • Contact

[02] Framework

  • The Agent
  • The Interface
  • The Harness

[03] Resources

  • Documentation
  • GitHub
  • Why Promptise
  • Use cases
  • Roadmap
  • Guides
  • Learning Paths
  • Questions

[04] Company

  • About
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Subprocessors

© 2026 Promptise by Manser Ventures. All rights reserved.

hello@promptise.com
← Learning paths> Agentic Engineering with Promptise Foundry
Lesson 35 / 100
35%

FastMCP Alternatives for Production MCP Servers (2026)

FastMCP alternatives compared: the official MCP Python and TypeScript SDKs, Promptise Foundry and more, for auth, multi-tenancy, observability and deploys.

Intermediate16 minModel Context Protocol (MCP)AI Agent FrameworksAuthentication and Access ControlMulti-Tenancy
All 100 lessons↓
  1. ✓What Is an AI Agent? Definition, How It Works, Examples
  2. ✓How to Build an AI Agent in Python (2026 Guide)
  3. ✓Build a Personal AI Agent: Memory, Reminders, Chat
  4. ✓What Is an Agent Harness? Parts and How to Build One
  5. ✓System Prompt Best Practices for AI Agents in Python
  6. ✓Best LLM for AI Agents (2026): Picks, Prices, How to Test
  7. ✓AI Agent YAML: Define and Run an Agent From a Config File
  8. ✓Streaming LLM Responses with FastAPI: Tokens and Tool Calls
  9. ✓Best Local LLM for AI Agents: Ollama Models by GPU (2026)
  10. ✓Claude AI Agent with MCP: Use Anthropic Models in Promptise
  11. ✓Gemini AI Agent with MCP: Use Google Models in Promptise
  12. ✓Azure OpenAI Agent with MCP: Use Deployments in Promptise
  13. ✓OpenRouter AI Agent with MCP: Many Models in Promptise
  14. ✓Ollama AI Agent with MCP: Run Local Models in Promptise
  15. ✓LLM Semantic Cache and Model Fallback in Python
  16. ✓What Is MCP (Model Context Protocol)? A Developer's Guide
  17. ✓What Is Tool Calling? LLM Function Calling Explained
  18. ✓MCP Tools vs Resources vs Prompts (With Python Examples)
  19. ✓How to Connect MCP Servers to Your AI Agent in Python
  20. ✓Build a Production MCP Server in Python (Step by Step)
  21. ✓MCP Transports: stdio vs Streamable HTTP vs SSE (Python)
  22. ✓MCP 2026-07-28 Migration: Make Your MCP Server Stateless
  23. ✓OpenAPI to MCP: Turn Any REST API into an MCP Server
  24. ✓MCP Authentication in Python: API Keys, JWT and OAuth
  25. ✓Build an Authenticated MCP Server for Your AI Agent (Python)
  26. ✓MCP Security Best Practices: A Checklist for MCP Servers
  27. ✓Testing MCP Servers in Python: pytest Without a Live Server
  28. ✓Too Many MCP Tools? How to Fix LLM Tool Selection in Python
  29. ✓Idempotent Tool Calls: Make AI Agent Retries Safe
  30. ✓AI Agent Tool Failures: Stop Unsafe Workarounds
  31. ✓MCP Server Caching, Timeouts and Circuit Breakers in Python
  32. ✓MCP Middleware for Servers: Auth, Logging, Rate Limits
  33. ✓MCP vs CLI for AI Agents: Tokens, Security, When to Use Each
  34. ✓LangChain vs MCP: Differences and How They Work Together
  35. 35FastMCP Alternatives for Production MCP Servers (2026)
  36. 36AI Agent Audit Logging: Tamper-Evident Logs in Python
  37. 37AI Agent Human in the Loop: Approve Tool Calls in Python
  38. 38AI Agent Prompt Injection: How to Defend Against It
  39. 39Hidden Text Prompt Injection: Sanitize Pages for AI Agents
  40. 40Build a Multi-Agent System in Python (and When Not To)
  41. 41Context Engineering for AI Agents: Context Window Management
  42. 42Context Compaction for AI Agents: Trim vs Summarize
  43. 43How to Deploy an AI Agent with Docker (2026 Guide)
  44. 44LLM Tool Rate Limiting: Per-Client Limits for MCP Servers
  45. 45MCP Long-Running Tasks: Background Jobs in Python
  46. 46MCP Server Monitoring: Prometheus, OpenTelemetry and Logs
  47. 47Best AI Agent Frameworks (2026): Python Options Compared
  48. 48Self-Improving AI Agent: Learn From Tool Failures in Python
  49. 49AI Agent Identity: Authenticate Agents to MCP Servers
  50. 50Code-Action Agents in Python: One Program vs 37 Tool Calls
  51. 51Multi-Tenant AI Agents: Keep Each Customer's Data Apart
  52. 52What Is Agentic RAG? How It Differs from Classic RAG
  53. 53AI Agent Memory in Python: Short-Term and Long-Term
  54. 54Per-User Agent Memory Isolation: Stop Leaks Between Users
  55. 55Agentic RAG in Python: Give Your AI Agent a Search Tool
  56. 56AI Agent Reasoning Patterns in Python: From ReAct to Debate
  57. 57Plan-and-Execute Agents in Python: Beyond the ReAct Loop
  58. 58Self-Modifying AI Agent in Python: Open Mode & Limits
  59. 59CrewAI Alternatives: 7 Options and How to Migrate (2026)
  60. 60Migrate from AutoGen: Agent Framework, AG2 and More
  61. 61What Is an LLM Guardrail? Types, Examples and Limits
  62. 62Best LLM Guardrails Tools (2026): 9 Platforms Compared
  63. 63AI Agent Guardrails in Python: Block Injection, Redact PII
  64. 64NeMo Guardrails vs Guardrails AI: Which to Choose (2026)
  65. 65AI-Based PII Detection and Redaction Tools for LLM Apps
  66. 66Stop Secrets Leaking Into LLM Logs and Traces
  67. 67AI Agent Code Execution Sandbox: Run LLM Code Safely
  68. 68AI Agent Network Egress: Limit Where Agents Can Connect
  69. 69AutoGen Docker Task Isolation: Secure the Code Executor
  70. 70SPIFFE for AI Agents: Workload Identity Without API Keys
  71. 71On-Behalf-Of Auth for AI Agents: Act as Each User
  72. 72AI Agent Production Checklist: What to Check Before Launch
  73. 73Approval Fatigue: Auto-Approve Safe AI Agent Actions
  74. 74What Is Human in the Loop AI? Approvals for AI Agents
  75. 75AI Agent Notifications: Webhook and Slack Alerts in Python
  76. 76AI Agent Observability: Trace Tool Calls, Tokens and Cost
  77. 77Best AI Agent Observability Tools (2026), Compared
  78. 78AI Agent Stuck in a Loop? How to Detect and Stop It
  79. 79How to Run, Debug and Deploy an AI Agent in Python
  80. 80AI Agent Cost Tracking: Tokens and Cost per Run and User
  81. 81How to Evaluate AI Agents: Evals, LLM Judges and pass^k
  82. 82AI Agent Cost Control: Budgets That Stop Runaway Spend
  83. 83How to Test LLM Prompts and AI Agents in Python
  84. 84AI Agent Evals in CI: Run Them on Every Pull Request
  85. 85What Is an Agentic Runtime? AI Agent Runtimes Explained
  86. 86Autonomous AI Agent Runtime: Budgets, Crash Recovery, API
  87. 87Event-Driven AI Agents: Webhook, Cron and File Triggers
  88. 88AI Agent Cron Jobs: Run an Agent on a Schedule
  89. 89AI Agent Webhook Trigger: Run an Agent on HTTP Events
  90. 90AI Agent File Watcher: Process New Files Automatically
  91. 91Custom AI Agent Triggers: Wake an Agent From Any Source
  92. 92AI Agent Event Filters: Skip Runs Before the LLM
  93. 93AI Agent Retries and a Dead Letter Queue for Failed Runs
  94. 94Run Multiple AI Agents: One Runtime, Many Processes
  95. 95AI Agent Manifest: Declare a Long-Running Agent in YAML
  96. 96AI Agent CLI: Start, Stop and Inspect Running Agents
  97. 97AI Agent Monitoring Dashboard in the Terminal
  98. 98Multi-Agent Event Bus: Chain Agents With Events
  99. 99Distributed AI Agents: Run Agents Across Many Machines
  100. 100Pause and Resume an AI Agent: Lifecycle States Explained

Lessons in this path

  1. ✓What Is an AI Agent? Definition, How It Works, Examples
  2. ✓How to Build an AI Agent in Python (2026 Guide)
  3. ✓Build a Personal AI Agent: Memory, Reminders, Chat
  4. ✓What Is an Agent Harness? Parts and How to Build One
  5. ✓System Prompt Best Practices for AI Agents in Python
  6. ✓Best LLM for AI Agents (2026): Picks, Prices, How to Test
  7. ✓AI Agent YAML: Define and Run an Agent From a Config File
  8. ✓Streaming LLM Responses with FastAPI: Tokens and Tool Calls
  9. ✓Best Local LLM for AI Agents: Ollama Models by GPU (2026)
  10. ✓Claude AI Agent with MCP: Use Anthropic Models in Promptise
  11. ✓Gemini AI Agent with MCP: Use Google Models in Promptise
  12. ✓Azure OpenAI Agent with MCP: Use Deployments in Promptise
  13. ✓OpenRouter AI Agent with MCP: Many Models in Promptise
  14. ✓Ollama AI Agent with MCP: Run Local Models in Promptise
  15. ✓LLM Semantic Cache and Model Fallback in Python
  16. ✓What Is MCP (Model Context Protocol)? A Developer's Guide
  17. ✓What Is Tool Calling? LLM Function Calling Explained
  18. ✓MCP Tools vs Resources vs Prompts (With Python Examples)
  19. ✓How to Connect MCP Servers to Your AI Agent in Python
  20. ✓Build a Production MCP Server in Python (Step by Step)
  21. ✓MCP Transports: stdio vs Streamable HTTP vs SSE (Python)
  22. ✓MCP 2026-07-28 Migration: Make Your MCP Server Stateless
  23. ✓OpenAPI to MCP: Turn Any REST API into an MCP Server
  24. ✓MCP Authentication in Python: API Keys, JWT and OAuth
  25. ✓Build an Authenticated MCP Server for Your AI Agent (Python)
  26. ✓MCP Security Best Practices: A Checklist for MCP Servers
  27. ✓Testing MCP Servers in Python: pytest Without a Live Server
  28. ✓Too Many MCP Tools? How to Fix LLM Tool Selection in Python
  29. ✓Idempotent Tool Calls: Make AI Agent Retries Safe
  30. ✓AI Agent Tool Failures: Stop Unsafe Workarounds
  31. ✓MCP Server Caching, Timeouts and Circuit Breakers in Python
  32. ✓MCP Middleware for Servers: Auth, Logging, Rate Limits
  33. ✓MCP vs CLI for AI Agents: Tokens, Security, When to Use Each
  34. ✓LangChain vs MCP: Differences and How They Work Together
  35. 35FastMCP Alternatives for Production MCP Servers (2026)
  36. 36AI Agent Audit Logging: Tamper-Evident Logs in Python
  37. 37AI Agent Human in the Loop: Approve Tool Calls in Python
  38. 38AI Agent Prompt Injection: How to Defend Against It
  39. 39Hidden Text Prompt Injection: Sanitize Pages for AI Agents
  40. 40Build a Multi-Agent System in Python (and When Not To)
  41. 41Context Engineering for AI Agents: Context Window Management
  42. 42Context Compaction for AI Agents: Trim vs Summarize
  43. 43How to Deploy an AI Agent with Docker (2026 Guide)
  44. 44LLM Tool Rate Limiting: Per-Client Limits for MCP Servers
  45. 45MCP Long-Running Tasks: Background Jobs in Python
  46. 46MCP Server Monitoring: Prometheus, OpenTelemetry and Logs
  47. 47Best AI Agent Frameworks (2026): Python Options Compared
  48. 48Self-Improving AI Agent: Learn From Tool Failures in Python
  49. 49AI Agent Identity: Authenticate Agents to MCP Servers
  50. 50Code-Action Agents in Python: One Program vs 37 Tool Calls
  51. 51Multi-Tenant AI Agents: Keep Each Customer's Data Apart
  52. 52What Is Agentic RAG? How It Differs from Classic RAG
  53. 53AI Agent Memory in Python: Short-Term and Long-Term
  54. 54Per-User Agent Memory Isolation: Stop Leaks Between Users
  55. 55Agentic RAG in Python: Give Your AI Agent a Search Tool
  56. 56AI Agent Reasoning Patterns in Python: From ReAct to Debate
  57. 57Plan-and-Execute Agents in Python: Beyond the ReAct Loop
  58. 58Self-Modifying AI Agent in Python: Open Mode & Limits
  59. 59CrewAI Alternatives: 7 Options and How to Migrate (2026)
  60. 60Migrate from AutoGen: Agent Framework, AG2 and More
  61. 61What Is an LLM Guardrail? Types, Examples and Limits
  62. 62Best LLM Guardrails Tools (2026): 9 Platforms Compared
  63. 63AI Agent Guardrails in Python: Block Injection, Redact PII
  64. 64NeMo Guardrails vs Guardrails AI: Which to Choose (2026)
  65. 65AI-Based PII Detection and Redaction Tools for LLM Apps
  66. 66Stop Secrets Leaking Into LLM Logs and Traces
  67. 67AI Agent Code Execution Sandbox: Run LLM Code Safely
  68. 68AI Agent Network Egress: Limit Where Agents Can Connect
  69. 69AutoGen Docker Task Isolation: Secure the Code Executor
  70. 70SPIFFE for AI Agents: Workload Identity Without API Keys
  71. 71On-Behalf-Of Auth for AI Agents: Act as Each User
  72. 72AI Agent Production Checklist: What to Check Before Launch
  73. 73Approval Fatigue: Auto-Approve Safe AI Agent Actions
  74. 74What Is Human in the Loop AI? Approvals for AI Agents
  75. 75AI Agent Notifications: Webhook and Slack Alerts in Python
  76. 76AI Agent Observability: Trace Tool Calls, Tokens and Cost
  77. 77Best AI Agent Observability Tools (2026), Compared
  78. 78AI Agent Stuck in a Loop? How to Detect and Stop It
  79. 79How to Run, Debug and Deploy an AI Agent in Python
  80. 80AI Agent Cost Tracking: Tokens and Cost per Run and User
  81. 81How to Evaluate AI Agents: Evals, LLM Judges and pass^k
  82. 82AI Agent Cost Control: Budgets That Stop Runaway Spend
  83. 83How to Test LLM Prompts and AI Agents in Python
  84. 84AI Agent Evals in CI: Run Them on Every Pull Request
  85. 85What Is an Agentic Runtime? AI Agent Runtimes Explained
  86. 86Autonomous AI Agent Runtime: Budgets, Crash Recovery, API
  87. 87Event-Driven AI Agents: Webhook, Cron and File Triggers
  88. 88AI Agent Cron Jobs: Run an Agent on a Schedule
  89. 89AI Agent Webhook Trigger: Run an Agent on HTTP Events
  90. 90AI Agent File Watcher: Process New Files Automatically
  91. 91Custom AI Agent Triggers: Wake an Agent From Any Source
  92. 92AI Agent Event Filters: Skip Runs Before the LLM
  93. 93AI Agent Retries and a Dead Letter Queue for Failed Runs
  94. 94Run Multiple AI Agents: One Runtime, Many Processes
  95. 95AI Agent Manifest: Declare a Long-Running Agent in YAML
  96. 96AI Agent CLI: Start, Stop and Inspect Running Agents
  97. 97AI Agent Monitoring Dashboard in the Terminal
  98. 98Multi-Agent Event Bus: Chain Agents With Events
  99. 99Distributed AI Agents: Run Agents Across Many Machines
  100. 100Pause and Resume an AI Agent: Lifecycle States Explained
← Path overview

A FastMCP alternative is worth a look when your MCP server grows past a handful of tools and starts to need auth, tenant isolation, metrics and a deployment story. This guide is for developers who build MCP servers with FastMCP and want to know what else is there in 2026: the official MCP SDKs, Promptise Foundry, FastAPI-MCP and a few TypeScript frameworks. You get a comparison table, the same server written in five of them, and a clear answer on when to stay with FastMCP. Promptise Foundry is made by the team behind this site. Every claim about the other tools was checked against their own docs and repositories between October 21 and 24, 2026.

[01]

What is the best FastMCP alternative?

There is no single best one. It depends on what you need that FastMCP doesn't give you, or gives you in a way you don't like:

If you need

Use

Why

The protocol reference with few dependencies

Official MCP Python SDK 2 (MCPServer)

FastMCP's original API, maintained by the MCP project

Tenant-scoped rate limits and caches, a signed audit log and Prometheus metrics built in

Promptise Foundry

Its middleware reads the tenant from the auth context; young project, small community

To expose an existing FastAPI app

FastAPI-MCP, or FastMCP's own from_fastapi

Turns routes into tools

TypeScript, Node or edge runtimes

Official TypeScript SDK 2, xmcp, mcp-handler

Same protocol, JavaScript ecosystem

Go, Java, C# or Rust

The official SDK for that language

First-party and spec-aligned

OAuth providers, proxies for remote servers, the largest community

Stay with FastMCP

Nothing else in Python has as much of this

  • "FastMCP" means two things. The class in the official SDK, renamed MCPServer in mcp 2.0 (July 2026), and Prefect's standalone fastmcp package, at 4.1 in October 2026.

  • All of them speak the same protocol. One client called all five servers in this guide. The differences are the protocol revision, auth and operations features.

  • FastMCP 4 is not missing much. OAuth providers, authorization, middleware, OpenTelemetry and background tasks are built in. It has no built-in tenant model, circuit breaker, signed audit log or Prometheus metrics.

  • Switching costs sit in auth and middleware, not in tools. A tool function moves with a decorator change.

  • Watch the mcp pin. FastMCP 4 needs mcp 2.x and FastAPI-MCP needs mcp 1.x, so those two can't share an environment. Promptise Foundry runs on either since 1.5.1.


[02]

What is FastMCP, and which one are you using?

Jeremiah Lowin started FastMCP in 2024 as a high-level Python API for MCP servers. The official MCP Python SDK adopted it, and the project continued separately under Prefect. That history explains most of the confusion in search results:

Two version lines side by side: FastMCP 1.0 was adopted into the official MCP Python SDK in 2024, and mcp 2.0 (2026-07) turned its FastMCP class into MCPServer. The standalone fastmcp went from 2.x (2025) to 3.0, 4.0 on mcp 2.x, and 4.1.2 and 3.4.10 in 2026-10.
FigureThe FastMCP timeline: the official SDK line and the standalone fastmcp line

So check your import:

  • from fastmcp import FastMCP is the standalone framework (Apache-2.0, maintained by Prefect). It is the one the FastMCP docs at gofastmcp.com describe, and it is a full framework: servers, clients, auth, composition, proxies, OpenAPI generation, and apps.

  • from mcp.server.fastmcp import FastMCP is the SDK's class in mcp 1.x. In mcp 2.x the import fails with ModuleNotFoundError and points you to MCPServer.

  • The npm package fastmcp is a different project: a TypeScript framework by another author, unrelated to Prefect's. Prefect's own TypeScript port is @prefecthq/fastmcp-ts.

MCP itself is the protocol between an AI app (the client) and a server that exposes tools, resources and prompts. Every framework here produces a server that any MCP client can use. If MCP is new to you, start with what is the Model Context Protocol.


[03]

How do production MCP server frameworks compare?

The examples ran on the versions in this table. Claims about each project come from its docs, package source and release notes, checked between October 21 and 24, 2026. "Your code" means the framework gives you the token claims and you build the rest.

FastMCP 4.1

MCP Python SDK 2.3

Promptise Foundry 1.10.1

TypeScript SDK 2.4

FastAPI-MCP 0.4

Language

Python

Python

Python

TypeScript

Python

Maintainer

Prefect

MCP project

Promptise

MCP project

Tadata

License

Apache-2.0

MIT

Apache-2.0

Apache-2.0 (v2 packages; older code MIT)

MIT

Newest protocol revision

2026-07-28

2026-07-28

2026-07-28 on mcp 2.x, 2025-11-25 on mcp 1.x

2026-07-28

2025-11-25 (mcp 1.x)

Tool API

@mcp.tool

@mcp.tool()

@server.tool()

registerTool with Zod

FastAPI routes

Authentication

JWT and JWKS, OAuth proxy, full OAuth server, about 15 provider classes

Token verifier, OAuth server provider

JWT (HS256, asymmetric, JWKS), API keys, dev token endpoint

requireBearerAuth, resource metadata

FastAPI dependencies

Authorization

Scopes, roles, tags

Required scopes

Roles, scopes, guards

Scopes per tool

FastAPI dependencies

Multi-tenancy

Your code

Your code

Tenant from a token claim; rate limits, cache and audit are tenant-scoped

Your code

Your code

Rate limiting

Token bucket or sliding window, per client with get_client_id

Not built in

Per client and tenant, optionally per tool

Not built in

Not built in

Resilience

Retry, error handling, response limits

Not built in

Circuit breaker, timeouts, concurrency limits

Not built in

Not built in

Observability

OpenTelemetry traces on by default, logging and structured logging, timing

OpenTelemetry on by default

OpenTelemetry, Prometheus, structured logs, HMAC-chained audit log, dashboard

Not built in

Through FastAPI

Deployment

run(), ASGI app, fastmcp CLI, Prefect Horizon

run(), ASGI apps

run() with health probes, ASGI app

Node, Express, Hono, Fastify, Workers

Inside your FastAPI app

GitHub stars

about 28,000

about 25,000

under 1,000

about 14,000

about 12,000

FastMCP leads on breadth: OAuth providers, proxies for remote servers, providers and transforms, and the biggest community by far. The official SDKs lead on protocol fidelity and have the fewest dependencies. Promptise Foundry builds in more operations features that FastMCP leaves to you, such as tenant-scoped middleware, circuit breakers and signed audit logs, and trails far behind on community size. FastAPI-MCP is the quickest way to put an existing FastAPI app behind MCP, but its last release was in July 2025.


[04]

When to stay with FastMCP (and when to switch)

Stay with FastMCP when:

  • You rely on its auth integrations. The OAuth proxy and provider classes (GitHub, Google, Azure, WorkOS, Auth0, Keycloak and more) save real work.

  • You proxy remote servers or lean on providers. create_proxy() fronts any MCP server, and transforms such as tool search go further than in other Python frameworks.

  • You want the newest protocol revision first. FastMCP 4 tracks the SDK's 2.x line.

  • Your team values community. Most MCP tutorials and answers online use FastMCP.

Switch, or add a layer, when:

  • You want the tenant handled by the middleware. In FastMCP your code passes the tenant to each rate limiter, cache key and log entry that needs it. In any framework, each tool still has to filter its own data by tenant.

  • You need operations features you would otherwise build: a circuit breaker per downstream service, a tamper-evident audit log or Prometheus metrics.

  • You want the smallest dependency tree. The official SDK is what FastMCP builds on.

  • Your stack is TypeScript or another language. Use that language's official SDK.

Rewriting a working FastMCP server only to change frameworks rarely pays off. Middleware and auth code is where the migration effort is, so compare the production features you would use, not the hello-world.


[05]

What you need

  • Python 3.10 or later. The examples ran on Python 3.12.

  • A virtual environment for the FastMCP, SDK and Promptise servers, on mcp 2.x: pip install "fastmcp==4.1.2" "mcp==2.3.0" "promptise==1.10.1" pyjwt (pyjwt is for step 6).

  • A second one for FastAPI-MCP, which needs mcp 1.x: pip install "fastapi-mcp==0.4.0" "mcp<2" uvicorn.

  • Node.js 20 or later for the TypeScript server. The example ran on Node 24.

  • About 20 minutes. No API key is needed: there is no model in this guide.


[06]

Step 1: Write the server in FastMCP and the official SDK

Steps 1 to 4 write the same tool, get_order_status, and serve it over Streamable HTTP. Here it is in FastMCP 4:

Pythonfastmcp_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
from fastmcp import FastMCP

mcp = FastMCP("orders")


@mcp.tool
def get_order_status(order_id: str) -> dict:
    """Get the shipping status of an order."""
    return {"order_id": order_id, "status": "shipped", "server": "FastMCP 4"}


if __name__ == "__main__":
    mcp.run(transport="http", port=8101)  # http://127.0.0.1:8101/mcp

And in the official MCP Python SDK 2. The code is almost identical, because this is the API FastMCP 1.0 gave the SDK:

Pythonsdk_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
from mcp.server.mcpserver import MCPServer  # mcp 2.x; in mcp 1.x: from mcp.server.fastmcp import FastMCP

mcp = MCPServer("orders")


@mcp.tool()
def get_order_status(order_id: str) -> dict:
    """Get the shipping status of an order."""
    return {"order_id": order_id, "status": "shipped", "server": "MCP Python SDK 2"}


if __name__ == "__main__":
    mcp.run(transport="streamable-http", port=8102)  # http://127.0.0.1:8102/mcp

Two differences matter when you port code. The SDK's decorator needs parentheses: a bare @mcp.tool raises TypeError: The @tool decorator was used incorrectly. Did you forget to call it? Use @tool() instead of @tool. And the SDK uses transport="streamable-http" where FastMCP accepts "http". Both serve at /mcp.


[07]

Step 2: Write it with Promptise Foundry

Promptise Foundry's MCP server is a separate implementation built on the official SDK's low-level server (mcp 1.x or 2.x). The tool code is the same shape:

Pythonpromptise_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
from promptise.mcp.server import MCPServer

server = MCPServer(name="orders", version="1.0.0")


@server.tool()
async def get_order_status(order_id: str) -> dict:
    """Get the shipping status of an order."""
    return {"order_id": order_id, "status": "shipped", "server": "Promptise Foundry"}


if __name__ == "__main__":
    server.run(transport="http", port=8103)  # http://127.0.0.1:8103/mcp

The differences show up in production: MCPServer binds 127.0.0.1 by default and validates Host and Origin, answers /health and /health/ready for container probes, and takes middleware for auth, tenants, rate limits, circuit breakers and audit logs. Step 6 uses some of them. The Promptise MCP server docs cover the full middleware list.


[08]

Step 3: Write it in TypeScript with the official SDK

If your team works in TypeScript, the official TypeScript SDK 2 is the reference. Version 2 split the old @modelcontextprotocol/sdk package into @modelcontextprotocol/server, client and per-framework adapters. This follows the Node example from the SDK's HTTP serving guide:

TypeScriptts_server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// npm install @modelcontextprotocol/server @modelcontextprotocol/node zod
import { createServer } from 'node:http';
import { createMcpHandler, McpServer } from '@modelcontextprotocol/server';
import { localhostHostValidation, localhostOriginValidation, toNodeHandler } from '@modelcontextprotocol/node';
import * as z from 'zod/v4';

const handler = createMcpHandler(() => {
    const server = new McpServer({ name: 'orders', version: '1.0.0' });
    server.registerTool(
        'get_order_status',
        { description: 'Get the shipping status of an order.', inputSchema: z.object({ order_id: z.string() }) },
        async ({ order_id }) => ({
            content: [{ type: 'text', text: JSON.stringify({ order_id, status: 'shipped', server: 'TypeScript SDK 2' }) }]
        })
    );
    return server;
});

const nodeHandler = toNodeHandler(handler);
const validateHost = localhostHostValidation();
const validateOrigin = localhostOriginValidation();
createServer((req, res) => {
    if (!validateHost(req, res) || !validateOrigin(req, res)) return;
    void nodeHandler(req, res);
}).listen(8104, '127.0.0.1'); // http://127.0.0.1:8104/mcp
>_Terminal
npm install @modelcontextprotocol/server@2.4.0 @modelcontextprotocol/node@2.1.2 zod tsx
npx tsx ts_server.ts

The schema is Zod instead of Python type hints, and the handler returns MCP content blocks itself. The Host and Origin checks guard a local server against DNS rebinding. For higher-level TypeScript options, xmcp adds file-based tools and auth plugins, and Vercel's mcp-handler mounts an MCP server in Next.js, Nuxt, SvelteKit, Hono and other Fetch-based frameworks.


[09]

Step 4: Expose an existing FastAPI app with FastAPI-MCP

If your tools already exist as FastAPI endpoints, FastAPI-MCP turns the routes into MCP tools. The route's operation_id becomes the tool name:

Pythonfastapi_mcp_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import uvicorn
from fastapi import FastAPI
from fastapi_mcp import FastApiMCP

app = FastAPI()


@app.get("/orders/{order_id}/status", operation_id="get_order_status")
def get_order_status(order_id: str) -> dict:
    """Get the shipping status of an order."""
    return {"order_id": order_id, "status": "shipped", "server": "FastAPI-MCP"}


FastApiMCP(app).mount_http()  # adds the MCP endpoint at /mcp

if __name__ == "__main__":
    uvicorn.run(app, port=8105)

Pin mcp<2. FastAPI-MCP 0.4.0 declares only mcp>=1.12, so a fresh install pulls mcp 2.3.0, and the app fails at startup:

Output
TypeError: Server.__init__() takes 2 positional arguments but 3 were given

FastMCP can do the same job with FastMCP.from_fastapi(app), which is maintained and supports the newer protocol. Choose FastAPI-MCP if you want auth to stay in your FastAPI dependencies. For more ways to serve MCP from FastAPI, see FastAPI MCP servers.


[10]

Step 5: Call every server with one client

With all five servers running, one script calls each of them with the official MCP Python SDK 2 client:

Pythoncall_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Call the same tool on every server with the official MCP Python SDK client."""
import asyncio
import json
import sys

from mcp import Client

PORTS = {"FastMCP": 8101, "MCP Python SDK": 8102, "Promptise": 8103, "TypeScript SDK": 8104, "FastAPI-MCP": 8105}


async def main() -> None:
    for name, port in PORTS.items():
        if len(sys.argv) > 1 and name not in sys.argv[1:]:
            continue
        async with Client(f"http://127.0.0.1:{port}/mcp") as client:
            tools = await client.list_tools()
            result = await client.call_tool("get_order_status", {"order_id": "A-1001"})
            print(f"{name:15} protocol {client.protocol_version}  {[t.name for t in tools.tools]} -> {json.loads(result.content[0].text)}")


asyncio.run(main())
Output
FastMCP         protocol 2026-07-28  ['get_order_status'] -> {'order_id': 'A-1001', 'status': 'shipped', 'server': 'FastMCP 4'}
MCP Python SDK  protocol 2026-07-28  ['get_order_status'] -> {'order_id': 'A-1001', 'status': 'shipped', 'server': 'MCP Python SDK 2'}
Promptise       protocol 2026-07-28  ['get_order_status'] -> {'order_id': 'A-1001', 'status': 'shipped', 'server': 'Promptise Foundry'}
TypeScript SDK  protocol 2026-07-28  ['get_order_status'] -> {'order_id': 'A-1001', 'status': 'shipped', 'server': 'TypeScript SDK 2'}
FastAPI-MCP     protocol 2025-11-25  ['get_order_status'] -> {'order_id': 'A-1001', 'status': 'shipped', 'server': 'FastAPI-MCP'}

Every server listed the tool and returned the same answer. The protocol value is the real difference: FastMCP 4, both official SDKs and Promptise Foundry 1.10.1 on mcp 2.x negotiated the 2026-07-28 revision, while FastAPI-MCP, on mcp 1.x, negotiated 2025-11-25. The client handled both. Clients that follow the spec negotiate down, so a 2025-11-25 server keeps working, but it won't offer features that only the newer revision defines. The Promptise server still answers older clients: an mcp 1.x client, or the 2.x client with mode="legacy", gets 2025-11-25 through the initialize handshake.


[11]

Step 6: Add auth, tenants and rate limits

Hello-world servers look the same everywhere. The comparison that matters is the production server. This step builds the same multi-tenant server twice, in FastMCP and in Promptise: a JWT with a tenant_id claim, a tool that returns only that tenant's orders, a rate limit of three requests in a burst per tenant, and no access without a token. Both servers share this demo data:

Pythonorders_data.py
1
2
3
4
5
6
SECRET = "dev-only-secret-change-me-32-bytes!"  # HS256 for the demo; use your IdP's JWKS in production
AUDIENCE = "orders-mcp"
ORDERS = {
    "acme": [{"id": "A-1001", "status": "shipped"}],
    "globex": [{"id": "G-2001", "status": "pending"}],
}

In FastMCP, JWTVerifier checks the token, and the tenant comes from its claims through get_access_token(). The rate limiter keys on whatever get_client_id returns:

Pythonfastmcp_tenants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from fastmcp import FastMCP
from fastmcp.server.auth.providers.jwt import JWTVerifier
from fastmcp.server.dependencies import get_access_token
from fastmcp.server.middleware.rate_limiting import RateLimitingMiddleware

from orders_data import AUDIENCE, ORDERS, SECRET

mcp = FastMCP("orders", auth=JWTVerifier(public_key=SECRET, algorithm="HS256", audience=AUDIENCE))


def tenant_of(context) -> str:
    token = get_access_token()
    return token.claims["tenant_id"] if token else "anonymous"


# One bucket per tenant: 3 requests at once, then 1 every 10 seconds.
mcp.add_middleware(RateLimitingMiddleware(max_requests_per_second=0.1, burst_capacity=3, get_client_id=tenant_of))


@mcp.tool
def list_orders() -> list[dict]:
    """List the caller's orders."""
    return ORDERS[get_access_token().claims["tenant_id"]]


if __name__ == "__main__":
    mcp.run(transport="http", port=8111)

In Promptise, AuthMiddleware reads the tenant claim into ctx.client.tenant_id, and RateLimitMiddleware puts the tenant into the bucket key itself:

Pythonpromptise_tenants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from promptise.mcp.server import AuthMiddleware, JWTAuth, MCPServer, RateLimitMiddleware, RequestContext

from orders_data import AUDIENCE, ORDERS, SECRET

server = MCPServer(name="orders", version="1.0.0", require_auth=True)  # 401 without a token
server.add_middleware(AuthMiddleware(JWTAuth(secret=SECRET, audience=AUDIENCE), tenant_claim="tenant_id"))
# Buckets are per client and tenant automatically: 3 requests at once, then 6 per minute.
server.add_middleware(RateLimitMiddleware(rate_per_minute=6, burst=3))


@server.tool()
async def list_orders(ctx: RequestContext) -> list[dict]:
    """List the caller's orders."""
    return ORDERS[ctx.client.tenant_id]


if __name__ == "__main__":
    server.run(transport="http", port=8113)

The test client mints tokens for two tenants, calls the tool four times as acme, once as globex, and once without a token:

Pythontenant_check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""Call list_orders as two tenants and without a token: python tenant_check.py <port>"""
import asyncio
import json
import sys
import time

import httpx2
import jwt
from mcp import Client
from mcp.client.streamable_http import streamable_http_client
from mcp.shared.exceptions import MCPError

from orders_data import AUDIENCE, SECRET

URL = f"http://127.0.0.1:{sys.argv[1]}/mcp"


def token(client_id: str, tenant: str) -> str:
    claims = {"sub": client_id, "client_id": client_id, "tenant_id": tenant, "aud": AUDIENCE, "exp": int(time.time()) + 300}
    return jwt.encode(claims, SECRET, algorithm="HS256")


async def call(label: str, bearer: str | None, times: int = 1) -> None:
    headers = {"Authorization": f"Bearer {bearer}"} if bearer else {}
    try:
        async with httpx2.AsyncClient(headers=headers) as http:
            async with Client(streamable_http_client(URL, http_client=http)) as client:
                for _ in range(times):
                    try:
                        result = await client.call_tool("list_orders", {})
                    except MCPError as exc:  # a JSON-RPC error response
                        print(f"{label:8} MCPError: {exc}")
                        continue
                    data = json.loads(result.content[0].text)
                    if result.is_error:  # a tool error result, readable by the model
                        err = data["error"]
                        print(f"{label:8} tool error: {err['message']} (retryable: {err['retryable']}) {err.get('suggestion', '')}")
                    else:
                        print(f"{label:8} {data}")
    except Exception as exc:  # noqa: BLE001  (the session itself failed)
        while isinstance(exc, ExceptionGroup):
            exc = exc.exceptions[0]
        print(f"{label:8} session failed: {type(exc).__name__}: {exc}")


async def main() -> None:
    await call("acme", token("agent-1", "acme"), times=4)
    await call("globex", token("agent-2", "globex"))
    await call("no token", None)


asyncio.run(main())
Output
$ python tenant_check.py 8111   # fastmcp
acme     [{'id': 'A-1001', 'status': 'shipped'}]
acme     MCPError: Rate limit exceeded for client: acme
acme     MCPError: Rate limit exceeded for client: acme
acme     MCPError: Rate limit exceeded for client: acme
globex   [{'id': 'G-2001', 'status': 'pending'}]
no token session failed: MCPError: Server returned an error response
Output
$ python tenant_check.py 8113   # promptise
acme     [{'id': 'A-1001', 'status': 'shipped'}]
acme     [{'id': 'A-1001', 'status': 'shipped'}]
acme     [{'id': 'A-1001', 'status': 'shipped'}]
acme     tool error: Rate limit exceeded (retryable: True) Wait 10 seconds before retrying.
globex   [{'id': 'G-2001', 'status': 'pending'}]
no token session failed: MCPError: Server returned an error response

Both servers kept the tenants apart, limited acme without touching globex, and refused the request without a token with HTTP 401, which the client reports as "Server returned an error response". Two differences are worth knowing:

  • What counts against the limit. FastMCP's RateLimitingMiddleware counts every MCP request. With the 2026-07-28 protocol, the client's server/discover and tools/list requests used two of acme's three tokens, so only one tool call got through. Promptise's middleware runs on tool, resource and prompt calls, not on list or discovery requests, so three tool calls got through. In FastMCP, size the bucket for all requests or write a middleware that limits on_call_tool only.

  • How a rejection looks. FastMCP raises a JSON-RPC error, so the client gets an exception. Promptise returns a tool error marked retryable, with a hint on how long to wait, which an agent can read and act on.

Neither is wrong. The difference is where the tenant lives. In FastMCP you hand it to each middleware that needs it, as get_client_id=tenant_of does here, and to every cache key and log line you write. In Promptise it is part of the auth context, and the rate limiter, cache and audit log add it on their own. In both, the tool itself still selects the tenant's data, as list_orders does. For the patterns behind this, see per-client rate limiting for MCP servers and MCP server authentication with JWT and OAuth.


[12]

FastMCP vs Promptise: which is better for production?

Promptise Foundry is the framework behind this site, so here is a direct comparison, including where FastMCP is the better choice. Both register tools with decorators and type hints, verify JWTs, run middleware, rate-limit, cache, emit OpenTelemetry, mount servers into one, bridge OpenAPI specs and ship an in-memory test client. The differences:

Area

FastMCP 4.1 is stronger

Promptise Foundry 1.10.1 is stronger

Protocol

The 2026-07-28 revision since 4.0; a tool can ask the user for input on it by returning an InputRequiredResult

The 2026-07-28 revision since 1.5.1, with elicitation in input rounds since 1.7.0, and it also runs on mcp 1.x next to packages that still pin it

Authentication

OAuth proxy, full OAuth server, MultiAuth, about 15 provider classes

API keys with a tenant and roles per key; sessions bound to the credential

Multi-tenancy

Tenant handling is your code

The tenant claim scopes rate limits, caches, audit entries, tool visibility and approval review

Rate limiting

Global, per client or sliding window

Per client and tenant, per tool, with retryable errors and a wait hint

Resilience

Retry and error-handling middleware

Circuit breaker, timeouts, concurrency limiter

Observability

OpenTelemetry on by default, with telemetry modes

Prometheus, HMAC-chained audit log, live dashboard, plus OpenTelemetry

Human approval

Elicitation (the server asks the user)

Approval gates on tools that fail closed

Composition

Proxies for remote servers, more providers and transforms

mount(), an OpenAPI provider, versioning, basic transforms

Ecosystem

About 28,000 stars, most tutorials, Prefect Horizon hosting

The same package builds the agents and the runtime that call the server

Choose FastMCP if you need OAuth with an identity provider, remote proxies, or the community and hosting that come with it. Choose Promptise if you serve several customers from one server and want tenant isolation, circuit breakers and a signed audit trail without writing that middleware, or if you also build the agents in Python and want one framework for both. You can run both: they are separate services, and any MCP client calls either one, as step 5 shows.


[13]

Running it in production

Authentication

Whichever framework you pick, verify tokens from your identity provider with JWKS and check aud, so a token minted for another service is refused. FastMCP has the most ready-made options, including an OAuth proxy for providers without dynamic client registration. The official SDKs implement the spec's resource-server role and leave the rest to you. Promptise covers JWT, JWKS and API keys, and with require_auth=True it binds each HTTP session to the credential that opened it.

Multi-tenancy

Put the tenant in the token, never in a tool argument the model can change. Then make sure every cache key, rate-limit bucket, audit entry and database query includes it. In FastMCP and the SDKs that is your code. In Promptise the middleware does it once. Either way, test it with two tenants, as step 6 does. Multi-tenant AI agents covers the agent side.

Observability

FastMCP and the official Python SDK both emit OpenTelemetry spans by default. They are no-ops until you install an SDK and exporter, such as opentelemetry-distro with OTEL_EXPORTER_OTLP_ENDPOINT. Promptise adds Prometheus metrics and an HMAC-chained audit log on top. FastMCP's docs show an unsigned audit middleware you can copy. Whatever you use, record the tool name, the caller, the tenant, the latency and the error code of every call. See MCP server monitoring.

Deployment

Use Streamable HTTP behind a reverse proxy with TLS, and bind 127.0.0.1 unless the proxy is on another machine. Streamable HTTP sessions live in one process, so with several replicas either route each mcp-session-id to one replica or run stateless. FastMCP 4.1 now expires idle HTTP sessions after the SDK's 30-minute default. Prefect Horizon is the hosted option for FastMCP servers; the others run anywhere an ASGI app or Node runs.

Upgrades

Pin exact versions and read release notes before upgrading. FastMCP 4.0 removed server-initiated sampling and roots and changed proxy behavior, and mcp 2.0 renamed classes and replaced httpx with httpx2. Since 1.5.1, Promptise installs mcp 2.x by default; its APIs didn't change, but your own code that reads SDK objects gets the 2.x attribute names, such as tool.input_schema. Run your client tests against every upgrade, as in testing an MCP server.


[14]

Common problems when switching

Symptom

Cause

Fix

ModuleNotFoundError: No module named 'mcp.server.fastmcp'

You upgraded to mcp 2.x, where the class is MCPServer

from mcp.server.mcpserver import MCPServer, or pin mcp<2

TypeError: The @tool decorator was used incorrectly. Did you forget to call it?

Bare @mcp.tool from FastMCP code in the official SDK 2

Use @mcp.tool()

TypeError: Server.__init__() takes 2 positional arguments but 3 were given at startup

FastAPI-MCP 0.4.0 with mcp 2.x

Pin mcp<2 next to fastapi-mcp

The resolver says fastmcp==4.1.2 and promptise==1.4.3 are incompatible

FastMCP 4 needs mcp>=2.2; Promptise before 1.5.1 pinned mcp<2

Upgrade to promptise>=1.5.1, which supports mcp>=1.9,<3

A FastMCP tutorial's code doesn't run

It was written for FastMCP 2 or 3, or for the npm fastmcp package

Check the version badge in the FastMCP docs and your import

The first tool call is already rate-limited in FastMCP

RateLimitingMiddleware counts server/discover, tools/list and other requests

Raise the burst, or limit on_call_tool only

404 Session not found behind a load balancer

The session lives in another replica

Sticky sessions on mcp-session-id, or stateless HTTP


[15]

Limitations

  • This is a snapshot. FastMCP shipped 4.1.2 and 4.1.3 on the day the first examples ran, and every project here moves fast. Check versions before you decide.

  • Promptise Foundry is new to the 2026-07-28 revision. It has spoken it since 1.5.1. Since 1.7.0 its elicitation, including ElicitationApprover approvals, works there in input rounds: the tool call ends with an InputRequiredResult, and the client calls again with the answer. Sampling isn't available on those connections, and a tool that keeps per-session state needs a client that uses the initialize handshake. It is a young project, Python only, and its community is much smaller than FastMCP's (under 1,000 GitHub stars).

  • The table compares built-in features. Anything marked "your code" or "not built in" can be added with middleware in that framework.

  • Not every option was run. Five servers ran for this guide. mcp-use (Python and TypeScript), Golf (a framework on top of FastMCP 4), xmcp, mcp-handler and the Go, Java, C# and Rust SDKs are described from their repositories only.


[16]

Frequently asked questions

Is FastMCP the same as the MCP Python SDK?

No. FastMCP 1.0 was adopted into the official SDK in 2024 as mcp.server.fastmcp.FastMCP. The standalone fastmcp package, maintained by Prefect, grew into a much larger framework. In mcp 2.0 the SDK renamed its class to MCPServer, so today "FastMCP" almost always means Prefect's package, which is built on top of the SDK.

What is a good FastMCP alternative for multi-tenant servers?

Choose a framework that makes the tenant part of the auth context, so middleware doesn't depend on each tool passing it along. Promptise Foundry is one that does this: the tenant claim from the token scopes rate limits, caches and audit entries, and tenant guards can hide tools. With FastMCP or the official SDKs, read the claim from the access token in every tool and include it in every key, and test with two tenants.

Is FastMCP production ready?

Yes, for most servers. FastMCP 4 has OAuth and JWT auth, authorization, rate limiting, caching, OpenTelemetry, background tasks and a hosted deployment option in Prefect Horizon. What you add yourself is mostly tenant-scoped keys, circuit breakers, a signed audit log and Prometheus metrics. For durable background tasks, install the fastmcp[tasks] extra with Redis or Valkey. Pin versions, because major releases have breaking changes.

FastMCP vs FastAPI-MCP: which should I use?

Use FastAPI-MCP when you have a FastAPI app and want its routes and auth dependencies as MCP tools with little new code. Use FastMCP for MCP-first servers, or FastMCP.from_fastapi(app) to wrap a FastAPI app with a maintained framework. FastAPI-MCP's last release was 0.4.0 in July 2025 and it needs mcp<2.

What is the best FastMCP alternative for TypeScript?

The official TypeScript SDK 2 (@modelcontextprotocol/server) is the reference and runs on Node, Express, Hono, Fastify and edge runtimes. For more structure, xmcp offers file-based tools and auth plugins, and Vercel's mcp-handler mounts MCP routes in Next.js, Nuxt, SvelteKit or Hono apps. The npm package called fastmcp is a separate TypeScript project, not Prefect's FastMCP; Prefect publishes its own port as @prefecthq/fastmcp-ts.

FastMCP vs Promptise: which should I use?

Use FastMCP for OAuth with identity providers, proxies for remote servers and the largest community. Use Promptise Foundry for multi-tenant servers that need tenant-scoped limits, caches and audit logs, circuit breakers, Prometheus metrics and approval gates built in, or when you also build your agents with it. Both answer the same MCP clients, so the choice is about production features.

Can I switch frameworks without changing my MCP clients?

Yes. Clients see only the protocol, the endpoint and the tool schemas. Keep the URL, the tool names and the parameter names, and clients keep working, as step 5 shows with one client and five servers. Check the negotiated protocol revision, and move auth carefully, because token validation rules often differ between frameworks.


[17]

Next steps

  • Build a production MCP server step by step: production MCP server in Python.

  • Secure it: MCP security best practices.

  • Add per-client limits: MCP rate limiting per client.

  • Watch it in production: MCP server monitoring.

  • Add middleware for logging, limits and audit: MCP server middleware.

  • Reference: FastMCP docs, MCP Python SDK v2 migration guide, TypeScript SDK v2 docs and Promptise MCP server middleware.

← PreviousLangChain vs MCP: Differences and How They Work TogetherNext lesson →AI Agent Audit Logging: Tamper-Evident Logs in Python