mcp-mesh 0.8.0b7__py3-none-any.whl → 0.8.0b9__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.
_mcp_mesh/__init__.py CHANGED
@@ -31,7 +31,7 @@ from .engine.decorator_registry import (
31
31
  get_decorator_stats,
32
32
  )
33
33
 
34
- __version__ = "0.8.0b7"
34
+ __version__ = "0.8.0b9"
35
35
 
36
36
  # Store reference to runtime processor if initialized
37
37
  _runtime_processor = None
@@ -161,36 +161,44 @@ class MeshLlmAgentInjector(BaseInjector):
161
161
  # Create UnifiedMCPProxy for the provider
162
162
  provider_proxy = self._create_provider_proxy(provider_data)
163
163
 
164
- # Update llm_agents data with provider_proxy and vendor (Phase 2)
165
- if function_id in self._llm_agents:
166
- self._llm_agents[function_id]["provider_proxy"] = provider_proxy
164
+ # Update only provider-related fields, preserving tool data if already set.
165
+ # This avoids race conditions where provider and tools updates can arrive in any order.
166
+ if function_id not in self._llm_agents:
167
+ self._llm_agents[function_id] = {}
167
168
 
168
- # Phase 2: Extract vendor from provider_data for handler selection
169
- vendor = provider_data.get("vendor", "unknown")
170
- self._llm_agents[function_id]["vendor"] = vendor
169
+ # Phase 2: Extract vendor from provider_data for handler selection
170
+ vendor = provider_data.get("vendor", "unknown")
171
171
 
172
+ self._llm_agents[function_id]["provider_proxy"] = provider_proxy
173
+ self._llm_agents[function_id]["vendor"] = vendor
174
+
175
+ logger.info(
176
+ f"✅ Set provider proxy for '{function_id}': {provider_proxy.function_name} at {provider_proxy.endpoint} (vendor={vendor})"
177
+ )
178
+
179
+ # Re-create and update MeshLlmAgent with new provider (only if tools are also available)
180
+ # Get the function wrapper from DecoratorRegistry
181
+ llm_agents = DecoratorRegistry.get_mesh_llm_agents()
182
+ wrapper = None
183
+ for agent_func_id, metadata in llm_agents.items():
184
+ if metadata.function_id == function_id:
185
+ wrapper = metadata.function
186
+ break
187
+
188
+ # Only update wrapper if we have both tools and provider (tools_metadata indicates tools were processed)
189
+ if (
190
+ wrapper
191
+ and hasattr(wrapper, "_mesh_update_llm_agent")
192
+ and "tools_metadata" in self._llm_agents[function_id]
193
+ ):
194
+ llm_agent = self._create_llm_agent(function_id)
195
+ wrapper._mesh_update_llm_agent(llm_agent)
172
196
  logger.info(
173
- f" Set provider proxy for '{function_id}': {provider_proxy.function_name} at {provider_proxy.endpoint} (vendor={vendor})"
197
+ f"🔄 Updated wrapper with new MeshLlmAgent (with provider) for '{function_id}'"
174
198
  )
