JSPM

  • Created
  • Published
  • Downloads 128
  • Score
    100M100P100Q109234F
  • License MIT

Model Context Protocol server for Neruva -- typed agentic memory (Records: decisions, mistakes, llm_turns, tool_calls), knowledge graph with 4 engines (Hadamard / OPB / multi-shard / quorum / feature-bundle) + raw-text ingest + N-hop matrix-power derive + customizable context blocks, Pearl's do-operator, HD analogy, plus self-introspection tools (wallet, op stats, op log, keys). Drop-in for Claude Code / Cursor / Codex / Gemini CLI.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@neruva/mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @neruva/mcp

    Model Context Protocol server for Neruva -- typed agentic memory (Records substrate) plus an HD-native substrate (knowledge graphs, analogy, causal do-operator) for AI agents. Drop into Claude Code / Cursor / Codex / Gemini CLI in one line.

    What's new in 0.7.0

    Four self-introspection tools so an agent can answer "what did I just do, and what's it costing me?" without leaving the loop:

    Tool What it does
    neruva_wallet_status Current credit / usage / plan for the active key
    neruva_op_stats Per-tool call counts + latency stats for this agent
    neruva_keys_list List API keys visible to the active account
    neruva_op_log Recent op log entries (tool, latency, ts) for audit

    These mirror the substrate's own audit surface back to the agent -- the same data the dashboard sees, available inline at sub-ms.

    Install

    The killer path -- one shot, every Claude Code session is auto-recorded:

    pip install neruva-record && neruva-record-install

    That installs the Claude Code hook + the Records SDK; every session you run after that lands in your Neruva account, secrets-redacted, queryable later.

    For the MCP server itself:

    npx -y @neruva/mcp     # one-off, no install
    # or
    npm i -g @neruva/mcp   # then `neruva-mcp`

    Wire into a client

    Claude Code

    claude mcp add neruva --scope user \
      --env NERUVA_API_KEY=nv_... \
      -- npx -y @neruva/mcp@latest

    Cursor (~/.cursor/mcp.json)

    {
      "mcpServers": {
        "neruva": {
          "command": "npx",
          "args": ["-y", "@neruva/mcp@latest"],
          "env": { "NERUVA_API_KEY": "..." }
        }
      }
    }

    Codex (~/.codex/config.toml)

    [mcp_servers.neruva]
    command = "npx"
    args = ["-y", "@neruva/mcp@latest"]
    env = { NERUVA_API_KEY = "..." }

    Gemini CLI (~/.gemini/settings.json)

    {
      "mcpServers": {
        "neruva": {
          "command": "npx",
          "args": ["-y", "@neruva/mcp@latest"],
          "env": { "NERUVA_API_KEY": "..." }
        }
      }
    }

    The 4-layer substrate

    • Records = typed agentic memory. Every event has kind, tags[], ts, meta, auto-embedded at D=1024. Filter on any dimension. GDPR-native via records_forget. Portable as .neruva.
    • KG = mutable structured state. Sharded (K=16 by default), deterministic from a seed, batched cleanup. Deploy state, project status, refactor tracking.
    • Causal = "if I do X, what happens?" -- Pearl's do-operator as native HD substitution.
    • Analogy = a🅱️:c:? pattern transfer in HD feature space, sub-ms, n_feat up to 20.

    A 5th legacy layer -- Memory Index -- exposes raw vector upsert/query at /v1/indexes/* for users migrating from generic vector stores. Kept for back-compat; new agents should reach for Records first.

    Cost wedge

    ~3,125x cheaper per recall than context-stuffing with Opus 4.7 (records_query at $2/M input vs context-stuff at ~$0.00625/turn). See /benchmarks on the site for the measured run.

    Tools exposed

    Records -- typed agentic memory (flagship)

    Tool What it does
    records_append Append a typed event (kind, tags, ts, meta, text) -- auto-embedded
    records_query Filter on any combo of kind / tags / time range / semantic similarity
    records_fetch Fetch records by id
    records_forget GDPR-native delete (tombstoned, excluded from query + export)
    records_export Export to portable .neruva container -- your data is yours
    records_import Import a .neruva blob
    records_compact Compact tombstones, rebuild index

    HD-native substrate

    Tool What it does
    hd_kg_add_fact Add (subject, relation, object) to a knowledge graph (sharded K=16)
    hd_kg_query Query a knowledge graph for the object of a (subject, relation)
    hd_kg_delete_fact Cancel a previously-added fact -- mutable state for refactor/deploy tracking
    hd_analogy Solve a🅱️:c:? analogies in HD space (n_feat up to 20)
    hd_causal_add_worlds Add worlds to a structural causal model
    hd_causal_query Observational or interventional (Pearl do-operator) query

    Self-introspection (new in 0.7.0)

    Tool What it does
    neruva_wallet_status Current credit / usage / plan
    neruva_op_stats Per-tool call counts + latency stats
    neruva_keys_list API keys visible to the active account
    neruva_op_log Recent op log entries for audit

    Memory index -- vector upsert/query (legacy compat surface)

    Tool What it does
    memory_embed Encode texts to D=1024 vectors via the server-side static-MRL encoder. No BYOE.
    memory_upsert_text Embed and upsert text in one call
    memory_query_text Embed a text query and search in one call
    memory_create_index Create a vector index
    memory_list_indexes List all your indexes
    memory_describe_index Describe one index (dim, metric, host, status)
    memory_stats Per-namespace vector counts
    memory_upsert Insert/update vectors in a namespace (raw vectors)
    memory_query Cosine top-K search (raw vectors)
    memory_fetch Fetch vectors by id
    memory_update Update one vector's values/metadata in place
    memory_delete Delete vectors by id
    memory_export Export to portable .nmm format
    memory_import Import a .nmm blob
    memory_bind_role Bind a role atom onto a stored vector for compound queries
    memory_read_roles Recover the role atoms bound to a stored vector

    Auto-record (opt-in, 0.4.0+)

    Set NERUVA_AUTO_RECORD=<index>/<namespace> and every tool call this agent makes is auto-upserted into that namespace as a side-effect. Stop manually saving things; query the namespace later for "what did this agent do?" Fire-and-forget, never blocks or breaks the call.

    # single-agent: one brain, one main namespace
    NERUVA_AUTO_RECORD=brain/main
    
    # multi-agent: same brain, one namespace per agent
    NERUVA_AUTO_RECORD=brain/support-bot
    NERUVA_AUTO_RECORD=brain/research-agent
    NERUVA_AUTO_RECORD=brain/orchestrator

    Agents themselves don't need to know about it -- the recording happens at the MCP wrapper layer below them. Each record gets metadata {kind: "tool_call", tool, latency_ms, ts} so you can filter at query time. memory_* and records_* reads are excluded from recording to prevent loops. Storage cost is 1.2 KB per tool call (44 MB/year for an active agent at 100 tool calls/day).

    For Claude Code specifically, prefer the one-shot installer:

    pip install neruva-record && neruva-record-install

    Auth

    Set NERUVA_API_KEY in the environment. Get a key at https://app.neruva.io.

    NERUVA_URL is optional and defaults to https://api.neruva.io.

    License

    MIT