MCPcopy
hub / github.com/modelcontextprotocol/python-sdk / _check_server_object

Function _check_server_object

src/mcp/cli/cli.py:143–157  ·  view source on GitHub ↗

Helper function to check that the server object is supported Args: server_object: The server object to check. Returns: True if it's supported.

(server_object: Any, object_name: str)

Source from the content-addressed store, hash-verified

141 spec.loader.exec_module(module)
142
143 def _check_server_object(server_object: Any, object_name: str):
144 """Helper function to check that the server object is supported
145
146 Args:
147 server_object: The server object to check.
148
149 Returns:
150 True if it's supported.
151 """
152 if not isinstance(server_object, MCPServer):
153 logger.error(f"The server object {object_name} is of type {type(server_object)} (expecting {MCPServer}).")
154 if isinstance(server_object, LowLevelServer):
155 logger.warning("Note that only MCPServer is supported. Low level Server class is not yet supported.")
156 return False
157 return True
158
159 # If no object specified, try common server names
160 if not server_object:

Callers 1

_import_serverFunction · 0.85

Calls 2

errorMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected