Nexus Docs

MCP, Hosted API, and AMCP Surface

Nexus is a portable memory layer for AI agents. This page covers the current reference stack: hosted setup, Local Lite activation, MCP install, AMCP endpoints, export/import, and runtime verification.

Hosted API Base

https://nexus-api-production-4177.up.railway.app

MCP Server Package

@nunchiai/nexus-mcp@latest

Validated Release

v0.4.12

Install Coverage

16 clients (14 auto + 2 manual)

1) What Nexus ships today

Hosted memory API: remember, recall, sessions, export/import, and delete are available on the current AMCP surface.

MCP server: one-command setup is available for supported clients, with Local Lite and hosted modes separated clearly.

Lifecycle hooks: the current validated release (v0.4.12) installs a shared auto-save hook script plus client-specific hook config for supported targets unless you pass --no-hooks.

Reference implementation: Nexus is positioned as a memory layer and reference server, not as a general-purpose agent product.

Verification: client config support, MCP runtime verification, and hosted gateway/API verification are tracked separately.

Support boundary: the official baseline is CLI-first. Desktop and IDE variants may be config-compatible, but they are not presented as equally verified unless runtime checks were completed.

2) Before you start

  • 1. Hosted Nexus always starts with API-key issuance at /settings/api-keys.
  • 2. Trial Cloud does not require a credit card. The 30-day trial starts when you issue the first hosted API key.
  • 3. Use Node.js 18+ (npx required).
  • 4. Fully quit all running agent apps before setup, including Codex, Claude, Cursor, Windsurf, VS Code, Zed, and similar clients.
  • 5. Reopen the agent only after setup completes.
  • 6. Trial Cloud, Local Lite, and Cloud Pro currently allow only one active API key under the current rollout policy. Revoke or delete the old key before issuing a new one.

3) Choose your mode

Use hosted mode when you want cloud memory with an issued API key. Use Local Lite when you want local SQLite memory with one-time license activation.

recommended Local Lite flow
# local sqlite memory
npx -y @nunchiai/nexus-mcp@latest init --all --local --yes
npx -y @nunchiai/nexus-mcp@latest activate --key sk_write_your_key --gateway-url https://nexus-api-production-4177.up.railway.app

Local Lite keeps memory on local SQLite and uses the issued key once to fetch a signed license.

New Local Lite activations are bound to the first device that runs activate --key. The same API key cannot activate an additional device.

For Trial Cloud, Cloud Pro, or Team, use regular init with --key instead of --local.

recommended hosted flow
# hosted memory
npx -y @nunchiai/nexus-mcp@latest init --client codex,gemini-cli --key sk_write_your_key --gateway-url https://nexus-api-production-4177.up.railway.app --yes
npx -y @nunchiai/nexus-mcp@latest init --list

Codex uses Nexus through MCP. Codex autosave is configured through notify in ~/.codex/config.toml. Do not set OPENAI_BASE_URL for Codex.

4) AMCP public page

Nexus setup guidance lives on this page, but the protocol itself now has a separate public page. Use it when you want the canonical public draft for AMCP without the rest of the MCP and product-install material.

It covers the protocol purpose, canonical record shape, current HTTP surface, auth scopes, delete semantics, portability, and reference implementation status.

Open AMCP Page

5) Lifecycle hooks in the current validated release

Nexus uses a two-layer auto-save architecture:

  • Layer 1 — Lifecycle Hooks: deterministic shell-script hooks that fire on agent stop/response events, sending final-response text to /v1/memory/ingest as context memory.
  • Layer 2 — MCP Tools: agent-driven structured saves via nexus_remember for decision, task, error, and other typed memory.

init installs a shared hook script at ~/.nexus/hooks/nexus-autosave.sh and wires client-specific hook config for supported targets.

Verified hook targets: claude-code (Stop), cursor (stop), windsurf (post_cascade_response), codex (notify), gemini-cli (AfterAgent), vscode-copilot (Stop).

opencode and kilo-cli do not support hooks in their current config schema.

install MCP + hooks by default
npx -y @nunchiai/nexus-mcp@latest init --all --key sk_write_your_key --gateway-url https://nexus-api-production-4177.up.railway.app --yes

