Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

fix: add type hint to custom_route decorator (#1210)

nate nowack71844eb9c56e
diff --git a/src/fastmcp/server/server.py b/src/fastmcp/server/server.py
index 33036d39d..9593cb94f 100644
--- a/src/fastmcp/server/server.py
+++ b/src/fastmcp/server/server.py
@@ -411,7 +411,10 @@ class FastMCP(Generic[LifespanResultT]):
methods: list[str],
name: str | None = None,
include_in_schema: bool = True,
- ):
+ ) -> Callable[
+ [Callable[[Request], Awaitable[Response]]],
+ Callable[[Request], Awaitable[Response]],
+ ]:
"""
Decorator to register a custom HTTP route on the FastMCP server.