Problem
FastMCP has no public API to set experimental server capabilities, even though the underlying LowLevelServer.create_initialization_options supports them. The transport layer (run_stdio_async, run_http_async) calls create_initialization_options() without passing experimental capabilities through, so there's no way for application code to advertise experimental capabilities during the initialize handshake.
Follows up on #4039 (condensed per contributing guidelines).
MRE
from fastmcp import FastMCP
mcp = FastMCP("my-server")
# No public API for this — only workaround is monkey-patching a private attribute:
_original = mcp._mcp_server.create_initialization_options
def _patched(notification_options=None, experimental_capabilities=None, **kwargs):
merged = {"file_exchange": {"version": "0.3"}, **(experimental_capabilities or {})}
return _original(
notification_options=notification_options,
experimental_capabilities=merged,
**kwargs,
)
mcp._mcp_server.create_initialization_options = _patched
Proposed fix
Add an experimental_capabilities kwarg to FastMCP.__init__ and forward it through create_initialization_options() in the transport layer. Happy to PR.
Problem
FastMCPhas no public API to setexperimentalserver capabilities, even though the underlyingLowLevelServer.create_initialization_optionssupports them. The transport layer (run_stdio_async,run_http_async) callscreate_initialization_options()without passing experimental capabilities through, so there's no way for application code to advertise experimental capabilities during theinitializehandshake.Follows up on #4039 (condensed per contributing guidelines).
MRE
Proposed fix
Add an
experimental_capabilitieskwarg toFastMCP.__init__and forward it throughcreate_initialization_options()in the transport layer. Happy to PR.