Registry / ai-ml / fastmcp-extensions

fastmcp-extensions

JSON →
library0.3.0pypypi✓ verified 35d ago

fastmcp-extensions is an unofficial extension library for FastMCP, providing patterns, practices, and utilities to enhance FastMCP server development. It currently supports FastMCP v3 and includes features like dynamic tool filtering and a helper for MCP server credential resolution. The library is actively maintained by AirbyteHQ and undergoes periodic releases.

ai-mlllm-agentsweb-framework
Install & Compatibility
Where this runs
tested against v0.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 13.33s
py 3.11
✓ —
✓ 12.75s
py 3.12
✓ —
✓ 10.33s
py 3.13
✓ —
✓ 10.25s
py 3.9
✕ build_error
✕ build_error
115MB installed
● package 115MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Based on release notes; specific modules for other extensions like dynamic tool filtering may vary.

from fastmcp_extensions.server import mcp_server

The core FastMCP object, which fastmcp-extensions extends.

from fastmcp import FastMCP

This quickstart demonstrates how to initialize a FastMCP server and conceptually integrate features provided by `fastmcp-extensions`, such as the `mcp_server` helper for server setup and credential resolution, and a placeholder for dynamic tool filtering. Due to the lack of specific examples in public documentation, some imports and usages are illustrative based on the library's stated features. Users should consult the library's source for precise API details.

import os from fastmcp import FastMCP # Assuming mcp_server helper is directly exposed in a 'server' module # Exact import path for specific extensions may vary based on internal structure. try: from fastmcp_extensions.server import mcp_server from fastmcp_extensions.filters import dynamic_filter_policy # Hypothetical import except ImportError: print("Warning: fastmcp-extensions specific imports not found. Using FastMCP core only.") mcp_server = None # Placeholder dynamic_filter_policy = None # Placeholder def run_extended_mcp_server(): mcp = FastMCP(name="MyExtendedMCPServer") @mcp.tool def hello(name: str = "World") -> str: """Greets the given name.""" return f"Hello, {name}! This is an extended FastMCP server." # Example of integrating an extension, if 'mcp_server' exists if mcp_server: # The mcp_server helper likely takes a FastMCP instance and applies configurations. # This is a hypothetical usage based on 'built-in server info and credential resolution'. print("Applying fastmcp-extensions mcp_server helper...") # mcp_server might take parameters for credential resolution, e.g., via env vars. # For example, os.environ.get('MCP_SERVER_SECRET_KEY', 'default_key') configured_mcp = mcp_server(mcp, credentials_env_var='FASTMCP_API_KEY') else: configured_mcp = mcp # If dynamic_filter_policy exists, it would likely be applied to the server if dynamic_filter_policy: print("Applying dynamic tool filtering policy...") # configured_mcp.add_filter(dynamic_filter_policy()) print(f"Running {configured_mcp.name} with stdio transport...") # In a real scenario, you'd run the server (e.g., in a __main__ block) # configured_mcp.run(transport="stdio") print("Server setup complete (not actually running in this snippet).") print("Available tools on the server:") for tool_name, tool_obj in configured_mcp._tools.items(): print(f"- {tool_name}: {tool_obj.description}") if __name__ == "__main__": # Set a dummy environment variable if needed for hypothetical credential resolution os.environ['FASTMCP_API_KEY'] = 'fake_api_key_123' run_extended_mcp_server()
Debug
Known footguns
breakingVersion 0.3.0 of `fastmcp-extensions` upgrades its core dependency `fastmcp` from v2 to v3. Projects upgrading to `fastmcp-extensions` v0.3.0 must also ensure their `fastmcp` installation is v3 or higher and that their server code is compatible with `FastMCP` v3's API changes.
gotcha`fastmcp-extensions` is described as an 'unofficial extension library'. This may imply potential for API instability, differing design philosophies, or slower updates compared to official `FastMCP` core developments. Relying heavily on specific extension implementations may introduce tighter coupling.
gotchaThe `mcp_server()` helper includes 'built-in server info and credential resolution'. Incorrect configuration or missing environment variables for credentials can lead to authentication failures or security vulnerabilities if defaults are inadvertently used.
gotchaThe 'dynamic tool filtering with intelligent default filtering policy' feature can unexpectedly hide or expose tools if the filtering logic is not fully understood. This could lead to functional gaps for LLM agents or unintended access to sensitive tools.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
13 hits · last 30 days
gptbot
4
ahrefsbot
4
bingbot
2
dotbot
1
script
1
bytedance
1
Resources