MemNexus
AI Agents

MCP Integration

Connect AI agents to MemNexus via Model Context Protocol for native memory access.

The MemNexus MCP server gives AI agents direct access to memory tools. Agents can create, search, and manage memories without any custom code — the MCP protocol handles everything.

What is MCP?

Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools and data sources. Instead of building custom integrations, you configure an MCP server and the agent gets native tool access.

MemNexus provides an MCP server that exposes 12 tools across memory management, conversations, the knowledge graph, behavioral patterns, and account operations.

Quick setup

1. Install the CLI and log in

The MemNexus CLI (mx) configures the MCP integration and runs the bridge that connects your agent to the hosted MCP server.

npm install -g @memnexus-ai/cli
mx auth login

mx auth login stores your API key in ~/.config/configstore/@memnexus-ai/cli.json, so no secrets end up in your agent config files.

2. Configure your AI agent

Run mx setup and pick your agent, or target one directly:

mx setup                # interactive — detects installed agents
mx setup claude-code    # or configure a specific agent

Supported agent IDs: claude-code, claude-desktop, copilot, cursor, codex, opencode, chatgpt.

mx setup writes an MCP server entry that launches the bridge with mx mcp serve. For a JSON-config agent, the entry looks like this:

{
  "mcpServers": {
    "memnexus": {
      "type": "stdio",
      "command": "mx",
      "args": ["mcp", "serve"]
    }
  }
}

mx mcp serve is a stdio-to-HTTP bridge: your agent talks to it over stdio, and it forwards requests to the hosted MCP server at https://mcp.memnexus.ai/mcp using the API key from mx auth login.

3. Verify

Restart your AI platform. You should see MemNexus tools available. Try asking your agent:

"Search my memories for recent deployment notes"

You can also run mx setup verify to health-check every configured agent.

Available tools

The MCP server exposes 12 tools:

Memory tools

ToolDescription
create_memorySave a new memory. Content is required; topics and entities are extracted automatically.
search_memoriesSearch memories by meaning, or list recent memories chronologically.
get_memoryRetrieve a memory by ID or name, with optional similar/related/conversation discovery.
manage_memoryUpdate or delete an existing memory.
recallGet an AI-synthesized summary of a topic across your memory history.

Context and session tools

ToolDescription
build_contextBuild a context briefing before starting work on a topic.
initialize_sessionReturn a refreshed working-memory brief (recent work, active decisions, gotchas).
conversationsList conversations, search them, or view one as a summary or timeline.

Knowledge and pattern tools

ToolDescription
knowledge_graphExplore extracted facts, topics, and entities in the knowledge graph.
patternsWork with behavioral patterns (list, detect, analyze, compile).

Account tools

ToolDescription
get_user_profileCheck account details: plan, quota, usage, and memory limits.
submit_feedbackSend a bug report, feature request, or question to the MemNexus team.

Tool parameters

create_memory

{
  "content": "Deployed v1.26.2 with OpenAPI validation fixes.",
  "topics": ["deployment", "core-api"]
}
ParameterTypeRequiredDescription
contentstringYesThe memory content. Topics and entities are extracted automatically.
topicsstring[]NoExtra tags for categorization
conversationIdstringNoGroup related memories, or omit for auto-assignment
namestringNoKey for a named memory (upserts a new version if it already exists)
memoryTypestringNoepisodic, semantic, or procedural

search_memories

{
  "query": "deployment issues last week",
  "limit": 10
}
ParameterTypeRequiredDescription
querystringNoNatural language search query. Omit to list recent memories.
limitnumberNoMax results (default: 10)
recentstringNoTime filter, e.g. 24h, 7d, 2w
topicsstring[]NoRestrict results to these topics

knowledge_graph

{
  "type": "facts",
  "query": "technical decisions this quarter"
}
ParameterTypeRequiredDescription
typestringYesfacts, topics, related_topics, entities, entity_memories, or health
querystringDependsSearch string (required for facts; optional for topics/entities)

Architecture

The bridge is a stateless translation layer between your agent and the hosted MemNexus MCP server:

AI Agent (Claude, Cursor, ...)
    │
    ▼ MCP Protocol (JSON-RPC over stdio)
