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 +1 -1
- mbxai/mcp/client.py +20 -3
- mbxai/mcp/server.py +1 -1
- {mbxai-0.5.6.dist-info → mbxai-0.5.7.dist-info}/METADATA +1 -1
- {mbxai-0.5.6.dist-info → mbxai-0.5.7.dist-info}/RECORD +7 -7
- {mbxai-0.5.6.dist-info → mbxai-0.5.7.dist-info}/WHEEL +0 -0
- {mbxai-0.5.6.dist-info → mbxai-0.5.7.dist-info}/licenses/LICENSE +0 -0
mbxai/__init__.py
CHANGED
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
|
-
|
99
|
-
|
100
|
-
|
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
@@ -1,9 +1,9 @@
|
|
1
|
-
mbxai/__init__.py,sha256=
|
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=
|
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=
|
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.
|
16
|
-
mbxai-0.5.
|
17
|
-
mbxai-0.5.
|
18
|
-
mbxai-0.5.
|
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
|
File without changes
|