Connect Your Agent
Add persistent memory to your AI agent in under 2 minutes. MemLayer works with any MCP-compatible client via stdio transport.
1. Start memlayer
Section titled “1. Start memlayer”Make sure memlayer is running:
bb local-server # local mode (recommended, port 8090)# or: bb server # development mode (port 8080)2. Configure your agent
Section titled “2. Configure your agent”Pick your client and add memlayer as an MCP server:
One command (recommended):
claude mcp add memlayer -- bb mcpOr create .mcp.json in your project root:
{ "mcpServers": { "memlayer": { "command": "bb", "args": ["mcp"], "cwd": "/path/to/memlayer" } }}Reload your Claude Code session to pick up the config.
Edit your config file:
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
{ "mcpServers": { "memlayer": { "command": "bb", "args": ["mcp"], "cwd": "/path/to/memlayer" } }}Restart Claude Desktop after saving.
Create .cursor/mcp.json in your project root:
{ "mcpServers": { "memlayer": { "command": "bb", "args": ["mcp"], "cwd": "/path/to/memlayer" } }}Or go to Cursor Settings > MCP > Add new MCP server and configure the command.
Create .windsurf/mcp.json in your project root:
{ "mcpServers": { "memlayer": { "command": "bb", "args": ["mcp"], "cwd": "/path/to/memlayer" } }}Or configure via Windsurf Settings > MCP.
Create .vscode/mcp.json in your project root:
{ "servers": { "memlayer": { "type": "stdio", "command": "bb", "args": ["mcp"], "cwd": "/path/to/memlayer" } }}Or go to Settings > GitHub Copilot > MCP and add the server.
Open Cline’s MCP settings panel in VS Code and add a new server with name memlayer, transport stdio, command bb, and args ["mcp"]. Set the working directory to your memlayer installation path.
3. Verify
Section titled “3. Verify”Ask your agent:
“Remember that I prefer dark mode in all my editors”
If memlayer is connected, the agent will call the memlayer_retain tool and confirm the memory was stored.
Then test recall:
“What are my editor preferences?”
The agent calls memlayer_recall and returns your stored memory.
What tools does my agent get?
Section titled “What tools does my agent get?”Once connected, your agent has access to five tools:
| Tool | What it does |
|---|---|
memlayer_retain | Store memories from conversation content |
memlayer_recall | Semantic search across stored memories |
memlayer_reflect | Consolidate scattered memories into concepts |
memlayer_forget | Remove a memory from active queries |
memlayer_batch_retain | Store multiple memories in a single call |
See MCP Tools Reference for full parameter details.
How the agent knows to use memlayer
Section titled “How the agent knows to use memlayer”When your agent connects via MCP, two things happen:
-
Tool discovery: The agent receives tool definitions (names, parameters, descriptions) through the MCP
tools/listmethod. This tells the agent what tools are available. -
Behavioral instructions via SKILL.md: memlayer serves a
SKILL.mdfile that your agent loads as a system prompt. This is the key part — it teaches the agent when and how to use memory effectively. The instructions include:- When to recall: Always check memory before answering questions about the user’s preferences, past decisions, or project context. Do this silently — don’t announce it.
- When to retain: Watch for high-signal moments like explicit preferences (“I prefer Tailwind”), corrections, decisions, and project context. Retain immediately and unobtrusively.
- How to write good memories: Third person, specific, self-contained, one fact per memory.
- Budget awareness: Be conservative — fewer high-quality memories beat many low-value ones.
- End of conversation: Review for any unretained facts worth saving and propose them to the user.
Without SKILL.md, the agent would have the tools but wouldn’t know the best practices for using them. The skill file is what makes memory feel natural rather than mechanical.
You can read the full instructions at
resources/public/SKILL.mdin the repository.
Other MCP clients
Section titled “Other MCP clients”Any client that supports stdio transport can connect to memlayer:
| Setting | Value |
|---|---|
| Command | bb |
| Args | ["mcp"] |
| Working directory | Path to your memlayer installation |
| Transport | stdio |
Next steps
Section titled “Next steps”- Quickstart: MCP — guided walkthrough of all four operations
- Quickstart: API — use the REST API directly with curl
- Concepts — understand how memlayer organizes knowledge