┌──────────────────────┐
│  mx mcp serve        │
│  (local bridge)      │
│  stdio → HTTP        │
└──────────┬───────────┘
           │ HTTPS
           ▼
┌──────────────────────┐
│  MemNexus MCP server │
│  mcp.memnexus.ai     │
│  Auth + Rate Limit   │
└──────────┬───────────┘
           │
           ▼
┌──────────────────────┐
│  Core API            │
└──────────────────────┘

The bridge runs locally and holds no state. It reads your API key from ~/.config/configstore/@memnexus-ai/cli.json and attaches it to each request, so credentials never appear in agent config files.

Error reports

mx mcp serve sends error reports by default, to help us find and fix bridge bugs. mx setup and mx mcp install print a notice about this when they configure an agent. The first time mx mcp serve runs, it prints the same notice to stderr, but many agents hide the bridge's stderr, so you may not see that one.

Reports can be linked to your account. Each report holds the MCP session ID. The bridge's health check, which runs while the bridge is up, sends the same session ID together with your API key. So a report is not anonymous.

When. The bridge sends a report when its connection to the MCP server fails, when it cannot forward a request from your agent to the server, or when its stdio connection to your agent fails. It sends at most 5 reports per error type in any 5 minutes.

Where. Reports go to the MCP server the bridge uses, at /bridge-errors. With the default server that is https://mcp.memnexus.ai/bridge-errors.

What a report holds. A report is a JSON object with these fields. Optional fields are left out when the bridge has no value.

FieldContents
sourceAlways mx-bridge
errorTypeThe error's type name, for example TypeError
messageThe error message, cleaned as described below. It can include text the MCP server returned with the error
timestampWhen the error happened, as an ISO 8601 time
bridgeVersionThe CLI version
serverUrlThe MCP server URL: scheme, host and path only, with no username, password, query string or fragment
uptimeSecondsHow long the bridge has run (optional)
reconnectCountHow many times the bridge has reconnected (optional)
platformYour operating system, for example linux (optional)
nodeVersionYour Node.js version (optional)
clientTypeThe agent type (optional)
toolMethodFor a failed request, the MCP method name, for example tools/call (optional)
requestIdFor a failed request, its JSON-RPC request ID (optional)
sessionIdThe MCP session ID, when there is one (optional). This is the field that links a report to your account

Before sending the message, the bridge removes usernames, passwords, query strings and fragments from any URL in it, replaces API keys, bearer tokens, api_key= and token= values, GitHub tokens and UUIDs with placeholders, and cuts it to 500 characters.

The bridge never adds your API key, the failed request's arguments or headers, or a stack trace to a report. The request carries a User-Agent of mx-cli/<version>. It carries an Authorization header only if you set MX_ERROR_REPORTING_TOKEN: the bridge then sends that value as a bearer token. It never sends your API key as the token.

Turn it off. Set MX_ERROR_REPORTING_ENABLED to false, 0, no or off in the environment that starts mx mcp serve, usually the env block of your agent's MCP server entry. Case does not matter and surrounding spaces are ignored. Any other value, or no value, leaves reports on.

Environment variables

These are read by mx mcp serve. All are optional — mx auth login and mx setup handle the defaults.

VariableDescriptionDefault
MX_API_KEYAPI key override (normally read from ~/.config/configstore/@memnexus-ai/cli.json)From mx auth login
MX_MCP_URLHosted MCP server URLhttps://mcp.memnexus.ai/mcp
MX_ERROR_REPORTING_ENABLEDSet to false, 0, no or off (any case) to stop the bridge sending error reportsReports on
MX_ERROR_REPORTING_TOKENIf set, sent as a bearer token with each error report. Never your API keyNot set

Troubleshooting

Agent doesn't see MemNexus tools

  1. Confirm the agent was configured: run mx setup verify
  2. Restart the AI platform after running mx setup
  3. Verify you are logged in: mx auth status

Tools fail with authentication error

  1. Re-run mx auth login to refresh the stored key
  2. Verify the key format: cmk_live_<id>.<secret>
  3. Check the bridge logs: mx mcp logs

Connection timeout

  1. Check your internet connection
  2. Run mx mcp doctor for a full bridge and config health check
  3. Check if a firewall is blocking outbound HTTPS (port 443)

Next steps