getbased-agent-stack 0.5.4__tar.gz → 0.5.6__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.
- {getbased_agent_stack-0.5.4/src/getbased_agent_stack.egg-info → getbased_agent_stack-0.5.6}/PKG-INFO +3 -3
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/README.md +1 -1
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/pyproject.toml +2 -2
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/__init__.py +1 -1
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/cli.py +158 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/mcp_configs.py +63 -5
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6/src/getbased_agent_stack.egg-info}/PKG-INFO +3 -3
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack.egg-info/requires.txt +1 -1
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/tests/test_cli.py +124 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/tests/test_mcp_configs.py +29 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/LICENSE +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/setup.cfg +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/env_file.py +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/systemd/getbased-dashboard.service +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/systemd/getbased-rag.service +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/units.py +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack.egg-info/SOURCES.txt +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack.egg-info/dependency_links.txt +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack.egg-info/entry_points.txt +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack.egg-info/top_level.txt +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/tests/test_env_file.py +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/tests/test_integration.py +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/tests/test_systemd_units.py +0 -0
- {getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/tests/test_units.py +0 -0
{getbased_agent_stack-0.5.4/src/getbased_agent_stack.egg-info → getbased_agent_stack-0.5.6}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: getbased-agent-stack
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.6
|
|
4
4
|
Summary: One-command install of the full getbased agent stack — getbased-mcp + getbased-rag + getbased-dashboard
|
|
5
5
|
License-Expression: AGPL-3.0-or-later
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -8,7 +8,7 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Dist: getbased-mcp>=0.2.6
|
|
10
10
|
Requires-Dist: getbased-rag>=0.7.2
|
|
11
|
-
Requires-Dist: getbased-dashboard>=0.6.
|
|
11
|
+
Requires-Dist: getbased-dashboard>=0.6.5
|
|
12
12
|
Provides-Extra: full
|
|
13
13
|
Requires-Dist: getbased-rag[full]>=0.7.2; extra == "full"
|
|
14
14
|
Provides-Extra: test
|
|
@@ -79,7 +79,7 @@ getbased-stack init --yes
|
|
|
79
79
|
|
|
80
80
|
The wizard (~30 seconds):
|
|
81
81
|
|
|
82
|
-
1. Prompts for your `GETBASED_TOKEN` and `GETBASED_AGENT_CONTEXT_KEY` (skip if you don't use Agent Access; `--yes`
|
|
82
|
+
1. Prompts for your `GETBASED_TOKEN` and `GETBASED_AGENT_CONTEXT_KEY` when you opt into Agent Access (skip if you don't use Agent Access; `--yes` skips prompts)
|
|
83
83
|
2. Generates a rag API key if one doesn't exist
|
|
84
84
|
3. Writes `~/.config/getbased/env` (mode 0600) — the shared config file
|
|
85
85
|
4. Installs systemd user units for rag + dashboard, enables them, starts them
|
|
@@ -60,7 +60,7 @@ getbased-stack init --yes
|
|
|
60
60
|
|
|
61
61
|
The wizard (~30 seconds):
|
|
62
62
|
|
|
63
|
-
1. Prompts for your `GETBASED_TOKEN` and `GETBASED_AGENT_CONTEXT_KEY` (skip if you don't use Agent Access; `--yes`
|
|
63
|
+
1. Prompts for your `GETBASED_TOKEN` and `GETBASED_AGENT_CONTEXT_KEY` when you opt into Agent Access (skip if you don't use Agent Access; `--yes` skips prompts)
|
|
64
64
|
2. Generates a rag API key if one doesn't exist
|
|
65
65
|
3. Writes `~/.config/getbased/env` (mode 0600) — the shared config file
|
|
66
66
|
4. Installs systemd user units for rag + dashboard, enables them, starts them
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "getbased-agent-stack"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.6"
|
|
8
8
|
description = "One-command install of the full getbased agent stack — getbased-mcp + getbased-rag + getbased-dashboard"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "AGPL-3.0-or-later"
|
|
@@ -14,7 +14,7 @@ requires-python = ">=3.10"
|
|
|
14
14
|
dependencies = [
|
|
15
15
|
"getbased-mcp>=0.2.6",
|
|
16
16
|
"getbased-rag>=0.7.2",
|
|
17
|
-
"getbased-dashboard>=0.6.
|
|
17
|
+
"getbased-dashboard>=0.6.5",
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
[project.optional-dependencies]
|
|
@@ -16,9 +16,12 @@ python-dotenv. The env file format is simple enough that we own it.
|
|
|
16
16
|
from __future__ import annotations
|
|
17
17
|
|
|
18
18
|
import argparse
|
|
19
|
+
import base64
|
|
20
|
+
import json
|
|
19
21
|
import os
|
|
20
22
|
import secrets
|
|
21
23
|
import shutil
|
|
24
|
+
import subprocess
|
|
22
25
|
import sys
|
|
23
26
|
from pathlib import Path
|
|
24
27
|
|
|
@@ -289,6 +292,143 @@ def cmd_mcp_config(args: argparse.Namespace) -> int:
|
|
|
289
292
|
return 0
|
|
290
293
|
|
|
291
294
|
|
|
295
|
+
def _decode_setup_payload(setup: str) -> "dict[str, str]":
|
|
296
|
+
prefix = "gbsetup_v1_"
|
|
297
|
+
if not setup.startswith(prefix):
|
|
298
|
+
raise ValueError("setup code must start with gbsetup_v1_")
|
|
299
|
+
raw = setup[len(prefix):].strip()
|
|
300
|
+
if not raw:
|
|
301
|
+
raise ValueError("empty setup payload")
|
|
302
|
+
padded = raw + "=" * (-len(raw) % 4)
|
|
303
|
+
try:
|
|
304
|
+
data = json.loads(base64.urlsafe_b64decode(padded.encode("ascii")).decode("utf-8"))
|
|
305
|
+
except Exception as exc:
|
|
306
|
+
raise ValueError("setup payload is not valid base64url JSON") from exc
|
|
307
|
+
if not isinstance(data, dict) or data.get("version") != 1:
|
|
308
|
+
raise ValueError("unsupported setup payload version")
|
|
309
|
+
token = str(data.get("token") or "").strip()
|
|
310
|
+
context_key = str(data.get("contextKey") or data.get("context_key") or "").strip()
|
|
311
|
+
gateway = str(data.get("gateway") or "https://sync.getbased.health").strip()
|
|
312
|
+
if not token:
|
|
313
|
+
raise ValueError("setup payload is missing token")
|
|
314
|
+
if not context_key:
|
|
315
|
+
raise ValueError("setup payload is missing contextKey")
|
|
316
|
+
if not gateway.startswith(("https://", "http://")):
|
|
317
|
+
raise ValueError("gateway must be an http(s) URL")
|
|
318
|
+
return {"token": token, "context_key": context_key, "gateway": gateway}
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def _run_checked(cmd: "list[str]", label: str, *, required: bool = True, input_text: str | None = None) -> bool:
|
|
322
|
+
try:
|
|
323
|
+
res = subprocess.run(cmd, text=True, input=input_text, capture_output=True, check=False)
|
|
324
|
+
except FileNotFoundError:
|
|
325
|
+
if required:
|
|
326
|
+
print(f"{label} failed: command not found: {cmd[0]}", file=sys.stderr)
|
|
327
|
+
else:
|
|
328
|
+
print(f" skipped {label}: command not found: {cmd[0]}")
|
|
329
|
+
return False
|
|
330
|
+
if res.returncode == 0:
|
|
331
|
+
return True
|
|
332
|
+
msg = (res.stderr or res.stdout or "").strip()
|
|
333
|
+
if required:
|
|
334
|
+
print(f"{label} failed ({res.returncode})" + (f": {msg}" if msg else ""), file=sys.stderr)
|
|
335
|
+
else:
|
|
336
|
+
print(f" skipped {label}: command exited {res.returncode}" + (f" ({msg})" if msg else ""))
|
|
337
|
+
return False
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def _process_tree_contains_hermes() -> bool:
|
|
341
|
+
"""True when this command is running inside a Hermes-managed child process.
|
|
342
|
+
|
|
343
|
+
Restarting Hermes from a command spawned by the running gateway can SIGTERM
|
|
344
|
+
the setup process before it reports success. A normal SSH/shell terminal on
|
|
345
|
+
the same host will not have `hermes` in its parent process tree, so the
|
|
346
|
+
one-paste setup still performs the restart there.
|
|
347
|
+
"""
|
|
348
|
+
if os.environ.get("GETBASED_STACK_ASSUME_HERMES_CHILD") == "1":
|
|
349
|
+
return True
|
|
350
|
+
if os.environ.get("GETBASED_STACK_ASSUME_HERMES_CHILD") == "0":
|
|
351
|
+
return False
|
|
352
|
+
pid = os.getppid()
|
|
353
|
+
seen: set[int] = set()
|
|
354
|
+
while pid > 1 and pid not in seen:
|
|
355
|
+
seen.add(pid)
|
|
356
|
+
proc = Path("/proc") / str(pid)
|
|
357
|
+
try:
|
|
358
|
+
comm = (proc / "comm").read_text(errors="ignore").strip().lower()
|
|
359
|
+
cmdline = (proc / "cmdline").read_text(errors="ignore").replace("\x00", " ").lower()
|
|
360
|
+
if comm == "hermes" or "hermes" in cmdline:
|
|
361
|
+
return True
|
|
362
|
+
stat = (proc / "stat").read_text(errors="ignore")
|
|
363
|
+
# /proc/<pid>/stat format: pid (comm) state ppid ...; comm may contain
|
|
364
|
+
# spaces, so split after the final ')'.
|
|
365
|
+
rest = stat.rsplit(")", 1)[1].strip().split()
|
|
366
|
+
pid = int(rest[1]) if len(rest) > 1 else 1
|
|
367
|
+
except Exception:
|
|
368
|
+
return False
|
|
369
|
+
return False
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def _maybe_restart_hermes_gateway(hermes: str, *, no_restart: bool) -> None:
|
|
373
|
+
if no_restart:
|
|
374
|
+
print("• Hermes gateway restart skipped by --no-restart. Run it manually after setup if Hermes is already running.")
|
|
375
|
+
return
|
|
376
|
+
if _process_tree_contains_hermes():
|
|
377
|
+
print("• Hermes gateway restart skipped because this setup is running inside Hermes. Restart Hermes from an external shell after this command finishes.")
|
|
378
|
+
return
|
|
379
|
+
if _run_checked([hermes, "gateway", "restart"], "Hermes gateway restart", required=False):
|
|
380
|
+
print("✓ Hermes gateway restart requested")
|
|
381
|
+
else:
|
|
382
|
+
print("• Restart Hermes manually if it is already running: hermes gateway restart")
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
def cmd_connect(args: argparse.Namespace) -> int:
|
|
386
|
+
client = args.client
|
|
387
|
+
try:
|
|
388
|
+
setup = _decode_setup_payload(args.setup)
|
|
389
|
+
except ValueError as e:
|
|
390
|
+
print(f"Invalid setup: {e}", file=sys.stderr)
|
|
391
|
+
return 2
|
|
392
|
+
|
|
393
|
+
current = env_file.read_env_file()
|
|
394
|
+
current["GETBASED_STACK_MANAGED"] = "1"
|
|
395
|
+
current["GETBASED_TOKEN"] = setup["token"]
|
|
396
|
+
current["GETBASED_AGENT_CONTEXT_KEY"] = setup["context_key"]
|
|
397
|
+
current["GETBASED_GATEWAY"] = setup["gateway"]
|
|
398
|
+
current.setdefault("LENS_URL", "http://127.0.0.1:8322")
|
|
399
|
+
path = env_file.write_env_file(current)
|
|
400
|
+
print(f"✓ Agent Access credentials stored in {path} (mode 0600)")
|
|
401
|
+
|
|
402
|
+
mcp_cmd = shutil.which("getbased-mcp") or "getbased-mcp"
|
|
403
|
+
|
|
404
|
+
if client == "hermes":
|
|
405
|
+
hermes = shutil.which("hermes")
|
|
406
|
+
if not hermes:
|
|
407
|
+
print("Hermes CLI not found on PATH. Install Hermes or paste `getbased-stack mcp-config hermes` manually.", file=sys.stderr)
|
|
408
|
+
return 1
|
|
409
|
+
add_cmd = [
|
|
410
|
+
hermes, "mcp", "add", "getbased",
|
|
411
|
+
"--command", mcp_cmd,
|
|
412
|
+
"--env", "GETBASED_STACK_MANAGED=1",
|
|
413
|
+
]
|
|
414
|
+
if not _run_checked(add_cmd, "Hermes MCP registration", input_text="y\ny\n"):
|
|
415
|
+
return 1
|
|
416
|
+
print("✓ Hermes MCP server registered")
|
|
417
|
+
if _run_checked([hermes, "mcp", "test", "getbased"], "Hermes MCP test", required=False):
|
|
418
|
+
print("✓ Connection test passed")
|
|
419
|
+
else:
|
|
420
|
+
print("• Connection test skipped/failed; run `hermes mcp test getbased` after restarting Hermes.")
|
|
421
|
+
if not args.no_restart:
|
|
422
|
+
_maybe_restart_hermes_gateway(hermes, no_restart=args.no_restart)
|
|
423
|
+
else:
|
|
424
|
+
_maybe_restart_hermes_gateway(hermes, no_restart=True)
|
|
425
|
+
print("Done. Ask Hermes: “Read my getbased profile.”")
|
|
426
|
+
return 0
|
|
427
|
+
|
|
428
|
+
print(f"Stored Agent Access credentials. Generate/paste this client config next: getbased-stack mcp-config {client}")
|
|
429
|
+
return 0
|
|
430
|
+
|
|
431
|
+
|
|
292
432
|
def cmd_version(args: argparse.Namespace) -> int:
|
|
293
433
|
try:
|
|
294
434
|
import importlib.metadata as md
|
|
@@ -375,6 +515,23 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
375
515
|
help="Which client to emit for.",
|
|
376
516
|
)
|
|
377
517
|
|
|
518
|
+
pc = sub.add_parser("connect", help="Store an Agent Access setup code and configure a client.")
|
|
519
|
+
pc.add_argument(
|
|
520
|
+
"client",
|
|
521
|
+
choices=mcp_configs.SUPPORTED_CLIENTS,
|
|
522
|
+
help="Which client to configure.",
|
|
523
|
+
)
|
|
524
|
+
pc.add_argument(
|
|
525
|
+
"--setup",
|
|
526
|
+
required=True,
|
|
527
|
+
help="Private gbsetup_v1_... setup code copied from getbased Settings → Agent Access.",
|
|
528
|
+
)
|
|
529
|
+
pc.add_argument(
|
|
530
|
+
"--no-restart",
|
|
531
|
+
action="store_true",
|
|
532
|
+
help="Do not try to restart Hermes gateway after registering the MCP server.",
|
|
533
|
+
)
|
|
534
|
+
|
|
378
535
|
sub.add_parser("version", help="Print installed package versions.")
|
|
379
536
|
|
|
380
537
|
return p
|
|
@@ -387,6 +544,7 @@ COMMANDS = {
|
|
|
387
544
|
"status": cmd_status,
|
|
388
545
|
"set": cmd_set,
|
|
389
546
|
"mcp-config": cmd_mcp_config,
|
|
547
|
+
"connect": cmd_connect,
|
|
390
548
|
"version": cmd_version,
|
|
391
549
|
}
|
|
392
550
|
|
{getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/mcp_configs.py
RENAMED
|
@@ -16,14 +16,25 @@ import shutil
|
|
|
16
16
|
from typing import Callable
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
SUPPORTED_CLIENTS = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
SUPPORTED_CLIENTS = (
|
|
20
|
+
"claude-desktop",
|
|
21
|
+
"claude-code",
|
|
22
|
+
"cursor",
|
|
23
|
+
"cline",
|
|
24
|
+
"hermes",
|
|
25
|
+
"openclaw",
|
|
26
|
+
"codex",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Single-token list for the Hermes snippet. Matches the lab-context +
|
|
30
|
+
# knowledge tools exposed by current getbased-mcp. Keep alphabetical for
|
|
31
|
+
# diff-friendliness.
|
|
23
32
|
HERMES_ENABLED_TOOLS = [
|
|
33
|
+
"getbased_lab_context",
|
|
24
34
|
"getbased_lens_config",
|
|
25
35
|
"getbased_list_profiles",
|
|
26
|
-
"
|
|
36
|
+
"getbased_section",
|
|
37
|
+
"getbased_wearables_series",
|
|
27
38
|
"knowledge_activate_library",
|
|
28
39
|
"knowledge_list_libraries",
|
|
29
40
|
"knowledge_search",
|
|
@@ -115,6 +126,49 @@ def emit_cline(resolver: Callable[[str], "str | None"] = shutil.which) -> str:
|
|
|
115
126
|
return banner + json.dumps(payload, indent=2) + "\n"
|
|
116
127
|
|
|
117
128
|
|
|
129
|
+
def emit_openclaw(resolver: Callable[[str], "str | None"] = shutil.which) -> str:
|
|
130
|
+
"""OpenClaw nests MCP servers under `mcp.servers.<name>` rather than
|
|
131
|
+
the Anthropic-style top-level `mcpServers` key."""
|
|
132
|
+
cmd = _resolve_mcp_binary(resolver)
|
|
133
|
+
body = {
|
|
134
|
+
"mcp": {
|
|
135
|
+
"servers": {
|
|
136
|
+
"getbased": {
|
|
137
|
+
"command": cmd,
|
|
138
|
+
"args": [],
|
|
139
|
+
"env": {"GETBASED_STACK_MANAGED": "1"},
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
banner = "// Paste into ~/.openclaw/openclaw.json, or adapt for `openclaw mcp set getbased`.\n"
|
|
145
|
+
banner = _prepend_warning(banner, _resolver_warning(cmd))
|
|
146
|
+
return banner + json.dumps(body, indent=2) + "\n"
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def emit_codex(resolver: Callable[[str], "str | None"] = shutil.which) -> str:
|
|
150
|
+
"""OpenAI Codex CLI uses TOML config under ~/.codex/config.toml."""
|
|
151
|
+
cmd = _resolve_mcp_binary(resolver)
|
|
152
|
+
warning = _resolver_warning(cmd)
|
|
153
|
+
lines = [
|
|
154
|
+
"# Paste into ~/.codex/config.toml",
|
|
155
|
+
"# Merge with existing [mcp_servers.*] tables if present.",
|
|
156
|
+
]
|
|
157
|
+
if warning:
|
|
158
|
+
lines.append("#")
|
|
159
|
+
lines.extend(f"# {line}" for line in warning.splitlines())
|
|
160
|
+
lines.extend([
|
|
161
|
+
"",
|
|
162
|
+
'[mcp_servers.getbased]',
|
|
163
|
+
f'command = {json.dumps(cmd)}',
|
|
164
|
+
"args = []",
|
|
165
|
+
"",
|
|
166
|
+
'[mcp_servers.getbased.env]',
|
|
167
|
+
'GETBASED_STACK_MANAGED = "1"',
|
|
168
|
+
])
|
|
169
|
+
return "\n".join(lines) + "\n"
|
|
170
|
+
|
|
171
|
+
|
|
118
172
|
def emit_hermes(resolver: Callable[[str], "str | None"] = shutil.which) -> str:
|
|
119
173
|
"""Hermes uses YAML — we emit by hand (no yaml dep) since the shape
|
|
120
174
|
is trivial. Includes enabled_tools for parity with the existing
|
|
@@ -172,6 +226,10 @@ def emit(client: str, resolver: Callable[[str], "str | None"] = shutil.which) ->
|
|
|
172
226
|
return emit_cline(resolver)
|
|
173
227
|
case "hermes":
|
|
174
228
|
return emit_hermes(resolver)
|
|
229
|
+
case "openclaw":
|
|
230
|
+
return emit_openclaw(resolver)
|
|
231
|
+
case "codex":
|
|
232
|
+
return emit_codex(resolver)
|
|
175
233
|
case _:
|
|
176
234
|
raise ValueError(
|
|
177
235
|
f"unknown client {client!r}. Supported: {', '.join(SUPPORTED_CLIENTS)}"
|
{getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6/src/getbased_agent_stack.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: getbased-agent-stack
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.6
|
|
4
4
|
Summary: One-command install of the full getbased agent stack — getbased-mcp + getbased-rag + getbased-dashboard
|
|
5
5
|
License-Expression: AGPL-3.0-or-later
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -8,7 +8,7 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Dist: getbased-mcp>=0.2.6
|
|
10
10
|
Requires-Dist: getbased-rag>=0.7.2
|
|
11
|
-
Requires-Dist: getbased-dashboard>=0.6.
|
|
11
|
+
Requires-Dist: getbased-dashboard>=0.6.5
|
|
12
12
|
Provides-Extra: full
|
|
13
13
|
Requires-Dist: getbased-rag[full]>=0.7.2; extra == "full"
|
|
14
14
|
Provides-Extra: test
|
|
@@ -79,7 +79,7 @@ getbased-stack init --yes
|
|
|
79
79
|
|
|
80
80
|
The wizard (~30 seconds):
|
|
81
81
|
|
|
82
|
-
1. Prompts for your `GETBASED_TOKEN` and `GETBASED_AGENT_CONTEXT_KEY` (skip if you don't use Agent Access; `--yes`
|
|
82
|
+
1. Prompts for your `GETBASED_TOKEN` and `GETBASED_AGENT_CONTEXT_KEY` when you opt into Agent Access (skip if you don't use Agent Access; `--yes` skips prompts)
|
|
83
83
|
2. Generates a rag API key if one doesn't exist
|
|
84
84
|
3. Writes `~/.config/getbased/env` (mode 0600) — the shared config file
|
|
85
85
|
4. Installs systemd user units for rag + dashboard, enables them, starts them
|
|
@@ -217,6 +217,22 @@ def test_mcp_config_hermes(stack_home):
|
|
|
217
217
|
assert "enabled_tools:" in out
|
|
218
218
|
|
|
219
219
|
|
|
220
|
+
def test_mcp_config_openclaw(stack_home):
|
|
221
|
+
rc, out, _ = _run(["mcp-config", "openclaw"])
|
|
222
|
+
assert rc == 0
|
|
223
|
+
assert '"mcp"' in out
|
|
224
|
+
assert '"servers"' in out
|
|
225
|
+
assert '"GETBASED_STACK_MANAGED": "1"' in out
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def test_mcp_config_codex(stack_home):
|
|
229
|
+
rc, out, _ = _run(["mcp-config", "codex"])
|
|
230
|
+
assert rc == 0
|
|
231
|
+
assert "[mcp_servers.getbased]" in out
|
|
232
|
+
assert "[mcp_servers.getbased.env]" in out
|
|
233
|
+
assert 'GETBASED_STACK_MANAGED = "1"' in out
|
|
234
|
+
|
|
235
|
+
|
|
220
236
|
def test_mcp_config_unknown_client():
|
|
221
237
|
rc, _, _ = _run(["mcp-config", "vim"])
|
|
222
238
|
# argparse rejects before our code runs — exit code 2, SystemExit
|
|
@@ -224,6 +240,114 @@ def test_mcp_config_unknown_client():
|
|
|
224
240
|
assert rc != 0
|
|
225
241
|
|
|
226
242
|
|
|
243
|
+
# ── connect ───────────────────────────────────────────────────────────
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def _setup_blob(token="tok_123", context_key="ctx_456", gateway="https://sync.getbased.health"):
|
|
247
|
+
import base64
|
|
248
|
+
import json
|
|
249
|
+
|
|
250
|
+
payload = json.dumps({
|
|
251
|
+
"version": 1,
|
|
252
|
+
"token": token,
|
|
253
|
+
"contextKey": context_key,
|
|
254
|
+
"gateway": gateway,
|
|
255
|
+
}, separators=(",", ":")).encode()
|
|
256
|
+
return "gbsetup_v1_" + base64.urlsafe_b64encode(payload).decode().rstrip("=")
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def test_connect_hermes_setup_blob_stores_secrets_and_registers_mcp(stack_home, monkeypatch):
|
|
260
|
+
monkeypatch.setenv("GETBASED_STACK_ASSUME_HERMES_CHILD", "0")
|
|
261
|
+
calls = []
|
|
262
|
+
monkeypatch.setattr(cli.shutil, "which", lambda name: {
|
|
263
|
+
"getbased-mcp": "/usr/local/bin/getbased-mcp",
|
|
264
|
+
"hermes": "/usr/local/bin/hermes",
|
|
265
|
+
}.get(name))
|
|
266
|
+
|
|
267
|
+
def fake_run(cmd, **kwargs):
|
|
268
|
+
calls.append((cmd, kwargs.get("input")))
|
|
269
|
+
class Result:
|
|
270
|
+
returncode = 0
|
|
271
|
+
stdout = "ok"
|
|
272
|
+
stderr = ""
|
|
273
|
+
return Result()
|
|
274
|
+
|
|
275
|
+
monkeypatch.setattr(cli.subprocess, "run", fake_run)
|
|
276
|
+
|
|
277
|
+
rc, out, err = _run(["connect", "hermes", "--setup", _setup_blob()])
|
|
278
|
+
|
|
279
|
+
assert rc == 0, err
|
|
280
|
+
data = env_file.read_env_file()
|
|
281
|
+
assert data["GETBASED_STACK_MANAGED"] == "1"
|
|
282
|
+
assert data["GETBASED_TOKEN"] == "tok_123"
|
|
283
|
+
assert data["GETBASED_AGENT_CONTEXT_KEY"] == "ctx_456"
|
|
284
|
+
assert data["GETBASED_GATEWAY"] == "https://sync.getbased.health"
|
|
285
|
+
assert ([
|
|
286
|
+
"/usr/local/bin/hermes", "mcp", "add", "getbased",
|
|
287
|
+
"--command", "/usr/local/bin/getbased-mcp",
|
|
288
|
+
"--env", "GETBASED_STACK_MANAGED=1",
|
|
289
|
+
], "y\ny\n") in calls
|
|
290
|
+
assert (["/usr/local/bin/hermes", "mcp", "test", "getbased"], None) in calls
|
|
291
|
+
assert (["/usr/local/bin/hermes", "gateway", "restart"], None) in calls
|
|
292
|
+
assert "Hermes MCP server registered" in out
|
|
293
|
+
assert "Connection test passed" in out
|
|
294
|
+
assert "tok_123" not in out
|
|
295
|
+
assert "ctx_456" not in out
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def test_connect_rejects_malformed_setup_blob(stack_home):
|
|
299
|
+
rc, out, err = _run(["connect", "hermes", "--setup", "not-a-setup-code"])
|
|
300
|
+
assert rc == 2
|
|
301
|
+
assert "Invalid setup" in err
|
|
302
|
+
assert env_file.read_env_file() == {}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def test_connect_non_hermes_clients_store_credentials_and_point_to_config(stack_home, monkeypatch):
|
|
306
|
+
monkeypatch.setattr(cli.shutil, "which", lambda name: "/usr/local/bin/getbased-mcp" if name == "getbased-mcp" else None)
|
|
307
|
+
rc, out, err = _run(["connect", "openclaw", "--setup", _setup_blob()])
|
|
308
|
+
assert rc == 0, err
|
|
309
|
+
data = env_file.read_env_file()
|
|
310
|
+
assert data["GETBASED_STACK_MANAGED"] == "1"
|
|
311
|
+
assert data["GETBASED_TOKEN"] == "tok_123"
|
|
312
|
+
assert data["GETBASED_AGENT_CONTEXT_KEY"] == "ctx_456"
|
|
313
|
+
assert "getbased-stack mcp-config openclaw" in out
|
|
314
|
+
assert "tok_123" not in out
|
|
315
|
+
assert "ctx_456" not in out
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def test_connect_codex_is_an_allowed_setup_target(stack_home, monkeypatch):
|
|
319
|
+
monkeypatch.setattr(cli.shutil, "which", lambda name: "/usr/local/bin/getbased-mcp" if name == "getbased-mcp" else None)
|
|
320
|
+
rc, out, err = _run(["connect", "codex", "--setup", _setup_blob()])
|
|
321
|
+
assert rc == 0, err
|
|
322
|
+
assert "getbased-stack mcp-config codex" in out
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def test_connect_skips_gateway_restart_when_running_inside_hermes(stack_home, monkeypatch):
|
|
326
|
+
monkeypatch.setenv("GETBASED_STACK_ASSUME_HERMES_CHILD", "1")
|
|
327
|
+
calls = []
|
|
328
|
+
monkeypatch.setattr(cli.shutil, "which", lambda name: {
|
|
329
|
+
"getbased-mcp": "/usr/local/bin/getbased-mcp",
|
|
330
|
+
"hermes": "/usr/local/bin/hermes",
|
|
331
|
+
}.get(name))
|
|
332
|
+
|
|
333
|
+
def fake_run(cmd, **kwargs):
|
|
334
|
+
calls.append((cmd, kwargs.get("input")))
|
|
335
|
+
class Result:
|
|
336
|
+
returncode = 0
|
|
337
|
+
stdout = "ok"
|
|
338
|
+
stderr = ""
|
|
339
|
+
return Result()
|
|
340
|
+
|
|
341
|
+
monkeypatch.setattr(cli.subprocess, "run", fake_run)
|
|
342
|
+
|
|
343
|
+
rc, out, err = _run(["connect", "hermes", "--setup", _setup_blob()])
|
|
344
|
+
|
|
345
|
+
assert rc == 0, err
|
|
346
|
+
assert (["/usr/local/bin/hermes", "mcp", "test", "getbased"], None) in calls
|
|
347
|
+
assert all(cmd != ["/usr/local/bin/hermes", "gateway", "restart"] for cmd, _ in calls)
|
|
348
|
+
assert "restart skipped because this setup is running inside Hermes" in out
|
|
349
|
+
|
|
350
|
+
|
|
227
351
|
# ── init (non-interactive via EOF on stdin) ───────────────────────────
|
|
228
352
|
|
|
229
353
|
|
|
@@ -33,6 +33,8 @@ def test_supported_clients_stable_list():
|
|
|
33
33
|
"cursor",
|
|
34
34
|
"cline",
|
|
35
35
|
"hermes",
|
|
36
|
+
"openclaw",
|
|
37
|
+
"codex",
|
|
36
38
|
)
|
|
37
39
|
|
|
38
40
|
|
|
@@ -63,6 +65,27 @@ def test_hermes_emits_yaml_shape():
|
|
|
63
65
|
assert " - knowledge_search" in out
|
|
64
66
|
|
|
65
67
|
|
|
68
|
+
def test_openclaw_emits_nested_mcp_servers_shape():
|
|
69
|
+
out = mcp_configs.emit("openclaw", resolver=_fake_resolver())
|
|
70
|
+
json_lines = [line for line in out.splitlines() if not line.startswith("//")]
|
|
71
|
+
payload = json.loads("\n".join(json_lines))
|
|
72
|
+
assert "mcpServers" not in payload
|
|
73
|
+
server = payload["mcp"]["servers"]["getbased"]
|
|
74
|
+
assert server["command"] == "/usr/local/bin/getbased-mcp"
|
|
75
|
+
assert server["args"] == []
|
|
76
|
+
assert server["env"] == {"GETBASED_STACK_MANAGED": "1"}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def test_codex_emits_toml_shape():
|
|
80
|
+
out = mcp_configs.emit("codex", resolver=_fake_resolver())
|
|
81
|
+
assert "# Paste into ~/.codex/config.toml" in out
|
|
82
|
+
assert "[mcp_servers.getbased]" in out
|
|
83
|
+
assert 'command = "/usr/local/bin/getbased-mcp"' in out
|
|
84
|
+
assert "args = []" in out
|
|
85
|
+
assert "[mcp_servers.getbased.env]" in out
|
|
86
|
+
assert 'GETBASED_STACK_MANAGED = "1"' in out
|
|
87
|
+
|
|
88
|
+
|
|
66
89
|
def test_no_secret_values_in_snippets():
|
|
67
90
|
"""A snippet must never carry a concrete token or key value. Prose
|
|
68
91
|
comments may mention these variable names for context, but the emitted
|
|
@@ -104,6 +127,12 @@ def test_fallback_emits_warning_for_hermes():
|
|
|
104
127
|
assert "WARNING" in out
|
|
105
128
|
|
|
106
129
|
|
|
130
|
+
@pytest.mark.parametrize("client", ["openclaw", "codex"])
|
|
131
|
+
def test_fallback_emits_warning_for_new_agent_clients(client):
|
|
132
|
+
out = mcp_configs.emit(client, resolver=_fake_resolver(found=None))
|
|
133
|
+
assert "WARNING" in out
|
|
134
|
+
|
|
135
|
+
|
|
107
136
|
def test_no_warning_when_binary_resolved():
|
|
108
137
|
"""When shutil.which does find the binary, the warning banner must
|
|
109
138
|
not appear — we don't want to cry wolf on successful installs."""
|
|
File without changes
|
|
File without changes
|
{getbased_agent_stack-0.5.4 → getbased_agent_stack-0.5.6}/src/getbased_agent_stack/env_file.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|