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
| Tool | Description |
|---|---|
create_memory | Save a new memory. Content is required; topics and entities are extracted automatically. |
search_memories | Search memories by meaning, or list recent memories chronologically. |
get_memory | Retrieve a memory by ID or name, with optional similar/related/conversation discovery. |
manage_memory | Update or delete an existing memory. |
recall | Get an AI-synthesized summary of a topic across your memory history. |
Context and session tools
| Tool | Description |
|---|---|
build_context | Build a context briefing before starting work on a topic. |
initialize_session | Return a refreshed working-memory brief (recent work, active decisions, gotchas). |
conversations | List conversations, search them, or view one as a summary or timeline. |
Knowledge and pattern tools
| Tool | Description |
|---|---|
knowledge_graph | Explore extracted facts, topics, and entities in the knowledge graph. |
patterns | Work with behavioral patterns (list, detect, analyze, compile). |
Account tools
| Tool | Description |
|---|---|
get_user_profile | Check account details: plan, quota, usage, and memory limits. |
submit_feedback | Send 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"]
}
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | The memory content. Topics and entities are extracted automatically. |
topics | string[] | No | Extra tags for categorization |
conversationId | string | No | Group related memories, or omit for auto-assignment |
name | string | No | Key for a named memory (upserts a new version if it already exists) |
memoryType | string | No | episodic, semantic, or procedural |
search_memories
{
"query": "deployment issues last week",
"limit": 10
}
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | No | Natural language search query. Omit to list recent memories. |
limit | number | No | Max results (default: 10) |
recent | string | No | Time filter, e.g. 24h, 7d, 2w |
topics | string[] | No | Restrict results to these topics |
knowledge_graph
{
"type": "facts",
"query": "technical decisions this quarter"
}
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | facts, topics, related_topics, entities, entity_memories, or health |
query | string | Depends | Search 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.
| Field | Contents |
|---|---|
source | Always mx-bridge |
errorType | The error's type name, for example TypeError |
message | The error message, cleaned as described below. It can include text the MCP server returned with the error |
timestamp | When the error happened, as an ISO 8601 time |
bridgeVersion | The CLI version |
serverUrl | The MCP server URL: scheme, host and path only, with no username, password, query string or fragment |
uptimeSeconds | How long the bridge has run (optional) |
reconnectCount | How many times the bridge has reconnected (optional) |
platform | Your operating system, for example linux (optional) |
nodeVersion | Your Node.js version (optional) |
clientType | The agent type (optional) |
toolMethod | For a failed request, the MCP method name, for example tools/call (optional) |
requestId | For a failed request, its JSON-RPC request ID (optional) |
sessionId | The 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.
| Variable | Description | Default |
|---|---|---|
MX_API_KEY | API key override (normally read from ~/.config/configstore/@memnexus-ai/cli.json) | From mx auth login |
MX_MCP_URL | Hosted MCP server URL | https://mcp.memnexus.ai/mcp |
MX_ERROR_REPORTING_ENABLED | Set to false, 0, no or off (any case) to stop the bridge sending error reports | Reports on |
MX_ERROR_REPORTING_TOKEN | If set, sent as a bearer token with each error report. Never your API key | Not set |
Troubleshooting
Agent doesn't see MemNexus tools
- Confirm the agent was configured: run
mx setup verify - Restart the AI platform after running
mx setup - Verify you are logged in:
mx auth status
Tools fail with authentication error
- Re-run
mx auth loginto refresh the stored key - Verify the key format:
cmk_live_<id>.<secret> - Check the bridge logs:
mx mcp logs
Connection timeout
- Check your internet connection
- Run
mx mcp doctorfor a full bridge and config health check - Check if a firewall is blocking outbound HTTPS (port 443)
Next steps
- Claude Desktop Setup — Detailed Claude Desktop integration guide
- Claude Code Setup — Claude Code integration guide
- Cursor Setup — Cursor integration guide
- Prompt Library — System prompts for memory-aware agents