ragieai/dynamic-fastmcp
Dynamic FastMCP extends the Model Context Protocol Python server with context-aware tools that adapt their behavior and descriptions based on user, tenant, and request context.
<div align="center"> </div>
Dynamic FastMCP is a Python library that extends the Official Model Context Protocol (MCP) Python SDK with dynamic tool capabilities. It allows you to create MCP tools that can adapt their behavior and descriptions based on request context, user information, and path parameters.
Dynamic FastMCP is used to power our multi-tenant Streamable HTTP MCP Server at Ragie. To learn more about how we use it in production, check out our blog post on Making MCP Tool Use Feel Natural with Context-Aware Tools.
pip install dynamic-fastmcpOr using UV:
uv add dynamic-fastmcpfrom dynamic_fastmcp import DynamicFastMCP, DynamicTool
from mcp.server.fastmcp import Context
# Create a Dynamic FastMCP instance
mcp = DynamicFastMCP()
# Regular tool - works just like standard FastMCP
@mcp.tool(description="Echoes the input text")
def echo(text: str, ctx: Context):
return f"Echo: {text}"
# Dynamic tool - description and behavior adapt to context
@mcp.tool()
class PersonalizedEcho(DynamicTool):
def name(self)Loading reviews...