Skip to content

uvicorn got eagerly imported via sse-starlette #1770

Closed as not planned
Closed as not planned

Description

@CNSeniorious000

Initial Checks

Description

I noticed that you intend to lazy-import uvicorn because it's only used for HTTP/SSE transports. However, I found that it's still being imported immediately, as sse-starlette imports it eagerly, and sse-starlette is imported here:

https://github.com/search?q=repo%3Amodelcontextprotocol%2Fpython-sdk+sse_starlette+language%3APython&type=code

Example Code

import sys, mcp

assert "uvicorn" in sys.modules

Python & MCP Python SDK

1.23.3

Activity

  1. CNSeniorious000 commented on Dec 11, 2025

    @CNSeniorious000
    Author

    Sad to see #1771 only trims ~50 ms—even though import sse_starlette takes 400 ms, it turns out uvicorn itself is pretty light. Feel free to close if you're fine leaving things as-is.

  2. changed the title [-]`uvicorn` got eagerly imported because of `sse-starlette`[/-] [+]`uvicorn` got eagerly imported via `sse-starlette`[/+] on Dec 11, 2025
  3. maxisbey commented on Dec 11, 2025

    @maxisbey
    Contributor

    Yea will leave as is for now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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