# skip hook install
npx -y @nunchiai/nexus-mcp@latest init --all --key sk_write_your_key --gateway-url https://nexus-api-production-4177.up.railway.app --no-hooks --yes

6) AMCP API surface

The current public direction is an AMCP surface layered over the existing Nexus memory system. You can use MCP through supported clients or call the hosted API directly.

  • 1. POST /v1/amcp/remember
  • 2. POST /v1/amcp/recall
  • 3. GET /v1/amcp/sessions
  • 4. POST /v1/amcp/export
  • 5. POST /v1/amcp/import
  • 6. DELETE /v1/amcp/memories/:id

Native /v1/memory/* routes still exist underneath. Legacy /v1/amp/* routes remain available only as compatibility aliases. The canonical public protocol surface is /v1/amcp/*.

7) MCP workflow

This is the fastest way to keep coding conventions aligned across clients while using Nexus as the shared memory layer.

sync curated rule files into Nexus
# push local rule files (.cursorrules, CLAUDE.md, AGENTS.md, .cursor/rules/*, ...)
npx -y @nunchiai/nexus-mcp sync

# preview only (no write)
npx -y @nunchiai/nexus-mcp sync --dry-run

Sync stores each rule file as convention memory atoms. After sync, recall/generate can apply those conventions in any connected agent.

8) Core use cases

Nexus becomes most useful when your session changes, your agent changes, or you come back to the same project later. Instead of re-explaining the same decisions, failures, and conventions, you can tell the next agent to recall them first.

Typical moments where this pays off:

  • 1. You close Codex today and continue tomorrow in Claude Code.
  • 2. You debug a billing issue in one agent, then continue implementation in another.
  • 3. A long thread ends and a new session starts with less context.
  • 4. You want the next agent to inherit project-specific conventions without repeating them manually.

Save decisions explicitly

After a product, billing, architecture, or infra decision, tell the agent to save it to Nexus so the same choice does not need to be rediscovered later.

example prompt
Save this in Nexus as a decision:
            "Codex now follows the current validated setup path. For Codex, Nexus writes MCP config plus notify-based autosave in ~/.codex/config.toml."

Save bug causes and fixes

When a root cause is found, store it once as an error memory so future sessions can recall it instead of repeating the investigation.

example prompt
Save this in Nexus as an error:
"Public plan login 404 came from /en/en/login. Locale was being prefixed twice."

Recall project context at session start

At the start of a new agent session, ask for recent decisions, constraints, or conventions before continuing work.

example prompt
Recall the recent Nexus context for billing and deployment before you continue.

Store reusable rules and conventions

Use sync for file-based rules, then ask the agent to remember small conventions that are not already documented in files.

example prompt
Save this in Nexus as a convention:
"Use Current Plan for the active plan card and Choose Plan for non-active paid tiers."

9) How to tell the agent to save

The simplest pattern is to tell the agent directly to save something in Nexus. Do not type the raw MCP function syntax unless your client specifically exposes it.

This is especially useful right before ending a session, switching to another agent, or handing work off to a teammate.

Good examples:

  • 1. Save this in Nexus as a decision.
  • 2. Remember this bug cause in Nexus.
  • 3. Store this as project context in Nexus.
  • 4. Before you finish, save the final fix in Nexus.

If the agent is correctly connected, it should execute nexus_remember for you.

10) Session handoff pattern

Before ending a session

Ask the agent to save the outcome, the key decision, and the main unresolved risk. This gives the next session a clean checkpoint.

end-of-session prompt
Before you finish, save the final fix, the reason behind it, and any remaining risk in Nexus.

At the next session start

Ask the next agent to recall the recent Nexus context first. This works whether you switched from Codex to Cursor, from Claude Code to Gemini CLI, or simply started a fresh session.

start-of-session prompt
Recall the recent Nexus context for this project before you continue. Focus on decisions, errors, and unresolved items.

11) Non-interactive commands

non-interactive commands
# local_lite: configure all detected clients for local SQLite
npx -y @nunchiai/nexus-mcp@latest init --all --local --yes
npx -y @nunchiai/nexus-mcp@latest activate --key sk_write_your_key --gateway-url https://nexus-api-production-4177.up.railway.app

# cloud tiers (trial_cloud / cloud_pro / team): configure selected clients only
npx -y @nunchiai/nexus-mcp@latest init --client codex,cursor,gemini-cli --key sk_write_your_key --gateway-url https://nexus-api-production-4177.up.railway.app --yes

# inspect detection only
npx -y @nunchiai/nexus-mcp@latest init --list

# preview changes without writing files
npx -y @nunchiai/nexus-mcp@latest init --all --local --dry-run

# remove nexus-mcp config and installed hooks
npx -y @nunchiai/nexus-mcp@latest init --remove --all --yes

12) API key vs local activation

Local Lite (recommended for solo use): run npx -y @nunchiai/nexus-mcp@latest init --all --local --yes, then npx -y @nunchiai/nexus-mcp@latest activate --key sk_write_... --gateway-url https://nexus-api-production-4177.up.railway.app.

Cloud tiers: pass --key sk_write_... to init for connected MCP clients, including Codex.

Trial Cloud, Local Lite, and Cloud Pro currently allow only one active API key under the current rollout policy. Revoke or delete the current key before reissuing.

Local Lite stores its signed license in ~/.nexus/license.json. Cloud init stores reusable values in ~/.nexus.env.

Local Lite binds that signed license to the first activated device fingerprint. To move devices, delete the old key in /settings/api-keys, issue a new key, and activate again on the new device.

Search engine in Local Lite: Local Lite does not run a local embedding model. It uses local SQLite FTS search plus lightweight scoring. Cloud memory is the mode that provides server-side embedding and vector retrieval.

12) Supported agents

ClientSetupNotes
Claude CodeAutoclaude mcp add/remove command
Claude DesktopAutomcpServers JSON
CursorAutomcpServers JSON
WindsurfAutomcpServers JSON
ClineAutomcpServers JSON
Roo CodeAutomcpServers JSON
Kilo Code (IDE)AutomcpServers JSON
Kilo Code (CLI)Automcp JSON key format
OpenCodeAutomcp JSON key format
Gemini CLIAuto.gemini/settings.json or ~/.gemini/settings.json
CodexAutoTOML mcp_servers + notify format
VS Code + CopilotAutomcp.servers JSON format
Amazon Q CLIAutomcpServers JSON
ZedAutocontext_servers JSON format
AntigravityManualUser/mcp.json; current desktop builds may emit MCP_SERVER_INIT_ERROR
JetBrains IDEsManualImport from Claude in settings

13) Runtime verification status

Setup support and runtime verification are different. The table below reflects current tested reality.

ClientConfigMCP runtimeGatewayLifecycle Hook
Claude CodeAutoMCP verifiedVerifiedStop — Verified
Codex CLIAutoMCP verifiedNot verifiednotify — Verified
Codex Mac AppAutoMCP verifiedNot verifiednotify — Verified
Gemini CLIAutoMCP connectedNot verifiedAfterAgent — Verified
CursorAutoMCP verifiedNot verifiedstop — Verified
WindsurfAutoConnected log verifiedNot verifiedpost_cascade_response — Verified
VS Code + CopilotAutoConfig writtenNot verifiedStop — Config written
OpenCodeAutoMCP verifiedNot verifiedNot supported
Kilo Code (CLI)AutoMCP verifiedNot verifiedNot supported
Claude DesktopAutoConnected log verifiedNot verifiedNot supported
Kilo Code (IDE)AutoConfig writtenNot verifiedNot supported
ZedAutoConfig writtenNot verifiedNot supported
AntigravityManualInit errorNot supportedNot supported
JetBrains IDEsManualImport flow onlyNot verifiedNot supported

14) Manual setup (Antigravity, JetBrains)

Antigravity

Add Nexus MCP manually. The persisted config path is ~/Library/Application Support/Antigravity/User/mcp.json.

  • 1. command: npx
  • 2. args: -y @nunchiai/nexus-mcp
  • 3. Local Lite: NEXUS_STORAGE=local
  • 4. Cloud mode only: NEXUS_API_URL=https://nexus-api-production-4177.up.railway.app and NEXUS_API_KEY=your issued key
  • 5. NEXUS_AGENT_NAME: antigravity

Current desktop builds may still fail third-party MCP init with MCP_SERVER_INIT_ERROR. Verify tool visibility before relying on it.

JetBrains IDEs

  • 1. Make sure Claude setup is completed first (~/.claude/settings.json has nexus-mcp).
  • 2. In JetBrains: Settings > Tools > MCP Server > Import from Claude.
  • 3. Restart the IDE and verify Nexus tools are visible.

15) Codex details (TOML + notify)

Use this only when automatic init is unavailable.

codex fallback (Local Lite)
[mcp_servers.nexus-mcp]
command = "npx"
args = ["-y", "@nunchiai/nexus-mcp"]

[mcp_servers.nexus-mcp.env]
NEXUS_STORAGE = "local"
NEXUS_AGENT_NAME = "codex"

16) Hosted API examples

remember
curl -X POST https://nexus-api-production-4177.up.railway.app/v1/amcp/remember \
  -H "Authorization: Bearer sk_write_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "content": "Auth flow uses PKCE",
        "type": "decision",
        "scope": { "kind": "project", "id": "acme-web" }
      }
    ]
  }'
recall
curl -X POST https://nexus-api-production-4177.up.railway.app/v1/amcp/recall \
  -H "Authorization: Bearer sk_write_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "auth decisions",
    "scope": { "kind": "project", "id": "acme-web" },
    "token_budget": 2000,
    "depth": "deep"
  }'
export / import / delete
POST /v1/amcp/export
{
  "scope": { "kind": "project", "id": "acme-web" },
  "format": "json"
}

POST /v1/amcp/import
{
  "items": [ ... ]
}

DELETE /v1/amcp/memories/:id?scope[kind]=project&scope[id]=acme-web
native routes still available
POST /v1/memory/ingest
POST /v1/memory/hydrate
GET  /v1/memory/sessions
GET  /v1/memory/stats

17) Reference agent CLI

Nexus now publishes a thin AMCP reference client package. Use it when you want to verify the hosted memory lifecycle with a real CLI instead of wiring your own client first.

published package
npx -y -p @nunchiai/reference-agent@latest amcp-agent --help

export NEXUS_URL=https://nexus-api-production-4177.up.railway.app
export NEXUS_API_KEY=sk_write_your_key
export OPENAI_API_KEY=your_model_key

npx -y -p @nunchiai/reference-agent@latest \
  amcp-agent task "Inspect this repo and summarize the auth flow." --amcp-trace
published compliance check
export NEXUS_URL=https://nexus-api-production-4177.up.railway.app
export NEXUS_API_KEY=sk_write_your_key
export NEXUS_READ_ONLY_API_KEY=sk_read_your_key

npx -y -p @nunchiai/reference-agent@latest amcp-agent compliance
successful output shape
[AMCP] session     start ...
[tool] read_file  ...
[AMCP] remember    scope=project  "Session summary: ..."
[AMCP] session     close ... transient_deleted=1
<final natural-language summary>

PASS remember
PASS recall
PASS delete_denied
PASS soft_delete
PASS export_import_roundtrip
AMCP_COMPLIANCE_OK
AMP_COMPLIANCE_OK   # compatibility alias marker
common failure output
LLM_API_KEY looks like a Nexus API key. Set a real OpenAI-compatible model key in OPENAI_API_KEY or LLM_API_KEY.

FAIL delete_denied: NEXUS_READ_ONLY_API_KEY is required for delete_denied compliance.

18) Export / import and delete semantics

Export/import is part of the portability story. Current delete behavior is soft delete, which excludes deleted memory from normal recall without claiming immediate hard purge semantics.

This matters when moving memory between systems, replaying context into another environment, or building reference-agent handoff flows.

19) Tool execution semantics (important)

Typing nexus_remember as plain text does not store memory. Memory is stored only when your agent executes the MCP tool call.

Verify by running nexus_stats, nexus_sessions, or nexus_recall after remember.

20) Error semantics

CodeMeaningAction
401Invalid or revoked keyRotate key and re-run init
402Plan or usage limit reachedUpgrade or wait next cycle
422Invalid schemaFix payload
5xxService issueRetry with backoff and alert ops