Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,9 +28,26 @@ from mcp import ClientSession, StdioServerParameters
|
|
| 28 |
from mcp.client.stdio import stdio_client
|
| 29 |
from sklearn.ensemble import HistGradientBoostingClassifier
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
SERVER = StdioServerParameters(
|
| 32 |
-
command=
|
| 33 |
-
args=
|
| 34 |
env={
|
| 35 |
**os.environ,
|
| 36 |
"TICKSCOPE_EXCHANGES": "binance,bybit,okx",
|
|
|
|
| 28 |
from mcp.client.stdio import stdio_client
|
| 29 |
from sklearn.ensemble import HistGradientBoostingClassifier
|
| 30 |
|
| 31 |
+
def _launcher():
|
| 32 |
+
"""PATH'te uvx yoksa sırayla alternatifleri dener."""
|
| 33 |
+
import importlib.util
|
| 34 |
+
import shutil
|
| 35 |
+
import sys
|
| 36 |
+
|
| 37 |
+
if shutil.which("uvx"):
|
| 38 |
+
return "uvx", ["tickscope-mcp"]
|
| 39 |
+
if shutil.which("tickscope-mcp"): # pip install tickscope-mcp
|
| 40 |
+
return "tickscope-mcp", []
|
| 41 |
+
if importlib.util.find_spec("uv"): # pip install uv -> python -m uv
|
| 42 |
+
return sys.executable, ["-m", "uv", "tool", "run", "tickscope-mcp"]
|
| 43 |
+
raise RuntimeError("Tickscope başlatılamadı. Çalıştır: pip install tickscope-mcp")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
_CMD, _ARGS = _launcher()
|
| 47 |
+
|
| 48 |
SERVER = StdioServerParameters(
|
| 49 |
+
command=_CMD,
|
| 50 |
+
args=_ARGS,
|
| 51 |
env={
|
| 52 |
**os.environ,
|
| 53 |
"TICKSCOPE_EXCHANGES": "binance,bybit,okx",
|