Dynamic FastMCP

v1.0.0Developer Toolsstable

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.

context-awaredynamic-toolsfastapifastmcpmodel-context-protocol
Share:
45
Stars
0
Downloads
0
Weekly
0/5

What is Dynamic FastMCP?

Dynamic FastMCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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.

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.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Dynamic FastMCP extends the Model Context Protocol Python se

Use Cases

Create context-aware tools that adapt to user and tenant
Build dynamic MCP servers with request-specific behavior
ragieai

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedApr 15, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx dynamic-fastmcp

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Dynamic FastMCP

Dynamic FastMCP is a Python library that extends the FastMCP framework to support context-aware MCP tools — tools whose names, descriptions, and behavior adapt dynamically based on the identity of the caller (user, tenant, or request context). Instead of every user seeing the same static tool list, your MCP server can personalize tool descriptions, guard access by role, or tailor outputs to match the requester's context. It is designed for multi-tenant SaaS platforms and agentic systems where a one-size-fits-all tool interface is insufficient.

Prerequisites

  • Python 3.10+ with pip or uv installed
  • Familiarity with the FastMCP/MCP Python SDK and async Python
  • An MCP client or agent framework to connect to the server
  • Optional: an OIDC/OAuth2 identity provider if you want token-based context via AuthSettings
1

Install the dynamic-fastmcp package

Install the library from PyPI using pip or uv into your project environment.

pip install dynamic-fastmcp
# or with uv:
uv add dynamic-fastmcp
2

Create your MCP server file

Import DynamicFastMCP and DynamicTool, then instantiate the server. Dynamic tools are defined as classes that implement the DynamicTool protocol.

from dynamic_fastmcp import DynamicFastMCP, DynamicTool
from mcp.server.fastapi import Context

mcp = DynamicFastMCP()
3

Define a context-aware dynamic tool

Implement the DynamicTool protocol: name() returns the tool identifier, handle_description() receives the MCP Context and returns a personalized description, and handle_call() executes the tool logic.

@mcp.tool()
class PersonalizedEcho(DynamicTool):
    def name(self) -> str:
        return "personalized_echo"

    async def handle_description(self, ctx: Context) -> str:
        user = ctx.request_context.request.user
        return f"Echoes text personalized for {user.username}"

    async def handle_call(self, text: str, ctx: Context) -> str:
        user = ctx.request_context.request.user
        return f"Hello {user.username}: {text}"
4

Run the MCP server

Start the server over stdio (for local MCP clients) or HTTP. The server will expose all registered dynamic tools to connecting clients.

python server.py
5

Configure your MCP client

Point your MCP client at the running server. For stdio-based servers, use the command and args fields in your client config.

{
  "mcpServers": {
    "dynamic-fastmcp": {
      "command": "python",
      "args": ["/absolute/path/to/server.py"]
    }
  }
}

Dynamic FastMCP Examples

Client configuration

Example MCP client config for a Dynamic FastMCP server running as a local Python script.

{
  "mcpServers": {
    "dynamic-fastmcp": {
      "command": "python",
      "args": ["/absolute/path/to/your/server.py"]
    }
  }
}

Prompts to try

Example interactions after connecting an agent to a Dynamic FastMCP server.

- "List all available tools"
- "Use the personalized_echo tool to echo 'hello world'"
- "What tools do I have access to as a premium user?"
- "Run the context-aware search tool with query 'latest sales data'"
- "Show me the description of each available tool"

Troubleshooting Dynamic FastMCP

ImportError: cannot import name 'DynamicTool' from 'dynamic_fastmcp'

Ensure you installed the correct package: 'pip install dynamic-fastmcp' (with a hyphen). Run 'pip show dynamic-fastmcp' to confirm the version is installed.

Context object does not contain user/tenant information

Dynamic context requires that your MCP server is configured with a token_verifier or AuthSettings pointing to your identity provider. Without authentication middleware, ctx.request_context.request.user will be empty.

Tool descriptions are not adapting per request

Confirm your tool class implements handle_description(self, ctx) as an async method, not a regular method, and that it is decorated with @mcp.tool(). Static @mcp.tool() function decorators bypass the dynamic description mechanism.

Frequently Asked Questions about Dynamic FastMCP

What is Dynamic FastMCP?

Dynamic FastMCP is a Model Context Protocol (MCP) server that 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. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Dynamic FastMCP?

Follow the installation instructions on the Dynamic FastMCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Dynamic FastMCP?

Dynamic FastMCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Dynamic FastMCP free to use?

Yes, Dynamic FastMCP is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "dynamic-fastmcp": { "command": "npx", "args": ["-y", "dynamic-fastmcp"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Dynamic FastMCP?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides