Skip to content

MCP server fails to start: FastMCP.tool() does not accept timeout kwarg #377

@JaysonTurkRP

Description

@JaysonTurkRP

Bug Description

The MCP server fails to start because FastMCP.tool() does not support the timeout keyword argument. Several tool registrations pass timeout= to the @mcp.tool() decorator, which causes a TypeError at import time.

Error

TypeError: FastMCP.tool() got an unexpected keyword argument 'timeout'

Affected Files

  • databricks_mcp_server/tools/pipelines.py line 156: @mcp.tool(timeout=300)
  • databricks_mcp_server/tools/pdf.py line 14: @mcp.tool(timeout=300.0)
  • databricks_mcp_server/tools/pdf.py line 104: @mcp.tool(timeout=60.0)

Environment

  • mcp: 1.26.0
  • fastmcp: 2.14.5
  • OS: Windows 11
  • Python: 3.12 (ai-dev-kit venv)
  • AI Dev Kit version: 0.1.6

Root Cause

FastMCP.tool() in fastmcp 2.14.5 does not accept a timeout parameter. The decorator signature only supports name, description, annotations, and tags. The timeout kwarg was likely intended for a newer or different version of FastMCP that hasn't been released yet, or for a custom wrapper.

Workaround

Adding kwargs.pop("timeout", None) to the patched_tool() function in server.py (the existing Windows compatibility patch in _patch_tool_decorator_for_windows) strips the unsupported kwarg before it reaches FastMCP.tool():

@functools.wraps(original_tool)
def patched_tool(fn=None, *args, **kwargs):
    # Strip kwargs not supported by FastMCP.tool()
    kwargs.pop("timeout", None)
    # Handle @mcp.tool("name") — returns a decorator
    if fn is None or isinstance(fn, str):
        ...

Suggested Fix

Either:

  1. Remove timeout= from the @mcp.tool() decorators in pipelines.py and pdf.py
  2. Pin a fastmcp version that supports timeout in pyproject.toml / requirements.txt
  3. Add the kwargs.pop("timeout", None) workaround to server.py's existing patched_tool() function

Reproducibility

This breaks on every fresh install or update of ai-dev-kit v0.1.6 when using fastmcp 2.14.5. The MCP server cannot start at all — no tools are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions