Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated typing on request context for the server to use server session #217

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/mcp/server/fastmcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from mcp.server.lowlevel.server import (
lifespan as default_lifespan,
)
from mcp.server.session import ServerSession
from mcp.server.sse import SseServerTransport
from mcp.server.stdio import stdio_server
from mcp.shared.context import RequestContext
Expand Down Expand Up @@ -597,7 +598,7 @@ def my_tool(x: int, ctx: Context) -> str:
The context is optional - tools that don't need it can omit the parameter.
"""

_request_context: RequestContext | None
_request_context: RequestContext[ServerSession, Any] | None
_fastmcp: FastMCP | None

def __init__(
Expand Down