Vai al contenuto
NotHolyDocs

Integrazioni

ARIA-X

Fai girare ARIA-X su NotHoly con il provider OpenAI-compatible, poi aggiungi CKE 2.0 e gli strumenti con un piccolo ponte.

Vedi in Markdown

ARIA-X è un motore di ricerca di sicurezza local-first, scritto solo con la libreria standard. Legge il modello da un provider compatibile con OpenAI, quindi gira su NotHoly con una URL base e la tua chiave. Non serve nulla di specifico per NotHoly per l'inferenza.

ARIA-X gira su Linux e macOS con CPython 3.11 o successivo. La sua documentazione indica Windows come non verificato, e la sandbox locale esegue i comandi tramite bash, quindi su Windows installa WSL 2 e segui i passi per Linux al suo interno.

Scarica il codice e genera una config iniziale. Il launcher ./aria-x trova un Python adatto e imposta il percorso di import, quindi non serve pip install.

Shell
git clone https://github.com/01NGVI-QINGYI/ARIA-X.git
cd ARIA-X
./aria-x init

init scrive configs/aria-x.toml. Compila il suo blocco [scope] con i target del tuo lab come descrive il README di ARIA-X, poi imposta il blocco [llm]:

TOML
[llm]
provider = "openai"
base_url = "https://api.notholy.com/v1"
model = "notholy-specter"

Metti la tua chiave nell'ambiente e verifica la connessione. export vale per la sessione; per mantenerla, aggiungi la riga a ~/.bashrc (bash, anche in WSL) o a ~/.zshrc (zsh, la shell predefinita di macOS).

Shell
export ARIA_X_API_KEY="nh_live_..."
./aria-x doctor --llm

Qualsiasi ID di modello del catalogo va bene in model. Elencali con GET /v1/models; la finestra di contesto è indicata lì come context_length (1048576 per notholy-specter).

Gli stessi valori compatibili con OpenAI, provider = "openai", URL base https://api.notholy.com/v1 e la tua chiave, puntano ARIA-X su NotHoly, sia dal file di config sia dalle variabili d'ambiente ARIA_X_PROVIDER / ARIA_X_BASE_URL / ARIA_X_MODEL.

5% di credito extra

Aggiungi credito nella console, apri il campo del coupon nella finestra di deposito e inserisci ARIAX. Il bonus del 5% arriva sul saldo dopo la conferma del pagamento. Il codice è valido fino al 30 novembre 2026; i crediti già accreditati non scadono.

Aggiungi CKE 2.0 e gli strumenti

La configurazione qui sopra fa solo inferenza. ARIA-X esegue un insieme fisso di strumenti interni e non ha un client MCP, quindi il blocco JSON mcpServers che usano gli altri client qui non si applica. Per dare ai suoi agenti consultazione CVE, ricerca in CKE 2.0, bollettini, ricerca web e lettura di URL, fai girare ARIA-X con il piccolo ponte qui sotto. Legge la lista degli strumenti dall'endpoint MCP di NotHoly, avvolge ciascuno come strumento nativo di ARIA-X, li consegna ai ruoli di ricerca e poi avvia ARIA-X normalmente.

Salvalo nella radice del checkout di ARIA-X come notholy_mcp_tools.py:

Python
#!/usr/bin/env python3
"""Give ARIA-X the NotHoly MCP tools (CVE lookup, CKE 2.0 search, web, advisories).

ARIA-X ships a fixed, in-process tool set and has no MCP client of its own. This
launcher adds NotHoly's hosted tools to a run without forking ARIA-X: it reads the
tool list from the NotHoly MCP endpoint, wraps each one as a native ARIA-X tool, and
hands the agents those tools alongside the built-ins. Then it starts ARIA-X normally.

Usage (same arguments as `aria-x`):
    export ARIA_X_API_KEY="<your NotHoly key>"   # the model key doubles as the MCP key
    PYTHONPATH="$PWD/src" python3 notholy_mcp_tools.py run --goal "..." --config configs/aria-x.toml

Standard library only. Tested against ARIA-X v0.1.x; the modules it patches are
unchanged in v0.2.1.
"""
from __future__ import annotations

import json
import os
import sys
import urllib.request
from typing import Any

MCP_URL = os.environ.get("NOTHOLY_MCP_URL", "https://api.notholy.com/mcp")
API_KEY = os.environ.get("NOTHOLY_API_KEY") or os.environ.get("ARIA_X_API_KEY") or ""

# Read-only knowledge and research tools (no traffic to the engagement target), so
# they do not need Scope approval. Raise the risk here if you expose active tools.
_RISK = "low"


