Sugar
Persistent memory for AI coding agents. Cross-session context, global knowledge, and autonomous task execution.
What is Sugar?
Sugar is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to persistent memory for ai coding agents. cross-session context, global knowledge, and autonomous task execution.
Persistent memory for AI coding agents. Cross-session context, global knowledge, and autonomous task execution.
This server falls under the Knowledge & Memory category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Persistent memory for AI coding agents. Cross-session contex
Use Cases
Maintainer
Works with
Installation
PIP
pip install sugaraiManual Installation
pip install sugaraiConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Sugar
Sugar is a persistent memory and autonomous task execution MCP server for AI coding agents, designed to solve the context loss problem that occurs between sessions in tools like Claude Code, Aider, and Goose. It maintains both project-level and global knowledge stores (SQLite databases) that agents can read and write across sessions, with optional semantic search for embedding-based memory retrieval. Developers use it to preserve decisions, coding preferences, architecture notes, and in-progress task queues so their AI coding assistant never starts from scratch.
Prerequisites
- Python 3.11 or higher
- pipx installed (recommended) or pip for installing the sugarai package
- A CLI-based AI coding agent: Claude Code, OpenCode, Goose, or Aider
- Optional: sentence-transformers library for semantic search (installed with the [memory] extra)
Install Sugar via pipx
Install Sugar using pipx for an isolated environment. Choose the appropriate extras based on what you need. The [memory] extra adds semantic search with sentence-transformers, and [github] adds GitHub integration.
# Basic install:
pipx install sugarai
# With semantic search (recommended):
pipx install 'sugarai[memory]'
# All features:
pipx install 'sugarai[all]'Initialize Sugar in your project
Run Sugar in your project directory to create the local memory database and config file at .sugar/memory.db and .sugar/config.yaml. Global memories are stored at ~/.sugar/memory.db.
cd /path/to/your/project
sugar initRegister the Sugar MCP server with your AI agent
Add the Sugar memory MCP server to your AI coding agent. For Claude Code, use the `claude mcp add` command. For other agents, add it to their respective MCP config.
# For Claude Code:
claude mcp add sugar -- sugar mcp memory
# For manual config (claude_desktop_config.json):
# See examples sectionStore initial project knowledge
Populate Sugar with your project's key decisions, conventions, and preferences so the agent can recall them in future sessions. Use scope: global for cross-project knowledge.
sugar remember "We use async/await everywhere, never callbacks" --type preference
sugar remember "JWT tokens use RS256 signing" --type decision
sugar remember "Database migrations use Alembic" --type architectureUse Sugar tools from within your AI agent
Once connected, your AI coding agent can call the MCP tools directly: search_memory, store_learning, recall, get_project_context, and list_recent_memories. Ask your agent to recall context at the start of a session.
Sugar Examples
Client configuration
Claude Desktop config for the Sugar MCP memory server.
{
"mcpServers": {
"sugar": {
"command": "sugar",
"args": ["mcp", "memory"]
}
}
}Prompts to try
Example prompts for an AI coding agent using Sugar memory tools.
- "Recall the project context and summarize what we were working on last session"
- "Search your memory for anything related to authentication in this project"
- "Store this decision: we chose Redis over Memcached for session storage because of pub/sub support"
- "What are my global coding preferences across all projects?"
- "List recent memories from the last week about database schema changes"Troubleshooting Sugar
'sugar: command not found' after installing with pipx
Run `pipx ensurepath` and restart your terminal to add the pipx bin directory to your PATH. Alternatively, use `pip install sugarai` and ensure your pip bin directory is in PATH.
Semantic search not working or 'sentence-transformers not installed' error
Install Sugar with the memory extra: `pipx install 'sugarai[memory]'` (or `pipx upgrade --include-injected sugarai` then `pipx inject sugarai 'sugarai[memory]'`). Semantic search requires sentence-transformers which has significant download size on first use.
Agent cannot find project memories from previous sessions
Verify Sugar was initialized in the correct directory with `sugar init`. Project memories live in .sugar/memory.db relative to the project root — ensure the agent is started from the same project directory. Use `sugar memories` to list stored memories and confirm they exist.
Frequently Asked Questions about Sugar
What is Sugar?
Sugar is a Model Context Protocol (MCP) server that persistent memory for ai coding agents. cross-session context, global knowledge, and autonomous task execution. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Sugar?
Install via pip with: pip install sugarai. Then configure your AI client to connect to this MCP server.
Which AI clients work with Sugar?
Sugar works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Sugar free to use?
Yes, Sugar is open source and available under the NOASSERTION license. You can use it freely in both personal and commercial projects.
Sugar Alternatives — Similar Knowledge & Memory Servers
Looking for alternatives to Sugar? Here are other popular knowledge & memory servers you can use with Claude, Cursor, and VS Code.
MemPalace
★ 52.6kA local AI memory system that stores all conversations verbatim and organizes them into navigable structures. It provides 19 MCP tools for AI assistants to search and retrieve past decisions, debugging sessions, and architecture debates automatically
Kratos
★ 25.7k🏛️ Memory System for AI Coding Tools - Never explain your codebase again. MCP server with perfect project isolation, 95.8% context accuracy, and the Four Pillars Framework.
Context Mode
★ 15.4kAn MCP server that preserves LLM context by intercepting large data outputs and returning only concise summaries or relevant sections. It enables efficient sandboxed code execution, file processing, and documentation indexing across multiple programm
Memu
★ 13.7kMemory for 24/7 proactive agents like OpenClaw.
MemOS
★ 9.3kMemOS (Memory Operating System) is a memory management operating system designed for AI applications. Its goal is: to enable your AI system to have long-term memory like a human, not only remembering what users have said but also actively invoking, u
Everos
★ 5.4kBuild, evaluate, and integrate long-term memory for self-evolving agents.
Browse More Knowledge & Memory MCP Servers
Explore all knowledge & memory servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Sugar in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Sugar?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.