mbxai 0.5.6__py3-none-any.whl → 0.5.7__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.
mbxai/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
2
  MBX AI package.
3
3
  """
4
4
 
5
- __version__ = "0.5.6"
5
+ __version__ = "0.5.7"
mbxai/mcp/client.py CHANGED
@@ -3,6 +3,7 @@
3
3
  from typing import Any, TypeVar, Callable
4
4
  import httpx
5
5
  import logging
6
+ import asyncio
6
7
  from pydantic import BaseModel, Field
7
8
 
8
9
  from ..tools import ToolClient, Tool
@@ -95,9 +96,25 @@ class MCPClient(ToolClient):
95
96
 
96
97
  # Create a sync wrapper for the async function
97
98
  def sync_tool_function(**kwargs: Any) -> Any:
98
- import asyncio
99
- loop = asyncio.get_event_loop()
100
- return loop.run_until_complete(tool_function(**kwargs))
99
+ try:
100
+ # Try to get the current event loop
101
+ loop = asyncio.get_event_loop()
102
+ except RuntimeError:
103
+ # If no event loop exists, create a new one
104
+ loop = asyncio.new_event_loop()
105
+ asyncio.set_event_loop(loop)
106
+
107
+ # Check if we're already in an event loop
108
+ if loop.is_running():
109
+ # Create a new event loop for this call
110
+ new_loop = asyncio.new_event_loop()
111
+ try:
112
+ return new_loop.run_until_complete(tool_function(**kwargs))
113
+ finally:
114
+ new_loop.close()
115
+ else:
116
+ # Use the existing event loop
117
+ return loop.run_until_complete(tool_function(**kwargs))
101
118
 
102
119
  return sync_tool_function
103
120
 
mbxai/mcp/server.py CHANGED
@@ -31,7 +31,7 @@ class MCPServer:
31
31
  self.app = FastAPI(
32
32
  title=self.name,
33
33
  description=self.description,
34
- version="0.5.6",
34
+ version="0.5.7",
35
35
  )
36
36
 
37
37
  # Initialize MCP server
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mbxai
3
- Version: 0.5.6
3
+ Version: 0.5.7
4
4
  Summary: MBX AI SDK
5
5
  Project-URL: Homepage, https://www.mibexx.de
6
6
  Project-URL: Documentation, https://www.mibexx.de
@@ -1,9 +1,9 @@
1
- mbxai/__init__.py,sha256=3cCdE3UF7hWaEKRs2Ftl0x1qU4zqaFY1bNSZR5-JcZ0,47
1
+ mbxai/__init__.py,sha256=jvqll5TM8QPQNLg3ReLmexr8D4C_VjvwJvoBki68cck,47
2
2
  mbxai/core.py,sha256=WMvmU9TTa7M_m-qWsUew4xH8Ul6xseCZ2iBCXJTW-Bs,196
3
3
  mbxai/mcp/__init__.py,sha256=_ek9iYdYqW5saKetj4qDci11jxesQDiHPJRpHMKkxgU,175
4
- mbxai/mcp/client.py,sha256=QxVeQRBQryeEGXDU8X_9qQBfT-ubDd9L9KSc5-P354U,5590
4
+ mbxai/mcp/client.py,sha256=q2YmtvUlmrkv0tA50DmeX9-wsDJy_-NVkkc69wSsGaY,6277
5
5
  mbxai/mcp/example.py,sha256=oaol7AvvZnX86JWNz64KvPjab5gg1VjVN3G8eFSzuaE,2350
6
- mbxai/mcp/server.py,sha256=LGhjJvUg2CiQ5i0C0aAqeXRghboz5sn7YBOEIaoSPXc,3462
6
+ mbxai/mcp/server.py,sha256=3brJK6NNjnLZgIajPF8CGbc_fwekkV5cxpieF9o4P5I,3462
7
7
  mbxai/openrouter/__init__.py,sha256=Ito9Qp_B6q-RLGAQcYyTJVWwR2YAZvNqE-HIYXxhtD8,298
8
8
  mbxai/openrouter/client.py,sha256=XLRMRNRJH96Jl6_af0KkzRDdLJnixh8I3RvEEcFuXyg,10840
9
9
  mbxai/openrouter/config.py,sha256=MTX_YHsFrM7JYqovJSkEF6JzVyIdajeI5Dja2CALH58,2874
@@ -12,7 +12,7 @@ mbxai/tools/__init__.py,sha256=QUFaXhDm-UKcuAtT1rbKzhBkvyRBVokcQIOf9cxIuwc,160
12
12
  mbxai/tools/client.py,sha256=f4i4lyLWeI81NPwnV8Rz1cO5bGh6kLHcxahNijUrTxw,7718
13
13
  mbxai/tools/example.py,sha256=1HgKK39zzUuwFbnp3f0ThyWVfA_8P28PZcTwaUw5K78,2232
14
14
  mbxai/tools/types.py,sha256=fo5t9UbsHGynhA88vD_ecgDqL8iLvt2E1h1ym43Rrgk,745
15
- mbxai-0.5.6.dist-info/METADATA,sha256=Y4o8ab_4BJvwsAvlrWD72eLkyg8S5v4LfWmeH6hsGBo,4107
16
- mbxai-0.5.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- mbxai-0.5.6.dist-info/licenses/LICENSE,sha256=hEyhc4FxwYo3NQ40yNgZ7STqwVk-1_XcTXOnAPbGJAw,1069
18
- mbxai-0.5.6.dist-info/RECORD,,
15
+ mbxai-0.5.7.dist-info/METADATA,sha256=nc8Rk_zETLzbOpPxSEw0nWEa_TROtALd7Z3qa7ZOT0E,4107
16
+ mbxai-0.5.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ mbxai-0.5.7.dist-info/licenses/LICENSE,sha256=hEyhc4FxwYo3NQ40yNgZ7STqwVk-1_XcTXOnAPbGJAw,1069
18
+ mbxai-0.5.7.dist-info/RECORD,,
File without changes