Nexevo.aiNexevo.ai
← All examples
Integration scenario

MCP — Quorum review + Recall memory (Python / Node / curl)

Nexevo MCP server exposes 3 tools: let another AI review your work (quorum_review) + save / recall long-term memory (memory_save / memory_recall). This recipe calls JSON-RPC 2.0 over HTTP directly — ideal for your own agent or backend script. For Claude Desktop / Cursor one-click setup, see /docs/mcp.

python
# Nexevo MCP — direct JSON-RPC 2.0 over HTTP, ideal for your own agent / backend.
# Claude Desktop / Cursor users: see /docs/mcp for the mcp-remote bridge config.

import httpx
import os


class NexevoMCP:
    def __init__(self, api_key: str | None = None):
        self.url = "https://api.nexevo.ai/v1/mcp"
        self.headers = {
            "Authorization": f"Bearer {api_key or os.environ['NEXEVO_API_KEY']}",
            "Content-Type":  "application/json",
        }
        self.rid = 0

    def _call(self, method: str, params: dict | None = None) -> dict:
        self.rid += 1
        body = {"jsonrpc": "2.0", "id": self.rid, "method": method}
        if params is not None:
            body["params"] = params
        r = httpx.post(self.url, json=body, headers=self.headers, timeout=30)
        r.raise_for_status()
        data = r.json()
        if "error" in data:
            raise RuntimeError(f"MCP {data['error']['code']}: {data['error']['message']}")
        return data["result"]

    # ── 3 working tools ───────────────────────────────────
    def quorum_review(self, content: str, template: str = "find_bug",
                      judge_model: str = "claude-haiku-4-5") -> dict:
        """Let another AI review your work. template: find_bug / counter_argument
        / fact_check / risk_assessment. judge_model: any catalog model."""
        return self._call("tools/call", {
            "name": "quorum_review",
            "arguments": {
                "content": content,
                "template_name": template,
                "judge_model": judge_model,
            },
        })

    def memory_save(self, title: str, content: str,
                    tags: list[str] | None = None) -> dict:
        """Save key decisions / thoughts / answers as Recall capsules."""
        return self._call("tools/call", {
            "name": "memory_save",
            "arguments": {"title": title, "content": content, "tags": tags or []},
        })

    def memory_recall(self, query: str, top_k: int = 3) -> dict:
        """Semantic recall of capsules (Voyage-3 + pgvector; auto-fallback to literal)."""
        return self._call("tools/call", {
            "name": "memory_recall",
            "arguments": {"query": query, "top_k": top_k},
        })


# ── Usage ─────────────────────────────────────────────────
mcp = NexevoMCP()

# 1) Ask GPT-5 to find bugs in your design
review = mcp.quorum_review(
    content="### My auth design\nClerk passwordless + magic link...",
    template="find_bug",
    judge_model="gpt-5",
)
print(review["content"][0]["text"])   # GPT-5's review markdown

# 2) Save the decision
mcp.memory_save(
    title="Clerk vs Auth0 decision",
    content="Picked Clerk: 5-line integration + 10k MAU free tier + modern UI.",
    tags=["auth", "decision"],
)

# 3) A week later — semantic recall finds it even from a different query
#    "user authentication options" matches "Clerk vs Auth0 decision" via Voyage-3 cosine
hits = mcp.memory_recall("user authentication options", top_k=3)
print(hits["content"][0]["text"])
print("retrieval_method:", hits["_meta"]["retrieval_method"])  # semantic / literal
MCP — Quorum review + Recall memory (Python / Node / curl) — Nexevo Cookbook | Nexevo.ai