class MCPClient:
    """A minimal MCP client over Streamable HTTP (JSON-RPC 2.0 + Bearer)."""

    def __init__(self, url: str, api_key: str, timeout: float = 60.0) -> None:
        self.url = url
        self.api_key = api_key
        self.timeout = timeout
        self.session_id = ""
        self._id = 0

    def _call(self, method: str, params: dict[str, Any] | None = None, notify: bool = False) -> Any:
        body: dict[str, Any] = {"jsonrpc": "2.0", "method": method}
        if params is not None:
            body["params"] = params
        if not notify:
            self._id += 1
            body["id"] = self._id
        headers = {
            "Content-Type": "application/json",
            "Accept": "application/json, text/event-stream",
            "Authorization": f"Bearer {self.api_key}",
        }
        if self.session_id:
            headers["Mcp-Session-Id"] = self.session_id
        req = urllib.request.Request(self.url, data=json.dumps(body).encode(), headers=headers)
        with urllib.request.urlopen(req, timeout=self.timeout) as resp:
            sid = resp.headers.get("Mcp-Session-Id")
            if sid:
                self.session_id = sid
            raw = resp.read().decode("utf-8", "replace")
        if notify:
            return None
        payload = _parse_jsonrpc(raw)
        if "error" in payload:
            raise RuntimeError(f"MCP {method} failed: {payload['error']}")
        return payload.get("result")

    def handshake(self) -> None:
        self._call("initialize", {
            "protocolVersion": "2025-06-18",
            "capabilities": {},
            "clientInfo": {"name": "aria-x-notholy", "version": "1"},
        })
        self._call("notifications/initialized", notify=True)

    def list_tools(self) -> list[dict[str, Any]]:
        return list((self._call("tools/list") or {}).get("tools", []))

    def call_tool(self, name: str, arguments: dict[str, Any]) -> str:
        result = self._call("tools/call", {"name": name, "arguments": arguments}) or {}
        parts = [c.get("text", "") for c in result.get("content", []) if c.get("type") == "text"]
        text = "\n".join(p for p in parts if p) or json.dumps(result, ensure_ascii=False)
        if result.get("isError"):
            raise RuntimeError(text)
        return text


def _parse_jsonrpc(raw: str) -> dict[str, Any]:
    """Accept a plain JSON body or an SSE stream and return the JSON-RPC object."""
    raw = raw.strip()
    if raw.startswith("{"):
        return json.loads(raw)
    data_lines = [ln[5:].strip() for ln in raw.splitlines() if ln.startswith("data:")]
    for chunk in reversed(data_lines):  # the last data frame carries the result
        try:
            obj = json.loads(chunk)
        except json.JSONDecodeError:
            continue
        if isinstance(obj, dict) and ("result" in obj or "error" in obj):
            return obj
    raise RuntimeError(f"no JSON-RPC payload in MCP response: {raw[:200]}")


def _make_tool(client: MCPClient, tool: dict[str, Any]):
    """Wrap one MCP tool as an ARIA-X FunctionTool (spec + handler)."""
    from aria_x.tools.base import ToolResult, ToolSpec

    name = f"notholy_{tool['name']}"
    schema = tool.get("inputSchema") or {"type": "object", "properties": {}}
    spec = ToolSpec(
        name=name,
        description=(tool.get("description") or f"NotHoly {tool['name']}").strip(),
        parameters=schema,
        risk=_RISK,
        requires_scope=False,
        read_only=True,
        tags=("notholy", "knowledge"),
    )

    def run(ctx: Any, args: dict[str, Any]) -> "ToolResult":
        try:
            return ToolResult.success(text=client.call_tool(tool["name"], dict(args or {})))
        except Exception as exc:  # keep the run alive; surface the error to the model
            return ToolResult.failure(f"notholy tool '{tool['name']}' failed: {exc}")

    return spec, run


def install(client: MCPClient) -> list[str]:
    """Register the MCP tools in ARIA-X's registry and offer them to the agents."""
    import aria_x.agents.roles as roles
    import aria_x.tools.builtin as builtin

    wrapped = [_make_tool(client, t) for t in client.list_tools()]
    names = [spec.name for spec, _ in wrapped]
    if not names:
        return []

    base_build = builtin.build_registry

    def build_registry(ctx=None):
        registry = base_build(ctx)
        for spec, fn in wrapped:
            registry.add(spec, fn)
        return registry

    builtin.build_registry = build_registry

    # Role specs read these module tuples at build time; a tool not listed for a
    # role is never offered to it. Hand the knowledge tools to the researchers,
    # the worker and the planner.
    extra = tuple(names)
    roles.WORKER_TOOLS = tuple(dict.fromkeys(roles.WORKER_TOOLS + extra))
    roles.PLANNER_TOOLS = tuple(dict.fromkeys(roles.PLANNER_TOOLS + extra))
    roles.SPECIALIST_TOOLS = dict(roles.SPECIALIST_TOOLS)
    roles.SPECIALIST_TOOLS["researcher"] = tuple(
        dict.fromkeys(roles.SPECIALIST_TOOLS["researcher"] + extra)
    )
    return names


def main() -> int:
    if not API_KEY:
        sys.exit("set NOTHOLY_API_KEY (or ARIA_X_API_KEY) before running")
    client = MCPClient(MCP_URL, API_KEY)
    client.handshake()
    added = install(client)
    print(f"[notholy] added {len(added)} tool(s): {', '.join(added) or '(none)'}", file=sys.stderr)

    from aria_x.cli import main as aria_main
    return aria_main(sys.argv[1:])


if __name__ == "__main__":
    raise SystemExit(main())

Eseguilo dalla radice del checkout con gli stessi argomenti che passeresti ad aria-x. PYTHONPATH permette al ponte di importare ARIA-X senza installarlo, e python3 deve essere 3.11 o successivo (verifica con python3 --version):

Shell
export ARIA_X_API_KEY="nh_live_..."
PYTHONPATH="$PWD/src" python3 notholy_mcp_tools.py run --goal "..." --config configs/aria-x.toml

API = inferenza; il ponte = CKE 2.0 + strumenti. Una chiave copre entrambi. La guida MCP spiega ogni strumento e collega i client che parlano già MCP.

Prossimi passi