Get the FREE Ultimate OpenClaw Setup Guide →

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.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ragieai-dynamic-fastmcp uvx dynamic-fastmcp

How to use

Dynamic FastMCP is a Python-based MCP server that extends the Official MCP Python SDK with dynamic tool capabilities. It enables you to define tools whose descriptions and behavior can adapt to the request context, including user information, path parameters, and tenant context. This makes it ideal for multi-tenant applications where tool availability and responses should vary per user or tenant, while still leveraging regular MCP tools alongside dynamic ones. The server integrates with FastAPI for authentication and easy mounting, so you can expose MCP-powered tools as part of your API surface. You can use normal MCP tools just like you would with standard MCP servers, and add dynamic tools that implement the DynamicTool protocol to provide context-aware execution and descriptions. The examples show both multi-tenant and user-aware tools that adjust output based on the authenticated user or path parameters.

To get started, install the package and integrate it into your FastAPI app, optionally configuring token-based authentication. When listing tools, dynamic tools will fetch their descriptions from the current context, and during execution they receive full context information, including request data, user identity, and path parameters. This makes it straightforward to provide personalized responses or tenant-specific behavior without splitting tool definitions into separate endpoints.

How to install

Prerequisites:

  • Python 3.12+
  • pip (comes with Python)
  • Optional: uv (for UV runtimes) if you’re not using a standard Python environment

Install Dynamic FastMCP:

pip install dynamic-fastmcp

Or add it to your UV environment:

uv add dynamic-fastmcp

If you’re using a FastAPI-based server, install FastAPI and Pydantic as well (if not already present):

pip install fastapi pydantic

Configure and run as part of your application according to your deployment setup (see mcp_config for runtime invocation).

Additional notes

  • This MCP server is Python-based and relies on the DynamicFastMCP and DynamicTool abstractions to provide context-aware tool behavior.
  • When running in a multi-tenant environment, ensure your authentication middleware supplies user and tenant context accessible to DynamicTool handlers.
  • Regular MCP tools continue to work alongside dynamic tools; you can mix and match as needed.
  • The project emphasizes FastAPI integration and token-based authentication for securing MCP endpoints; configure token_verifier and AuthSettings as shown in the examples.
  • Requirements include MCP SDK 1.13.0+ and Python 3.12+; keep dependencies up to date for compatibility with dynamic tool features.
  • For local testing, use the provided Quick Start examples to validate description resolution and dynamic calls before deploying to production.

Related MCP Servers

Sponsor this space

Reach thousands of developers