Skip to content

Commit b4cc3d7

Browse files
committed
fix:Improve code maintainability: Add a public mcp_server attribute to FastMCP, implement RootsListChangedNotification handling, simplify capability check logic, and optimize the use of the TRANSPORTS variable
1 parent 176121e commit b4cc3d7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/mcp/server/fastmcp/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ def session_manager(self) -> StreamableHTTPSessionManager:
213213
RuntimeError: If called before streamable_http_app() has been called.
214214
"""
215215
return self._mcp_server.session_manager # pragma: no cover
216-
216+
217217
@property
218218
def mcp_server(self):
219219
"""Get the underlying MCP server instance.
220-
220+
221221
This is exposed to enable advanced use cases like in-memory testing.
222222
"""
223223
return self._mcp_server

src/mcp/server/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def check_client_capability(self, capability: types.ClientCapabilities) -> bool:
147147
# Check sampling capability
148148
if capability.sampling and not client_caps.sampling: # pragma: lax no cover
149149
return False
150-
if capability.sampling: # pragma: lax no cover
150+
if capability.sampling and client_caps.sampling: # pragma: lax no cover
151151
if capability.sampling.context and not client_caps.sampling.context: # pragma: lax no cover
152152
return False
153153
if capability.sampling.tools and not client_caps.sampling.tools: # pragma: lax no cover

0 commit comments

Comments
 (0)