One Command to Connect MemNexus to All Your AI Agents
mx setup auto-detects your AI agents and configures MemNexus across Claude Code, Copilot, Cursor, and more. Built-in MCP bridge, no external binary, no secrets in config files.
Claude Opus 4.6
AI, edited by Harry Mower
MemNexus gives your AI coding agents persistent memory — the ability to remember project context, technical decisions, and debugging sessions across conversations. But getting it connected to your agents used to be a multi-step process: download an external binary, edit JSON config files in obscure directories, figure out the right format for each agent's config schema, and hope you didn't expose your API key in plain text somewhere.
We wanted it to be simpler. So we built mx setup — one command that configures MemNexus across all your AI agents automatically.
The Idea
AI coding agents are proliferating. Claude Code, GitHub Copilot, Cursor, Claude Desktop, Codex CLI — each one has a different config file path, a different JSON schema, and different expectations for how MCP servers are declared. Some use mcpServers, others use servers. Some live in ~/.config, others in ~/Library, and still others in %APPDATA%. Windows has different path conventions than macOS. It's a mess.
We wanted a setup experience that looked like this:
mx auth login --api-key YOUR_API_KEY
mx setup
And then you're done. MemNexus is available in every agent you use, with steering rules included, and zero config file spelunking required.
How It Works
mx setup is an intelligent configuration manager that:
- Auto-detects which agents are installed — checks project directories, searches PATH for binaries, scans global config directories
- Interactive multi-select — shows you which agents it found and lets you pick which ones to configure
- Writes MCP config to the correct file path — merges safely with existing entries, never overwrites other servers, creates
.bakbackups before modification - Writes steering rules — adds memory management guidance to each agent's instruction files (like
CLAUDE.md,.github/copilot-instructions.md,.cursor/rules/memnexus.md,AGENTS.md) - No API keys in config files — auth is read from
~/.memnexus/config.jsonat runtime
Supported Agents
We currently support five major agents:
- Claude Code — global config at
~/.claude.json, project config at.mcp.json - Claude Desktop — macOS config at
~/Library/Application Support/Claude/claude_desktop_config.json - GitHub Copilot (VS Code) — global config at
%APPDATA%/Code/User/mcp.json, project config at.vscode/mcp.json - Cursor — global config at
~/.cursor/mcp.json, project config at.cursor/mcp.json - Codex CLI — global config at
~/.codex/config.toml(TOML format)
Platform-aware path resolution handles Windows, macOS, and Linux differences automatically.
Built-in MCP Bridge: mx mcp serve
Before this release, connecting MemNexus required downloading a separate external binary to bridge stdio (how agents talk to MCP servers) with HTTP (how MemNexus's cloud API works). That binary had problems:
- Separate download step — another thing to install and manage
- Cross-platform issues — argument parsing errors on Windows
- Version drift — easy for the proxy to be out of sync with the CLI
We replaced it with a built-in bridge. The mx CLI itself now acts as the MCP transport:
Your AI Agent mx mcp serve MemNexus Cloud
+----------+ stdio +------------------+ HTTPS +--------------+
| Claude | --stdin------> | | ------------> | |
| Code | | stdio-to-HTTP | | MCP Server |
| Copilot | <--stdout---- | bridge | <------------ | |
| Cursor | | | | |
| etc. | | | + Auth header | |
+----------+ +------------------+ + Analytics +--------------+
The bridge uses the MCP SDK wired as a bidirectional pipe. Your agent sends JSON-RPC messages via stdin, mx forwards them to the MemNexus HTTP MCP server over HTTPS, and responses stream back via stdout.
API keys are read from your local config at runtime, not embedded in the agent's config file. The bridge logs diagnostic information to ~/.memnexus/logs/mcp-bridge.log, which you can tail with mx mcp logs.
If mx isn't in your PATH, the config gracefully falls back to npx -y @memnexus-ai/cli mcp serve, so it works even in environments where the CLI wasn't installed globally.
What It Looks Like in Practice
Initial Setup
# Step 1: Login (one time)
mx auth login --api-key YOUR_API_KEY
# Step 2: Run setup
mx setup
# Output:
# Detected agents:
# Claude Code (~/.claude.json)
# Cursor (~/.cursor/mcp.json)
# GitHub Copilot (.vscode/mcp.json)
#
# Select agents to configure:
# [x] Claude Code
# [x] Cursor
# [ ] GitHub Copilot
#
# Configuring Claude Code...
# Wrote MCP config to ~/.claude.json
# Wrote steering rules to CLAUDE.md
# Configuring Cursor...
# Wrote MCP config to ~/.cursor/mcp.json
# Wrote steering rules to .cursor/rules/memnexus.md
#
# Setup complete. Restart your agents to load MemNexus.
# Step 3: Verify
mx setup verify
# Output:
# Claude Code: MCP config present, steering rules present
# Cursor: MCP config present, steering rules present
Direct Setup for a Specific Agent
You can skip the interactive selector and configure a specific agent directly:
# Global config for Claude Code
mx setup claude-code
# Project-level config for Copilot
mx setup copilot --project .
# Global config for Cursor
mx setup cursor
Preview Changes Without Writing
mx setup claude-code --dry-run
# Output:
# Would write to ~/.claude.json:
# {
# "mcpServers": {
# "memnexus": {
# "type": "stdio",
# "command": "mx",
# "args": ["mcp", "serve"]
# }
# }
# }
#
# Would write steering rules to CLAUDE.md
Update Steering Rules Only
If you already have MCP configured but want to refresh or add steering rules:
mx setup rules --agent claude-code --project .
Remove MemNexus from an Agent
mx setup remove --agent claude-code
This safely removes the memnexus entry from the agent's config file and removes the steering rule section markers, leaving other config intact.
Check MCP Bridge Logs
# Last 100 lines
mx mcp logs -n 100
# Follow mode (live tail)
mx mcp logs -f
# Print full log path
mx mcp logs --path
What Gets Written
MCP Config
For Claude Code, the config entry looks like this:
{
"mcpServers": {
"memnexus": {
"type": "stdio",
"command": "mx",
"args": ["mcp", "serve"]
}
}
}
If you already have other MCP servers configured, mx setup merges this entry in without touching them. It creates a .bak backup of your original config file first, so you can always roll back if needed.
Steering Rules
Steering rules are AI instruction files that teach the agent how to use MemNexus effectively. For Claude Code, the rules are added to CLAUDE.md with section markers:
<!-- BEGIN MEMNEXUS STEERING -->
# mx-cli Memory Management Rules
## When to Save Memories
Save a memory after:
- Completing significant implementation milestones
- Making important technical decisions
- Resolving complex bugs or issues
...
<!-- END MEMNEXUS STEERING -->
The markers allow mx setup to update the steering content in future releases without overwriting your custom instructions. Everything outside the markers is preserved.
Different agents use different instruction file paths:
| Agent | Steering File Path |
|-------|-------------------|
| Claude Code | CLAUDE.md |
| GitHub Copilot | .github/copilot-instructions.md |
| Cursor | .cursor/rules/memnexus.md |
| General fallback | AGENTS.md |
Agent Config Reference
Each agent has its own config file path and JSON schema:
| Agent | Global Config Path | Project Config | Servers Key |
|-------|-------------------|----------------|-------------|
| Claude Code | ~/.claude.json | .mcp.json | mcpServers |
| Claude Desktop | ~/Library/.../claude_desktop_config.json | N/A | mcpServers |
| Copilot (VS Code) | %APPDATA%/Code/User/mcp.json | .vscode/mcp.json | servers |
| Cursor | ~/.cursor/mcp.json | .cursor/mcp.json | mcpServers |
| Codex CLI | ~/.codex/config.toml | .codex/config.toml | N/A (TOML) |
mx setup handles all of these variations automatically — you don't need to know which key or path applies to your agent.
Design Decisions
Non-Destructive Merging
mx setup never overwrites existing config. It reads the current file, parses it, merges the MemNexus entry into the mcpServers or servers object, and writes the combined result. If MemNexus is already present, it updates the entry in place. Other servers are untouched.
Backup Files
Before modifying any config file, mx setup creates a .bak backup in the same directory. If something goes wrong, you can restore with:
mv ~/.claude.json.bak ~/.claude.json
Section Markers for Steering Rules
Steering rules use <!-- BEGIN MEMNEXUS STEERING --> and <!-- END MEMNEXUS STEERING --> markers to define their section. This means:
- You can run
mx setupmultiple times to update the steering content without losing your custom instructions - Your own content outside the markers is preserved
- Removing MemNexus cleanly removes only the marked section
No Secrets in Config Files
Your MemNexus API key lives in ~/.memnexus/config.json, managed by mx auth login --api-key YOUR_API_KEY. The MCP config files don't contain any secrets — they just reference mx mcp serve, which reads the key at runtime.
This means:
- Config files can be safely committed to version control (if you want project-level
.mcp.jsonfiles) - No risk of accidentally exposing your API key in a
.claude.jsonfile shared on Discord - The same config works across multiple machines as long as each has run
mx auth login --api-key YOUR_API_KEY
It Just Works
From your perspective, setup is two commands:
mx auth login --api-key YOUR_API_KEY
mx setup
Then restart your agents and MemNexus tools are available. Use mx memories create, mx memories search, mx memories digest — all the memory management workflows work the same, but now your AI agents have native access to them via MCP.
The config logic, path resolution, schema differences, and platform quirks are all handled behind the scenes. You focus on building, and MemNexus remembers.
What's Next
We're thinking about a few extensions to mx setup:
- Health checks —
mx setup healthto test connectivity between the agent and the MCP server - Template steering rules — let users customize the instruction content before it's written
- More agents — support for Windsurf, Zed, Continue, and other MCP-compatible editors
The goal is to keep removing friction. Installing MemNexus should be as easy as npm install, and configuring it should be one command.
mx setup is available now in CLI v1.7.50+. Update with mx update or npm install -g @memnexus-ai/cli@latest.
Get updates on AI memory and developer tools. No spam.
Related Posts
Teams of Agents Shouldn't Repeat Each Other's Mistakes
One developer, five vertical teams of agents — MCP server team, CommitContext team, SDK team, customer portal team, etc. Before shared memory: they contradicted each other, built incompatible features, rediscovered the same bugs. After: they stay coherent because they can read from the same knowledge base.
Every Commit Tells You What Changed. Now Your Agent Knows Why.
CommitContext captures the reasoning behind every commit — decisions, debugging paths, and gotchas — giving your agent the context to investigate issues and connect changes across your codebase.
Your Agent Shouldn't Have to Ask What You Were Working On
Build-context delivers a structured briefing — active work, key facts, gotchas, recent activity — before your agent starts. One command, under 60 seconds. No more cold starts.