lola-mcp-server 0.1.4__py3-none-any.whl → 0.2.0__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.
- {lola_mcp_server-0.1.4.dist-info → lola_mcp_server-0.2.0.dist-info}/METADATA +1 -1
- lola_mcp_server-0.2.0.dist-info/RECORD +6 -0
- public_mcp_server.py +22 -38
- lola_mcp_server-0.1.4.dist-info/RECORD +0 -6
- {lola_mcp_server-0.1.4.dist-info → lola_mcp_server-0.2.0.dist-info}/WHEEL +0 -0
- {lola_mcp_server-0.1.4.dist-info → lola_mcp_server-0.2.0.dist-info}/entry_points.txt +0 -0
- {lola_mcp_server-0.1.4.dist-info → lola_mcp_server-0.2.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
public_mcp_server.py,sha256=oHhe4s6D5Va7PzlElZxwD4MsUTRVbhIDzSH5fUkvWQs,1925
|
|
2
|
+
lola_mcp_server-0.2.0.dist-info/METADATA,sha256=41CPkpuO7z6G_JAq-ctDJBKlf4MApb-EexKO2ESnHWs,145
|
|
3
|
+
lola_mcp_server-0.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
4
|
+
lola_mcp_server-0.2.0.dist-info/entry_points.txt,sha256=7ohrLpfi22BMGEDWSgn0tQLet94CcyP5AX1Tk5DbalI,59
|
|
5
|
+
lola_mcp_server-0.2.0.dist-info/top_level.txt,sha256=mEMxVolBhbIAki_wnZGkv3e8U-6xFTL2TvC-iP2_MxU,18
|
|
6
|
+
lola_mcp_server-0.2.0.dist-info/RECORD,,
|
public_mcp_server.py
CHANGED
|
@@ -7,81 +7,65 @@ import json
|
|
|
7
7
|
|
|
8
8
|
mcp = FastMCP("Lola Suite MCP Bridge")
|
|
9
9
|
|
|
10
|
-
BASE_URL = os.getenv("
|
|
10
|
+
BASE_URL = os.getenv("LOLA_API_BASE_URL")
|
|
11
11
|
ACCESS_TOKEN = os.getenv("LOLA_ACCESS_TOKEN")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# ---------------- SAFETY CHECK ----------------
|
|
12
|
+
AUTH_TOKEN = os.getenv("LOLA_AUTH_TOKEN")
|
|
15
13
|
|
|
16
14
|
if not BASE_URL or not BASE_URL.startswith("http"):
|
|
17
|
-
raise RuntimeError("
|
|
15
|
+
raise RuntimeError("LOLA_API_BASE_URL invalid")
|
|
18
16
|
|
|
19
17
|
if not ACCESS_TOKEN:
|
|
20
|
-
raise RuntimeError("LOLA_ACCESS_TOKEN
|
|
18
|
+
raise RuntimeError("LOLA_ACCESS_TOKEN required")
|
|
19
|
+
|
|
20
|
+
if not AUTH_TOKEN:
|
|
21
|
+
raise RuntimeError("LOLA_AUTH_TOKEN required")
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
def headers():
|
|
24
25
|
return {
|
|
25
|
-
"Authorization": f"Bearer {
|
|
26
|
+
"Authorization": f"Bearer {AUTH_TOKEN}",
|
|
26
27
|
"Content-Type": "application/json",
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
#
|
|
31
|
+
# -------- Decode allowed tools from token --------
|
|
31
32
|
|
|
32
|
-
def
|
|
33
|
-
"""
|
|
34
|
-
Extract allowed tool list from the access token payload
|
|
35
|
-
"""
|
|
33
|
+
def allowed_tools():
|
|
36
34
|
payload = ACCESS_TOKEN.split(".")[0]
|
|
37
35
|
decoded = base64.b64decode(payload).decode()
|
|
38
36
|
data = json.loads(decoded)
|
|
37
|
+
return set(data["selections"]["lola_server"])
|
|
39
38
|
|
|
40
|
-
return set(
|
|
41
|
-
data.get("selections", {})
|
|
42
|
-
.get("lola_server", [])
|
|
43
|
-
)
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
# ---------------- DYNAMIC TOOL REGISTRATION ----------------
|
|
40
|
+
# -------- Dynamic tool registration --------
|
|
47
41
|
|
|
48
42
|
async def register_tools():
|
|
49
|
-
allowed =
|
|
43
|
+
allowed = allowed_tools()
|
|
50
44
|
|
|
51
|
-
async with httpx.AsyncClient(
|
|
45
|
+
async with httpx.AsyncClient() as client:
|
|
52
46
|
res = await client.get(f"{BASE_URL}/tools_lola", headers=headers())
|
|
53
|
-
res.raise_for_status()
|
|
54
47
|
tools = res.json()["tools"]
|
|
55
48
|
|
|
56
49
|
for tool in tools:
|
|
57
|
-
|
|
50
|
+
name = tool["name"]
|
|
58
51
|
|
|
59
|
-
|
|
60
|
-
if tool_name not in allowed:
|
|
52
|
+
if name not in allowed:
|
|
61
53
|
continue
|
|
62
54
|
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
schema = tool["input_schema"]
|
|
56
|
+
desc = tool.get("description", "")
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
async with httpx.AsyncClient(timeout=30.0) as client:
|
|
58
|
+
async def dynamic_tool(name=name, **kwargs):
|
|
59
|
+
async with httpx.AsyncClient() as client:
|
|
69
60
|
r = await client.post(
|
|
70
61
|
f"{BASE_URL}/call_lola",
|
|
71
|
-
json={"name":
|
|
62
|
+
json={"name": name, "arguments": kwargs},
|
|
72
63
|
headers=headers(),
|
|
73
64
|
)
|
|
74
|
-
r.raise_for_status()
|
|
75
65
|
return r.json()
|
|
76
66
|
|
|
77
|
-
mcp.tool(
|
|
78
|
-
name=tool_name,
|
|
79
|
-
description=description,
|
|
80
|
-
input_schema=input_schema,
|
|
81
|
-
)(dynamic_tool)
|
|
82
|
-
|
|
67
|
+
mcp.tool(name=name, description=desc, input_schema=schema)(dynamic_tool)
|
|
83
68
|
|
|
84
|
-
# ---------------- MAIN ----------------
|
|
85
69
|
|
|
86
70
|
async def startup():
|
|
87
71
|
await register_tools()
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
public_mcp_server.py,sha256=JVw_g5MUaYAhWahkD7rzA_GbVnl9mCYfBnFAurKhLLI,2372
|
|
2
|
-
lola_mcp_server-0.1.4.dist-info/METADATA,sha256=el5qYIT_DwqZUlzYkEY6Ct4LFuvwQgpre_65KdnubDI,145
|
|
3
|
-
lola_mcp_server-0.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
4
|
-
lola_mcp_server-0.1.4.dist-info/entry_points.txt,sha256=7ohrLpfi22BMGEDWSgn0tQLet94CcyP5AX1Tk5DbalI,59
|
|
5
|
-
lola_mcp_server-0.1.4.dist-info/top_level.txt,sha256=mEMxVolBhbIAki_wnZGkv3e8U-6xFTL2TvC-iP2_MxU,18
|
|
6
|
-
lola_mcp_server-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|