175
-
176
- # Re-create and update MeshLlmAgent with new provider
177
- # Get the function wrapper from DecoratorRegistry
178
- llm_agents = DecoratorRegistry.get_mesh_llm_agents()
179
- wrapper = None
180
- for agent_func_id, metadata in llm_agents.items():
181
- if metadata.function_id == function_id:
182
- wrapper = metadata.function
183
- break
184
-
185
- if wrapper and hasattr(wrapper, "_mesh_update_llm_agent"):
186
- llm_agent = self._create_llm_agent(function_id)
187
- wrapper._mesh_update_llm_agent(llm_agent)
188
- logger.info(
189
- f"🔄 Updated wrapper with new MeshLlmAgent (with provider) for '{function_id}'"
190
- )
191
- else:
192
- logger.warning(
193
- f"⚠️ Function '{function_id}' not found in _llm_agents, cannot set provider proxy"
199
+ elif wrapper and hasattr(wrapper, "_mesh_update_llm_agent"):
200
+ logger.debug(
201
+ f"⏳ Provider set for '{function_id}', waiting for tools before updating wrapper"
194
202
  )
195
203
 
196
204
  def _create_provider_proxy(self, provider_data: dict[str, Any]) -> UnifiedMCPProxy:
@@ -273,21 +281,23 @@ class MeshLlmAgentInjector(BaseInjector):
273
281
  logger.error(f"❌ Error creating proxy for tool {tool_name}: {e}")
274
282
  # Continue processing other tools
275
283
 
276
- # Provider proxy will be set separately via process_llm_providers()
277
- # (v0.6.1 - providers come from llm_providers field, not dependencies)
278
- provider_proxy = None
279
-
280
- # Store LLM agent data with both metadata and proxies
281
- # Keep original tool metadata for schema building
282
- self._llm_agents[function_id] = {
283
- "config": llm_metadata.config,
284
- "output_type": llm_metadata.output_type,
285
- "param_name": llm_metadata.param_name,
286
- "tools_metadata": tools, # Original metadata for schema building
287
- "tools_proxies": tool_proxies_map, # Proxies for execution
288
- "function": llm_metadata.function,
289
- "provider_proxy": provider_proxy, # Provider proxy for mesh delegation
290
- }
284
+ # Update only tool-related fields, preserving provider_proxy if already set.
285
+ # Provider proxy is managed separately by process_llm_providers().
286
+ # This avoids race conditions where tools update wipes out provider resolution.
287
+ if function_id not in self._llm_agents:
288
+ self._llm_agents[function_id] = {}
289
+
290
+ self._llm_agents[function_id].update(
291
+ {
292
+ "config": llm_metadata.config,
293
+ "output_type": llm_metadata.output_type,
294
+ "param_name": llm_metadata.param_name,
295
+ "tools_metadata": tools, # Original metadata for schema building
296
+ "tools_proxies": tool_proxies_map, # Proxies for execution
297
+ "function": llm_metadata.function,
298
+ # Note: provider_proxy is NOT set here - managed by _process_function_provider
299
+ }
300
+ )
291
301
 
292
302
  logger.info(
293
303
  f"✅ Processed {len(tool_proxies_map)} tools for LLM function '{function_id}'"
@@ -431,8 +441,7 @@ class MeshLlmAgentInjector(BaseInjector):
431
441
  if is_template:
432
442
  # Templates enabled - create per-call agent with context
433
443
  # Import signature analyzer for context detection
434
- from .signature_analyzer import \
435
- get_context_parameter_name
444
+ from .signature_analyzer import get_context_parameter_name
436
445
 
437
446
  # Detect context parameter
438
447
  context_param_name = config_dict.get("context_param")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-mesh
3
- Version: 0.8.0b7
3
+ Version: 0.8.0b9
4
4
  Summary: Kubernetes-native platform for distributed MCP applications
5
5
  Project-URL: Homepage, https://github.com/dhyansraj/mcp-mesh
6
6
  Project-URL: Documentation, https://github.com/dhyansraj/mcp-mesh/tree/main/docs
@@ -30,7 +30,7 @@ Requires-Dist: fastmcp<3.0.0,>=2.8.0
30
30
  Requires-Dist: httpx<1.0.0,>=0.25.0
31
31
  Requires-Dist: jinja2>=3.1.0
32
32
  Requires-Dist: litellm>=1.30.0
33
- Requires-Dist: mcp-mesh-core>=0.8.0b7
33
+ Requires-Dist: mcp-mesh-core>=0.8.0b9
34
34
  Requires-Dist: mcp<2.0.0,>=1.9.0
35
35
  Requires-Dist: prometheus-client<1.0.0,>=0.19.0
36
36
  Requires-Dist: pydantic<3.0.0,>=2.4.0
@@ -1,4 +1,4 @@
1
- _mcp_mesh/__init__.py,sha256=Ch5NR3kHKmbIo27kH3OATMJfGUj_QdL1zUoKhqpa2Io,2721
1
+ _mcp_mesh/__init__.py,sha256=Pi7UIWRma8F9zTC-gcmeT5ApFCxpepQYRYMvWRVfDtE,2721
2
2
  _mcp_mesh/reload.py,sha256=5Yll9n0bqxM7pmTjfAaKWg-WT_Vi0YTh0_UNWbCNCIQ,6217
3
3
  _mcp_mesh/reload_runner.py,sha256=SgQKzzO2yHfSUBq8s3SpAnovWA0rveimVNaxeLCEo_0,1310
4
4
  _mcp_mesh/engine/__init__.py,sha256=U_6Kw3vA_3RiNK0Oln5c5C7WvA9lSONV22wWzfxYHNw,2975
@@ -10,7 +10,7 @@ _mcp_mesh/engine/http_wrapper.py,sha256=Simd6IEsLO2FXQOuf1WEx57SBN6DSr5RzphXnk0a
10
10
  _mcp_mesh/engine/llm_config.py,sha256=95bOsGWro5E1JGq7oZtEYhVdrzcIJqjht_r5vEdJVz4,2049
11
11
  _mcp_mesh/engine/llm_errors.py,sha256=h7BiI14u-jL8vtvBfFbFDDrN7gIw8PQjXIl5AP1SBuA,3276
12
12
  _mcp_mesh/engine/mesh_llm_agent.py,sha256=sVh7lPnvixDVJ-p1ONzbeakiEzhsl0HmdmrLPZA2FzQ,34237
13
- _mcp_mesh/engine/mesh_llm_agent_injector.py,sha256=4yp8Lmc-QtBUUirDy1Fmbtl2myybYv6HtnRaaTXcBg0,28372
13
+ _mcp_mesh/engine/mesh_llm_agent_injector.py,sha256=CHfyXWBjRPdsWtV5LTr1TsVPqKu6H0I0xZ2e62MB1p4,28820
14
14
  _mcp_mesh/engine/response_parser.py,sha256=g3VNoFJotaLrOAS0pL_OTCrv9t9XQe9Iiz1plsm28bQ,10280
15
15
  _mcp_mesh/engine/self_dependency_proxy.py,sha256=OkKt0-B_ADnJlWtHiHItoZCBZ7Su0iz2unEPFfXvrs4,3302
16
16
  _mcp_mesh/engine/session_aware_client.py,sha256=QejKag5zYNos5BVffQvNXFMECHFMLNOv78By4e_JzQE,10589
@@ -79,7 +79,7 @@ mesh/__init__.py,sha256=avMnUHkNAK7VgON2OhXkrFB290gr1HErghmTZpOXr-U,4207
79
79
  mesh/decorators.py,sha256=3h3tEhKWrlxBDYjP7vVM7iMPy7nx1oVSWVqzugC6WPM,67580
80
80
  mesh/helpers.py,sha256=1Y7V6aQvpV8BKfEeeKfjwPJ5g9FjMCzSNifs3se1jkA,12935
81
81
  mesh/types.py,sha256=vr0CKyPbP6lHgxj9kh_GMSLo3xkJ66PFPV_opfRb1H4,17772
82
- mcp_mesh-0.8.0b7.dist-info/METADATA,sha256=qHT5IkNk-JUQKqndyLF0Wjm9Mb_zGMBB2MN-uvgwepI,5040
83
- mcp_mesh-0.8.0b7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
84
- mcp_mesh-0.8.0b7.dist-info/licenses/LICENSE,sha256=_EBQHRQThv9FPOLc5eFOUdeeRO0mYwChC7cx60dM1tM,1078
85
- mcp_mesh-0.8.0b7.dist-info/RECORD,,
82
+ mcp_mesh-0.8.0b9.dist-info/METADATA,sha256=-M8ClhDxH5Y4v4lCg882IS6ebAzgNXTvG-nQrGG_Mzw,5040
83
+ mcp_mesh-0.8.0b9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
84
+ mcp_mesh-0.8.0b9.dist-info/licenses/LICENSE,sha256=_EBQHRQThv9FPOLc5eFOUdeeRO0mYwChC7cx60dM1tM,1078
85
+ mcp_mesh-0.8.0b9.dist-info/RECORD,,