mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 07:20:44 +08:00
- Add SQLAlchemy Core repos, pg adapter/compat, assistant_store factory, Alembic bootstrap and migration/cutover scripts. - Harden chat_message writes (NUL scrub for PG), turn_uuid on attempt failure, WS turn_runner fallbacks and gateway executed_turn_uuid init. - start_gateway: log paths, PS7 stderr handling via cmd, background stdout/stderr redirect; runtime assistant_runtime_log_dir export. - Ops: clear_all_chat_sessions with PG-only --postgresql and env-gated wipe; clear_postgres_chat_sessions.ps1. - Tests: SA repos, pg compat, persist fallback, smoke env isolation; CI and docs touch-ups. Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.5 KiB
Python
72 lines
2.5 KiB
Python
"""One-off helper: install additional npm MCP servers into local registry (stdio / npx).
|
|
|
|
Run from repo root: python oclaw/scripts/install_extra_mcp_batch.py
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# repo root
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from svc.config.paths import db_path # noqa: E402
|
|
from svc.persistence.sqlite_store import SqliteStore # noqa: E402
|
|
from svc.persistence.assistant_store import get_assistant_store
|
|
from runtime.tools.mcp.installer import McpServerManifest, _safe_server_id, install_mcp_server # noqa: E402
|
|
|
|
|
|
# (server_id_seed, npm package ref, entry_args for npx)
|
|
# Note: mcp-smart-crawler was tried; stdio JSON-RPC handshake failed on Windows — not registered.
|
|
BATCH: list[tuple[str, str, list[str]]] = [
|
|
("mcp-git-cyanheads", "@cyanheads/git-mcp-server", ["-y", "@cyanheads/git-mcp-server"]),
|
|
]
|
|
|
|
|
|
def main() -> None:
|
|
store = get_assistant_store()
|
|
for seed, source_ref, entry_args in BATCH:
|
|
server_id = _safe_server_id(seed)
|
|
manifest = McpServerManifest(
|
|
server_id=server_id,
|
|
source_type="npm",
|
|
source_ref=source_ref,
|
|
version="",
|
|
entry_command="npx",
|
|
entry_args=entry_args,
|
|
env_schema={},
|
|
permissions=[],
|
|
risk_level="high",
|
|
enabled=True,
|
|
timeout_s=60.0,
|
|
)
|
|
print(f"\n=== Installing {server_id} ({source_ref}) ===")
|
|
inst = install_mcp_server(manifest, dry_run=False)
|
|
store.upsert_mcp_server(
|
|
server_id=manifest.server_id,
|
|
source_type=manifest.source_type,
|
|
source_ref=manifest.source_ref,
|
|
version=manifest.version,
|
|
entry_command=manifest.entry_command,
|
|
entry_args=manifest.entry_args,
|
|
env_schema=manifest.env_schema,
|
|
required_permissions=manifest.permissions,
|
|
risk_level=manifest.risk_level,
|
|
timeout_s=manifest.timeout_s,
|
|
enabled=manifest.enabled if inst.ok else False,
|
|
)
|
|
store.add_mcp_installation_log(
|
|
server_id=manifest.server_id,
|
|
status="ok" if inst.ok else "error",
|
|
error_code=inst.error_code,
|
|
detail={"error": inst.error, **(inst.details or {})},
|
|
install_command=inst.install_command,
|
|
)
|
|
print("ok:", inst.ok, inst.error_code or "-", inst.install_command)
|
|
if not inst.ok:
|
|
print("stderr snippet:", (inst.error or "")[:400])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|