lola-mcp-server 0.1.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lola-mcp-server
3
- Version: 0.1.0
3
+ Version: 0.2.0
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=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
@@ -2,92 +2,77 @@ from mcp.server.fastmcp import FastMCP
2
2
  import httpx
3
3
  import os
4
4
  import asyncio
5
+ import base64
6
+ import json
5
7
 
6
8
  mcp = FastMCP("Lola Suite MCP Bridge")
7
9
 
8
- # Change only via ENV later (no code edits needed)
9
- BASE_URL = os.getenv(
10
- "LOLA_BASE_URL",
11
- "https://extraneous-blaine-seclusive.ngrok-free.dev"
12
- )
10
+ BASE_URL = os.getenv("LOLA_API_BASE_URL")
11
+ ACCESS_TOKEN = os.getenv("LOLA_ACCESS_TOKEN")
12
+ AUTH_TOKEN = os.getenv("LOLA_AUTH_TOKEN")
13
13
 
14
- API_KEY = os.getenv("LOLA_API_KEY", "SUPER_SECRET_KEY_123")
14
+ if not BASE_URL or not BASE_URL.startswith("http"):
15
+ raise RuntimeError("LOLA_API_BASE_URL invalid")
16
+
17
+ if not ACCESS_TOKEN:
18
+ raise RuntimeError("LOLA_ACCESS_TOKEN required")
19
+
20
+ if not AUTH_TOKEN:
21
+ raise RuntimeError("LOLA_AUTH_TOKEN required")
15
22
 
16
23
 
17
24
  def headers():
18
25
  return {
19
- "Authorization": f"Bearer {API_KEY}",
26
+ "Authorization": f"Bearer {AUTH_TOKEN}",
20
27
  "Content-Type": "application/json",
21
28
  }
22
29
 
23
30
 
24
- # ---------------- HEALTH CHECK ----------------
31
+ # -------- Decode allowed tools from token --------
25
32
 
26
- async def health_check():
27
- async with httpx.AsyncClient(timeout=10.0) as client:
28
- try:
29
- r = await client.get(f"{BASE_URL}/tools_lola", headers=headers())
30
- r.raise_for_status()
31
- print(" Connected to backend:", BASE_URL)
32
- except Exception as e:
33
- raise RuntimeError(
34
- f"Cannot reach backend at {BASE_URL}. "
35
- "Make sure FastAPI and ngrok are running."
36
- ) from e
33
+ def allowed_tools():
34
+ payload = ACCESS_TOKEN.split(".")[0]
35
+ decoded = base64.b64decode(payload).decode()
36
+ data = json.loads(decoded)
37
+ return set(data["selections"]["lola_server"])
37
38
 
38
39
 
39
- # ---------------- HUBSPOT ----------------
40
+ # -------- Dynamic tool registration --------
40
41
 
41
- @mcp.tool()
42
- async def hubspot_list_tools():
43
- """List all HubSpot tools"""
44
- async with httpx.AsyncClient(timeout=30.0) as client:
45
- r = await client.get(f"{BASE_URL}/tools_hubspot", headers=headers())
46
- r.raise_for_status()
47
- return r.json()
42
+ async def register_tools():
43
+ allowed = allowed_tools()
48
44
 
45
+ async with httpx.AsyncClient() as client:
46
+ res = await client.get(f"{BASE_URL}/tools_lola", headers=headers())
47
+ tools = res.json()["tools"]
49
48
 
50
- @mcp.tool()
51
- async def hubspot_call_tool(name: str, arguments: dict):
52
- """Call a HubSpot tool"""
53
- async with httpx.AsyncClient(timeout=30.0) as client:
54
- r = await client.post(
55
- f"{BASE_URL}/call_hubspot",
56
- json={"name": name, "arguments": arguments},
57
- headers=headers(),
58
- )
59
- r.raise_for_status()
60
- return r.json()
49
+ for tool in tools:
50
+ name = tool["name"]
61
51
 
52
+ if name not in allowed:
53
+ continue
62
54
 
63
- # ---------------- LOLA ----------------
55
+ schema = tool["input_schema"]
56
+ desc = tool.get("description", "")
64
57
 
65
- @mcp.tool()
66
- async def lola_list_tools():
67
- """List all Lola tools"""
68
- async with httpx.AsyncClient(timeout=30.0) as client:
69
- r = await client.get(f"{BASE_URL}/tools_lola", headers=headers())
70
- r.raise_for_status()
71
- return r.json()
58
+ async def dynamic_tool(name=name, **kwargs):
59
+ async with httpx.AsyncClient() as client:
60
+ r = await client.post(
61
+ f"{BASE_URL}/call_lola",
62
+ json={"name": name, "arguments": kwargs},
63
+ headers=headers(),
64
+ )
65
+ return r.json()
72
66
 
67
+ mcp.tool(name=name, description=desc, input_schema=schema)(dynamic_tool)
73
68
 
74
- @mcp.tool()
75
- async def lola_call_tool(name: str, arguments: dict):
76
- """Call a Lola tool"""
77
- async with httpx.AsyncClient(timeout=30.0) as client:
78
- r = await client.post(
79
- f"{BASE_URL}/call_lola",
80
- json={"name": name, "arguments": arguments},
81
- headers=headers(),
82
- )
83
- r.raise_for_status()
84
- return r.json()
85
69
 
70
+ async def startup():
71
+ await register_tools()
86
72
 
87
- # ---------------- MAIN ----------------
88
73
 
89
74
  def main():
90
- asyncio.run(health_check())
75
+ asyncio.run(startup())
91
76
  mcp.run()
92
77
 
93
78
 
@@ -1,6 +0,0 @@
1
- public_mcp_server.py,sha256=eSqCe4WaHWJ2FrapGw24NQDWlua4MJl4Abo4vVNp3YI,2478
2
- lola_mcp_server-0.1.0.dist-info/METADATA,sha256=dGcKoCDhOpoAxHl27EfqlJUPR6CqJ34MuJZye0usCKw,145
3
- lola_mcp_server-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
4
- lola_mcp_server-0.1.0.dist-info/entry_points.txt,sha256=7ohrLpfi22BMGEDWSgn0tQLet94CcyP5AX1Tk5DbalI,59
5
- lola_mcp_server-0.1.0.dist-info/top_level.txt,sha256=mEMxVolBhbIAki_wnZGkv3e8U-6xFTL2TvC-iP2_MxU,18
6
- lola_mcp_server-0.1.0.dist-info/RECORD,,