Universal Memory for AI Agents
Self-hosted · HTTP streamable · No cloud
Memlink is a self-hosted MCP server that gives AI agents persistent, organized memory. One install, one URL, any agent connects — Devin Desktop, Cursor, Windsurf, Claude Code, or any MCP-compatible HTTP client.
npm install -g @memlink/cliRequires Node.js 18+ or Bun 1.0+.
From source:
git clone https://github.com/rblez/memlink.git
cd memlink && bun install && npm run buildmemlink serve --daemon # Start server in background
memlink serve --status # Verify it's runningConfigure your agent with http://localhost:4444/mcp (see below).
Add this JSON to your agent's MCP configuration:
{
"mcpServers": {
"memlink": {
"type": "http",
"url": "http://localhost:4444/mcp"
}
}
}Devin Desktop → Settings → MCP Servers
Cursor → Settings → MCP
Windsurf → ~/.codeium/windsurf/mcp_config.json
Claude Code → MCP_SERVERS_CONFIG env var or .mcp.json
Codex CLI → ~/.codexclirc or project .codexclirc
After connecting, agents discover the memory_read, memory_edit, memory_search, and memory_sync tools automatically. Start every new session by calling memory_read to load stored context.
| Command | Description |
|---|---|
memlink |
Show server URL, memory stats, and daemon status |
memlink serve |
Start the MCP server |
memlink serve --daemon |
Run in background |
memlink serve --stop |
Stop the daemon |
memlink serve --status |
Show server status + stats |
No CRUD commands — all memory operations happen through the MCP tools.
| Tool | Description |
|---|---|
memory_read |
Read index or a specific entry (id?, title?, full?) |
memory_edit |
Create or update an entry (title, content, tags?) |
memory_search |
Search entries by query |
memory_sync |
Memory stats (count, size, last updated) |
| Variable | Default | Description |
|---|---|---|
MEMLINK_DIR |
~/.memlink |
Data directory |
MEMLINK_PORT / PORT |
4444 |
Server port |
MEMLINK_HOST / HOST |
localhost |
Server host |
MEMLINK_NO_COLOR |
— | Disable colored output |
~/.memlink/
├── settings.json # Global config
├── .serve.pid # Daemon PID
└── default/ # Memory (auto-created)
├── meta.json # Memory metadata
├── index.json # Entry index (titles, tags, timestamps)
├── 1.md, 2.md, ... # Entries with YAML frontmatter
└── .backups/ # Timestamped backups on every write
- Atomic writes —
.tmp+renameSync(), no partial writes - Auto-backups — every mutation backed up to
.backups/ - File lock — concurrent writes serialized via
.lockwith TTL + retry - Health ticker — 30s heartbeat written to
.health - Rate limiting — 1000 req/min per IP
bun install # Install dependencies
npm run build # Build CLI + server
npm run dev:server # Server with hot reload
npm run dev:cli # CLI dev mode
npm run test # Run tests
npm run lint # ESLint
npm run format # Prettiersrc/
├── cli/index.ts # CLI entrypoint (commander)
├── cli/output.ts # Colors, badges, branding
├── cli/daemon.ts # Detached spawn (Windows VBScript)
├── server/index.ts # MCP server (Express + MCP SDK)
└── core/
├── storage.ts # Entry CRUD, atomic writes, backups
├── meta.ts # Per-memory meta.json
├── routing.ts # Default memory route
├── health.ts # Daemon heartbeat
├── lock.ts # File lock with TTL
├── memory.ts # Config + CLI helpers
└── types.ts # Types, constants, MEMLINK_VERSION
tests/ # memory, server, unit, vbscript
Apache License 2.0 — see LICENSE.
