Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ filterwarnings = [
"ignore:Returning str or bytes.*:DeprecationWarning:mcp.server.lowlevel",
# pywin32 internal deprecation warning
"ignore:getargs.*The 'u' format is deprecated:DeprecationWarning",
# uvicorn uses asyncio.iscoroutinefunction deprecated in Python 3.14
"ignore:.*asyncio.iscoroutinefunction.*is deprecated:DeprecationWarning",
# Unclosed socket warnings during server teardown (Windows)
"ignore:unclosed.*socket:ResourceWarning",
# Thread exceptions from uvicorn deprecation warnings on Python 3.14
"ignore:Exception in thread.*asyncio.iscoroutinefunction:pytest.PytestUnhandledThreadExceptionWarning",
]

[tool.markdown.lint]
Expand Down
20 changes: 11 additions & 9 deletions src/mcp/server/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ async def _received_notification(self, notification: types.ClientNotification) -
case types.InitializedNotification():
self._initialization_state = InitializationState.Initialized
case _:
if self._initialization_state != InitializationState.Initialized: # pragma: no cover
raise RuntimeError("Received notification before initialization was complete")
if self._initialization_state != InitializationState.Initialized:
raise RuntimeError(
"Received notification before initialization was complete"
) # pragma: lax no cover

async def send_log_message(
self,
Expand All @@ -222,7 +224,7 @@ async def send_log_message(
related_request_id,
)

async def send_resource_updated(self, uri: str | AnyUrl) -> None: # pragma: no cover
async def send_resource_updated(self, uri: str | AnyUrl) -> None:
"""Send a resource updated notification."""
await self.send_notification(
types.ResourceUpdatedNotification(
Expand Down Expand Up @@ -446,9 +448,9 @@ async def elicit_url(
metadata=ServerMessageMetadata(related_request_id=related_request_id),
)

async def send_ping(self) -> types.EmptyResult: # pragma: no cover
async def send_ping(self) -> types.EmptyResult:
"""Send a ping request."""
return await self.send_request(
return await self.send_request( # pragma: lax no cover
types.PingRequest(),
types.EmptyResult,
)
Expand Down Expand Up @@ -478,13 +480,13 @@ async def send_resource_list_changed(self) -> None:
"""Send a resource list changed notification."""
await self.send_notification(types.ResourceListChangedNotification())

async def send_tool_list_changed(self) -> None: # pragma: no cover
async def send_tool_list_changed(self) -> None:
"""Send a tool list changed notification."""
await self.send_notification(types.ToolListChangedNotification())
await self.send_notification(types.ToolListChangedNotification()) # pragma: lax no cover

async def send_prompt_list_changed(self) -> None: # pragma: no cover
async def send_prompt_list_changed(self) -> None:
"""Send a prompt list changed notification."""
await self.send_notification(types.PromptListChangedNotification())
await self.send_notification(types.PromptListChangedNotification()) # pragma: lax no cover

async def send_elicit_complete(
self,
Expand Down
Loading
Loading