datarobot-genai 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datarobot_genai/drmcp/core/dr_mcp_server.py +34 -0
- datarobot_genai/drmcp/core/mcp_instance.py +36 -1
- {datarobot_genai-0.2.1.dist-info → datarobot_genai-0.2.2.dist-info}/METADATA +1 -1
- {datarobot_genai-0.2.1.dist-info → datarobot_genai-0.2.2.dist-info}/RECORD +8 -8
- {datarobot_genai-0.2.1.dist-info → datarobot_genai-0.2.2.dist-info}/WHEEL +0 -0
- {datarobot_genai-0.2.1.dist-info → datarobot_genai-0.2.2.dist-info}/entry_points.txt +0 -0
- {datarobot_genai-0.2.1.dist-info → datarobot_genai-0.2.2.dist-info}/licenses/AUTHORS +0 -0
- {datarobot_genai-0.2.1.dist-info → datarobot_genai-0.2.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -115,6 +115,9 @@ class DataRobotMCPServer:
|
|
|
115
115
|
self._mcp = mcp
|
|
116
116
|
self._mcp_transport = transport
|
|
117
117
|
|
|
118
|
+
# Configure MCP server capabilities
|
|
119
|
+
self._configure_mcp_capabilities()
|
|
120
|
+
|
|
118
121
|
# Initialize telemetry
|
|
119
122
|
initialize_telemetry(mcp)
|
|
120
123
|
|
|
@@ -163,6 +166,37 @@ class DataRobotMCPServer:
|
|
|
163
166
|
if transport == "streamable-http":
|
|
164
167
|
register_routes(self._mcp)
|
|
165
168
|
|
|
169
|
+
def _configure_mcp_capabilities(self) -> None:
|
|
170
|
+
"""Configure MCP capabilities that FastMCP doesn't expose directly.
|
|
171
|
+
|
|
172
|
+
See: https://github.com/modelcontextprotocol/python-sdk/issues/1126
|
|
173
|
+
"""
|
|
174
|
+
server = self._mcp._mcp_server
|
|
175
|
+
|
|
176
|
+
# Declare prompts_changed capability (capabilities.prompts.listChanged: true)
|
|
177
|
+
server.notification_options.prompts_changed = True
|
|
178
|
+
|
|
179
|
+
# Declare experimental capabilities ( experimental.dynamic_prompts: true)
|
|
180
|
+
server.experimental_capabilities = {"dynamic_prompts": {"enabled": True}}
|
|
181
|
+
|
|
182
|
+
# Patch to include experimental_capabilities (FastMCP doesn't expose this)
|
|
183
|
+
original = server.create_initialization_options
|
|
184
|
+
|
|
185
|
+
def patched(
|
|
186
|
+
notification_options: Any = None,
|
|
187
|
+
experimental_capabilities: dict[str, dict[str, Any]] | None = None,
|
|
188
|
+
**kwargs: Any,
|
|
189
|
+
) -> Any:
|
|
190
|
+
if experimental_capabilities is None:
|
|
191
|
+
experimental_capabilities = getattr(server, "experimental_capabilities", None)
|
|
192
|
+
return original(
|
|
193
|
+
notification_options=notification_options,
|
|
194
|
+
experimental_capabilities=experimental_capabilities,
|
|
195
|
+
**kwargs,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
server.create_initialization_options = patched
|
|
199
|
+
|
|
166
200
|
def run(self, show_banner: bool = False) -> None:
|
|
167
201
|
"""Run the DataRobot MCP server synchronously."""
|
|
168
202
|
try:
|
|
@@ -22,6 +22,7 @@ from fastmcp import Context
|
|
|
22
22
|
from fastmcp import FastMCP
|
|
23
23
|
from fastmcp.exceptions import NotFoundError
|
|
24
24
|
from fastmcp.prompts.prompt import Prompt
|
|
25
|
+
from fastmcp.server.dependencies import get_context
|
|
25
26
|
from fastmcp.tools import FunctionTool
|
|
26
27
|
from fastmcp.tools import Tool
|
|
27
28
|
from fastmcp.utilities.types import NotSet
|
|
@@ -91,6 +92,34 @@ class TaggedFastMCP(FastMCP):
|
|
|
91
92
|
self._deployments_map: dict[str, str] = {}
|
|
92
93
|
self._prompts_map: dict[str, tuple[str, str]] = {}
|
|
93
94
|
|
|
95
|
+
async def notify_prompts_changed(self) -> None:
|
|
96
|
+
"""
|
|
97
|
+
Notify connected clients that the prompt list has changed.
|
|
98
|
+
|
|
99
|
+
This method attempts to send a prompts/list_changed notification to inform
|
|
100
|
+
clients that they should refresh their prompt list.
|
|
101
|
+
|
|
102
|
+
Note: In stateless HTTP mode (default for this server), notifications may not
|
|
103
|
+
reach clients since each request is independent. This method still logs the
|
|
104
|
+
change for auditing purposes and will work if the server is configured for
|
|
105
|
+
stateful connections.
|
|
106
|
+
|
|
107
|
+
See: https://github.com/modelcontextprotocol/python-sdk/issues/710
|
|
108
|
+
"""
|
|
109
|
+
logger.info("Prompt list changed - attempting to notify connected clients")
|
|
110
|
+
|
|
111
|
+
# Try to use FastMCP's built-in notification mechanism if in an MCP context
|
|
112
|
+
try:
|
|
113
|
+
context = get_context()
|
|
114
|
+
context._queue_prompt_list_changed()
|
|
115
|
+
logger.debug("Queued prompts_changed notification via MCP context")
|
|
116
|
+
except RuntimeError:
|
|
117
|
+
# No active MCP context - this is expected when called from REST API
|
|
118
|
+
logger.debug(
|
|
119
|
+
"No active MCP context for notification. "
|
|
120
|
+
"In stateless mode, clients will see changes on next request."
|
|
121
|
+
)
|
|
122
|
+
|
|
94
123
|
@overload
|
|
95
124
|
def tool(
|
|
96
125
|
self,
|
|
@@ -311,7 +340,7 @@ class TaggedFastMCP(FastMCP):
|
|
|
311
340
|
f"skipping removal."
|
|
312
341
|
)
|
|
313
342
|
else:
|
|
314
|
-
prompts_d = await
|
|
343
|
+
prompts_d = await self.get_prompts()
|
|
315
344
|
for prompt in prompts_d.values():
|
|
316
345
|
if (
|
|
317
346
|
prompt.meta is not None
|
|
@@ -322,6 +351,9 @@ class TaggedFastMCP(FastMCP):
|
|
|
322
351
|
prompt.disable()
|
|
323
352
|
|
|
324
353
|
self._prompts_map.pop(prompt_template_id, None)
|
|
354
|
+
|
|
355
|
+
# Notify clients that the prompt list has changed
|
|
356
|
+
await self.notify_prompts_changed()
|
|
325
357
|
else:
|
|
326
358
|
logger.debug(
|
|
327
359
|
f"Do not found prompt template with id = {prompt_template_id} in registry, "
|
|
@@ -543,4 +575,7 @@ async def register_prompt(
|
|
|
543
575
|
raise RuntimeError(f"Prompt {prompt_name_no_duplicate} was not registered successfully")
|
|
544
576
|
logger.info(f"Registered prompts: {len(prompts)}")
|
|
545
577
|
|
|
578
|
+
# Notify clients that the prompt list has changed
|
|
579
|
+
await mcp.notify_prompts_changed()
|
|
580
|
+
|
|
546
581
|
return registered_prompt
|
|
@@ -31,11 +31,11 @@ datarobot_genai/drmcp/core/config.py,sha256=D7bSi40Yc5J71_JxmpfppG83snbIJW9iz1J7
|
|
|
31
31
|
datarobot_genai/drmcp/core/config_utils.py,sha256=U-aieWw7MyP03cGDFIp97JH99ZUfr3vD9uuTzBzxn7w,6428
|
|
32
32
|
datarobot_genai/drmcp/core/constants.py,sha256=lUwoW_PTrbaBGqRJifKqCn3EoFacoEgdO-CpoFVrUoU,739
|
|
33
33
|
datarobot_genai/drmcp/core/credentials.py,sha256=PYEUDNMVw1BoMzZKLkPVTypNkVevEPtmk3scKnE-zYg,6706
|
|
34
|
-
datarobot_genai/drmcp/core/dr_mcp_server.py,sha256=
|
|
34
|
+
datarobot_genai/drmcp/core/dr_mcp_server.py,sha256=peAq0TL4ZL0P6XJjwCEWNfi0OVPPSQMSRQyKFH6yjtY,14228
|
|
35
35
|
datarobot_genai/drmcp/core/dr_mcp_server_logo.py,sha256=hib-nfR1SNTW6CnpFsFCkL9H_OMwa4YYyinV7VNOuLk,4708
|
|
36
36
|
datarobot_genai/drmcp/core/exceptions.py,sha256=eqsGI-lxybgvWL5w4BFhbm3XzH1eU5tetwjnhJxelpc,905
|
|
37
37
|
datarobot_genai/drmcp/core/logging.py,sha256=Y_hig4eBWiXGaVV7B_3wBcaYVRNH4ydptbEQhrP9-mY,3414
|
|
38
|
-
datarobot_genai/drmcp/core/mcp_instance.py,sha256=
|
|
38
|
+
datarobot_genai/drmcp/core/mcp_instance.py,sha256=hArS-BIdsIdRyRA21a4_ILgqqzmuRxZts-Ewgtf1H60,20917
|
|
39
39
|
datarobot_genai/drmcp/core/mcp_server_tools.py,sha256=odNZKozfx0VV38SLZHw9lY0C0JM_JnRI06W3BBXnyE4,4278
|
|
40
40
|
datarobot_genai/drmcp/core/routes.py,sha256=dqE2M0UzAyyN9vQjlyTjYW4rpju3LT039po5weuO__I,17936
|
|
41
41
|
datarobot_genai/drmcp/core/routes_utils.py,sha256=vSseXWlplMSnRgoJgtP_rHxWSAVYcx_tpTv4lyTpQoc,944
|
|
@@ -93,9 +93,9 @@ datarobot_genai/nat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
93
93
|
datarobot_genai/nat/agent.py,sha256=siBLDWAff2-JwZ8Q3iNpM_e4_IoSwG9IvY0hyEjNenw,10292
|
|
94
94
|
datarobot_genai/nat/datarobot_llm_clients.py,sha256=STzAZ4OF8U-Y_cUTywxmKBGVotwsnbGP6vTojnu6q0g,9921
|
|
95
95
|
datarobot_genai/nat/datarobot_llm_providers.py,sha256=aDoQcTeGI-odqydPXEX9OGGNFbzAtpqzTvHHEkmJuEQ,4963
|
|
96
|
-
datarobot_genai-0.2.
|
|
97
|
-
datarobot_genai-0.2.
|
|
98
|
-
datarobot_genai-0.2.
|
|
99
|
-
datarobot_genai-0.2.
|
|
100
|
-
datarobot_genai-0.2.
|
|
101
|
-
datarobot_genai-0.2.
|
|
96
|
+
datarobot_genai-0.2.2.dist-info/METADATA,sha256=pA4Qd15Oy9-B6gOvpslhNNegcneXWtF9Wr8x5R5OuwY,5942
|
|
97
|
+
datarobot_genai-0.2.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
98
|
+
datarobot_genai-0.2.2.dist-info/entry_points.txt,sha256=CZhmZcSyt_RBltgLN_b9xasJD6J5SaDc_z7K0wuOY9Y,150
|
|
99
|
+
datarobot_genai-0.2.2.dist-info/licenses/AUTHORS,sha256=isJGUXdjq1U7XZ_B_9AH8Qf0u4eX0XyQifJZ_Sxm4sA,80
|
|
100
|
+
datarobot_genai-0.2.2.dist-info/licenses/LICENSE,sha256=U2_VkLIktQoa60Nf6Tbt7E4RMlfhFSjWjcJJfVC-YCE,11341
|
|
101
|
+
datarobot_genai-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|