lola-mcp-server 0.1.4__tar.gz → 0.2.1__tar.gz

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,29 @@
1
+ # Lola MCP Server
2
+
3
+ This MCP server allows MCP-compatible clients (Claude, OpenAI, Cursor, etc.)
4
+ to access Lola and HubSpot tools via MCP.
5
+
6
+ ## Installation
7
+
8
+ pip install lola-mcp-server
9
+
10
+ ## MCP Configuration
11
+
12
+ Add to your MCP config:
13
+
14
+ {
15
+ "mcpServers": {
16
+ "lola-suite": {
17
+ "command": "pipx",
18
+ "args": ["run", "--no-cache", "lola-mcp-server"],
19
+ "env": {
20
+ "LOLA_API_BASE_URL": "https://extraneous-blaine-seclusive.ngrok-free.dev",
21
+ "LOLA_ACCESS_TOKEN": "eyJwYXNzd29yZF9oYXNoIjogImQ3OTk4NzA1MWEyNTUyYWMxODk1ZTA2Yjk3ZDEyZDhjZmU1OTI0ODcyZjYxZGJhNTljMTU1NTJiY2M4MzJmOWUiLCAic2VsZWN0aW9ucyI6IHsibG9sYV9zZXJ2ZXIiOiBbImNyZWF0ZV9hcHBvaW50bWVudF90b29sIiwgImNhbGVuZGFyX3Rvb2wiXX0sICJ0aW1lc3RhbXAiOiAiMjAyNi0wMi0wM1QxODoxMzoyOS45NjU5MjciLCAidXNlcm5hbWUiOiAibmFnZW5kcmFiYWJ1azI5QGdtYWlsLmNvbSJ9.c43443c876af084ef8fec2a732583adb095eecac4f678998856f4daacf025f8c",
22
+ "LOLA_AUTH_TOKEN": "lola-super-secret-bridge-key"
23
+ }
24
+ }
25
+ }
26
+ }
27
+
28
+
29
+ eyJwYXNzd29yZF9oYXNoIjogImQ3OTk4NzA1MWEyNTUyYWMxODk1ZTA2Yjk3ZDEyZDhjZmU1OTI0ODcyZjYxZGJhNTljMTU1NTJiY2M4MzJmOWUiLCAic2VsZWN0aW9ucyI6IHsibG9sYV9zZXJ2ZXIiOiBbImNyZWF0ZV9hcHBvaW50bWVudF90b29sIiwgImNhbGVuZGFyX3Rvb2wiXX0sICJ0aW1lc3RhbXAiOiAiMjAyNi0wMi0wM1QxODoxMzoyOS45NjU5MjciLCAidXNlcm5hbWUiOiAibmFnZW5kcmFiYWJ1azI5QGdtYWlsLmNvbSJ9.c43443c876af084ef8fec2a732583adb095eecac4f678998856f4daacf025f8c
@@ -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,96 @@
1
+ from mcp.server.fastmcp import FastMCP
2
+ import httpx
3
+ import os
4
+ import asyncio
5
+ import base64
6
+ import json
7
+
8
+ mcp = FastMCP("Lola Suite MCP Bridge")
9
+
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
+
14
+ # -------- Safety checks --------
15
+
16
+ if not BASE_URL or not BASE_URL.startswith("http"):
17
+ raise RuntimeError("LOLA_API_BASE_URL invalid")
18
+
19
+ if not ACCESS_TOKEN:
20
+ raise RuntimeError("LOLA_ACCESS_TOKEN required")
21
+
22
+ if not AUTH_TOKEN:
23
+ raise RuntimeError("LOLA_AUTH_TOKEN required")
24
+
25
+
26
+ def headers():
27
+ return {
28
+ "Authorization": f"Bearer {AUTH_TOKEN}",
29
+ "Content-Type": "application/json",
30
+ }
31
+
32
+
33
+ # -------- Decode allowed tools from token --------
34
+
35
+ def allowed_tools():
36
+ payload = ACCESS_TOKEN.split(".")[0]
37
+ decoded = base64.b64decode(payload).decode()
38
+ data = json.loads(decoded)
39
+ return set(data["selections"]["lola_server"])
40
+
41
+
42
+ # -------- Dynamic tool registration --------
43
+
44
+ async def register_tools():
45
+ allowed = allowed_tools()
46
+
47
+ # Normalize allowed tool names from token
48
+ allowed_normalized = {t.lower().strip() for t in allowed}
49
+
50
+ async with httpx.AsyncClient() as client:
51
+ res = await client.get(f"{BASE_URL}/tools_lola", headers=headers())
52
+ res.raise_for_status()
53
+ tools = res.json()["tools"]
54
+
55
+ for tool in tools:
56
+ name = tool["name"]
57
+ normalized_name = name.lower().strip()
58
+
59
+ # Match token tools with server tools
60
+ if normalized_name not in allowed_normalized:
61
+ continue
62
+
63
+ schema = tool["input_schema"]
64
+ desc = tool.get("description", "")
65
+
66
+ # Important: capture name correctly
67
+ async def dynamic_tool(name=name, **kwargs):
68
+ async with httpx.AsyncClient() as client:
69
+ r = await client.post(
70
+ f"{BASE_URL}/call_lola",
71
+ json={"name": name, "arguments": kwargs},
72
+ headers=headers(),
73
+ )
74
+ r.raise_for_status()
75
+ return r.json()
76
+
77
+ mcp.tool(
78
+ name=name,
79
+ description=desc,
80
+ input_schema=schema
81
+ )(dynamic_tool)
82
+
83
+
84
+ # -------- Startup --------
85
+
86
+ async def startup():
87
+ await register_tools()
88
+
89
+
90
+ def main():
91
+ asyncio.run(startup())
92
+ mcp.run()
93
+
94
+
95
+ if __name__ == "__main__":
96
+ main()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lola-mcp-server"
3
- version = "0.1.4"
3
+ version = "0.2.1"
4
4
  description = "MCP bridge to Lola & HubSpot servers"
