Skip to content

fastmcp.run() runtimeerror: task group is not initialized. make sure to use run(). #1372

@SinDongHwan

Description

@SinDongHwan

Initial Checks

Description

following error sometime occur.

fastmcp.run() runtimeerror: task group is not initialized. make sure to use run().

Example Code

from mcp.server.fastmcp import FastMCP
# FastMCP instance
mcp = FastMCP(
    name=setting.server["name"],
    host=setting.server["host"],
    port=setting.server["port"],
    streamable_http_path=setting.server["streamable_http_path"],
    api_route="/mcp/",
    debug=True,
)
try:
    mcp.run(transport="streamable-http")
except KeyboardInterrupt:
    logger.info("Service shut down")

Python & MCP Python SDK

mcp version (1.13.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds reproneeds additional information to be able to reproduce bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions