lola-mcp-server 0.1.4__py3-none-any.whl → 0.2.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lola-mcp-server
3
- Version: 0.1.4
3
+ Version: 0.2.1
4
4
  Summary: MCP bridge to Lola & HubSpot servers
5
5
  Requires-Dist: mcp
6
6
  Requires-Dist: httpx
@@ -0,0 +1,6 @@
1
+ public_mcp_server.py,sha256=RcB7GkIRPFN0DWFeX93_Ntch3Nny5Wyzz1pJQWz-Iig,2371
2
+ lola_mcp_server-0.2.1.dist-info/METADATA,sha256=stzIOuIYDt2FtHasFRChULjDnc9DrRoIMzbbIZHSXl4,145
3
+ lola_mcp_server-0.2.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
4
+ lola_mcp_server-0.2.1.dist-info/entry_points.txt,sha256=7ohrLpfi22BMGEDWSgn0tQLet94CcyP5AX1Tk5DbalI,59
5
+ lola_mcp_server-0.2.1.dist-info/top_level.txt,sha256=mEMxVolBhbIAki_wnZGkv3e8U-6xFTL2TvC-iP2_MxU,18
6
+ lola_mcp_server-0.2.1.dist-info/RECORD,,
public_mcp_server.py CHANGED
@@ -7,81 +7,81 @@ import json
7
7
 
8
8
  mcp = FastMCP("Lola Suite MCP Bridge")
9
9
 
10
- BASE_URL = os.getenv("LOLA_BASE_URL")
10
+ BASE_URL = os.getenv("LOLA_API_BASE_URL")
11
11
  ACCESS_TOKEN = os.getenv("LOLA_ACCESS_TOKEN")
12
+ AUTH_TOKEN = os.getenv("LOLA_AUTH_TOKEN")
12
13
 
13
-
14
- # ---------------- SAFETY CHECK ----------------
14
+ # -------- Safety checks --------
15
15
 
16
16
  if not BASE_URL or not BASE_URL.startswith("http"):
17
- raise RuntimeError("LOLA_BASE_URL must be a full https:// URL")
17
+ raise RuntimeError("LOLA_API_BASE_URL invalid")
18
18
 
19
19
  if not ACCESS_TOKEN:
20
- raise RuntimeError("LOLA_ACCESS_TOKEN is required")
20
+ raise RuntimeError("LOLA_ACCESS_TOKEN required")
21
+
22
+ if not AUTH_TOKEN:
23
+ raise RuntimeError("LOLA_AUTH_TOKEN required")
21
24
 
22
25
 
23
26
  def headers():
24
27
  return {
25
- "Authorization": f"Bearer {ACCESS_TOKEN}",
28
+ "Authorization": f"Bearer {AUTH_TOKEN}",
26
29
  "Content-Type": "application/json",
27
30
  }
28
31
 
29
32
 
30
- # ---------------- DECODE TOKEN ----------------
33
+ # -------- Decode allowed tools from token --------
31
34
 
32
- def get_allowed_tools():
33
- """
34
- Extract allowed tool list from the access token payload
35
- """
35
+ def allowed_tools():
36
36
  payload = ACCESS_TOKEN.split(".")[0]
37
37
  decoded = base64.b64decode(payload).decode()
38
38
  data = json.loads(decoded)
39
+ return set(data["selections"]["lola_server"])
39
40
 
40
- return set(
41
- data.get("selections", {})
42
- .get("lola_server", [])
43
- )
44
41
 
45
-
46
- # ---------------- DYNAMIC TOOL REGISTRATION ----------------
42
+ # -------- Dynamic tool registration --------
47
43
 
48
44
  async def register_tools():
49
- allowed = get_allowed_tools()
45
+ allowed = allowed_tools()
46
+
47
+ # Normalize allowed tool names from token
48
+ allowed_normalized = {t.lower().strip() for t in allowed}
50
49
 
51
- async with httpx.AsyncClient(timeout=30.0) as client:
50
+ async with httpx.AsyncClient() as client:
52
51
  res = await client.get(f"{BASE_URL}/tools_lola", headers=headers())
53
52
  res.raise_for_status()
54
53
  tools = res.json()["tools"]
55
54
 
56
55
  for tool in tools:
57
- tool_name = tool["name"]
56
+ name = tool["name"]
57
+ normalized_name = name.lower().strip()
58
58
 
59
- # 🔒 Filter tools by access token
60
- if tool_name not in allowed:
59
+ # Match token tools with server tools
60
+ if normalized_name not in allowed_normalized:
61
61
  continue
62
62
 
63
- input_schema = tool["input_schema"]
64
- description = tool.get("description", "")
63
+ schema = tool["input_schema"]
64
+ desc = tool.get("description", "")
65
65
 
66
- # ⚠️ Important: capture tool_name correctly (closure fix)
67
- async def dynamic_tool(tool_name=tool_name, **kwargs):
68
- async with httpx.AsyncClient(timeout=30.0) as client:
66
+ # Important: capture name correctly
67
+ async def dynamic_tool(name=name, **kwargs):
68
+ async with httpx.AsyncClient() as client:
69
69
  r = await client.post(
70
70
  f"{BASE_URL}/call_lola",
71
- json={"name": tool_name, "arguments": kwargs},
71
+ json={"name": name, "arguments": kwargs},
72
72
  headers=headers(),
73
73
  )
74
74
  r.raise_for_status()
75
75
  return r.json()
76
76
 
77
77
  mcp.tool(
78
- name=tool_name,
79
- description=description,
80
- input_schema=input_schema,
78
+ name=name,
79
+ description=desc,
80
+ input_schema=schema
81
81
  )(dynamic_tool)
82
82
 
83
83
 
84
- # ---------------- MAIN ----------------
84
+ # -------- Startup --------
85
85
 
86
86
  async def startup():
87
87
  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,,