5
5
  dependencies = [
6
6
  "mcp",
@@ -1,24 +0,0 @@
1
- # Lola MCP Server
2
-
3
- This MCP server allows MCP-compatible clients (Claude, OpenAI, Cursor, etc.)
4
- to access Lola and HubSpot tools via MCP.
5
-
6
- ## Installation
7
-
8
- pip install lola-mcp-server
9
-
10
- ## MCP Configuration
11
-
12
- Add to your MCP config:
13
-
14
- {
15
- "mcpServers": {
16
- "lola-suite": {
17
- "command": "lola-mcp-server",
18
- "env": {
19
- "LOLA_BASE_URL": "https://extraneous-blaine-seclusive.ngrok-free.dev",
20
- "LOLA_API_KEY": "SUPER_SECRET_KEY_123"
21
- }
22
- }
23
- }
24
- }
@@ -1,96 +0,0 @@
1
- from mcp.server.fastmcp import FastMCP
2
- import httpx
3
- import os
4
- import asyncio
5
- import base64
6
- import json
7
-
8
- mcp = FastMCP("Lola Suite MCP Bridge")
9
-
10
- BASE_URL = os.getenv("LOLA_BASE_URL")
11
- ACCESS_TOKEN = os.getenv("LOLA_ACCESS_TOKEN")
12
-
13
-
14
- # ---------------- SAFETY CHECK ----------------
15
-
16
- if not BASE_URL or not BASE_URL.startswith("http"):
17
- raise RuntimeError("LOLA_BASE_URL must be a full https:// URL")
18
-
19
- if not ACCESS_TOKEN:
20
- raise RuntimeError("LOLA_ACCESS_TOKEN is required")
21
-
22
-
23
- def headers():
24
- return {
25
- "Authorization": f"Bearer {ACCESS_TOKEN}",
26
- "Content-Type": "application/json",
27
- }
28
-
29
-
30
- # ---------------- DECODE TOKEN ----------------
31
-
32
- def get_allowed_tools():
33
- """
34
- Extract allowed tool list from the access token payload
35
- """
36
- payload = ACCESS_TOKEN.split(".")[0]
37
- decoded = base64.b64decode(payload).decode()
38
- data = json.loads(decoded)
39
-
40
- return set(
41
- data.get("selections", {})
42
- .get("lola_server", [])
43
- )
44
-
45
-
46
- # ---------------- DYNAMIC TOOL REGISTRATION ----------------
47
-
48
- async def register_tools():
49
- allowed = get_allowed_tools()
50
-
51
- async with httpx.AsyncClient(timeout=30.0) as client:
52
- res = await client.get(f"{BASE_URL}/tools_lola", headers=headers())
53
- res.raise_for_status()
54
- tools = res.json()["tools"]
55
-
56
- for tool in tools:
57
- tool_name = tool["name"]
58
-
59
- # 🔒 Filter tools by access token
60
- if tool_name not in allowed:
61
- continue
62
-
63
- input_schema = tool["input_schema"]
64
- description = tool.get("description", "")
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:
69
- r = await client.post(
70
- f"{BASE_URL}/call_lola",
71
- json={"name": tool_name, "arguments": kwargs},
72
- headers=headers(),
73
- )
74
- r.raise_for_status()
75
- return r.json()
76
-
77
- mcp.tool(
78
- name=tool_name,
79
- description=description,
80
- input_schema=input_schema,
81
- )(dynamic_tool)
82
-
83
-
84
- # ---------------- MAIN ----------------
85
-
86
- async def startup():
87
- await register_tools()
88
-
89
-
90
- def main():
91
- asyncio.run(startup())
92
- mcp.run()
93
-
94
-
95
- if __name__ == "__main__":
96
- main()