PluginBench
MCP Server
Active

Sugar MCP Server

io.github.cdnsteve/sugar

Local-first persistent memory layer for AI coding agents with semantic search and autonomous task execution

What is the Sugar MCP server?

Sugar is a persistent memory system for AI coding agents that stores project-specific and global knowledge in local SQLite databases. It enables AI agents like Claude Code to access architectural decisions, preferences, error patterns, and guidelines across sessions via MCP integration, with optional autonomous task queue execution.

Sugar solves AI agent amnesia by providing a local-first memory layer your AI coding agent can read and write directly. Store project decisions, preferences, error patterns, and cross-project guidelines; retrieve them via semantic search; and optionally delegate autonomous task execution. Everything stays on your machine with no API keys required.

How to install Sugar

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
Environment / auth
  • ANTHROPIC_API_KEY

    Anthropic API key for Claude model access

  • GITHUB_TOKEN

    GitHub token for repository access

  • SUGAR_DEFAULT_REPO

    Default repository in owner/repo format

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "sugar": {
      "command": "uvx",
      "args": [
        "sugarai",
        "mcp",
        "serve"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>",
        "GITHUB_TOKEN": "<YOUR_GITHUB_TOKEN>",
        "SUGAR_DEFAULT_REPO": "<YOUR_SUGAR_DEFAULT_REPO>"
      }
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • search_memory — Search both project and global memory stores with semantic search, returns results with scope labels
  • store_learning — Save a memory to project or global scope with type classification (decision, preference, file_context, error_pattern, research, outcome, guideline)
  • recall — Get formatted markdown context for a topic from both stores
  • get_project_context — Retrieve full project summary including global guidelines
  • list_recent_memories — Browse recent memories filtered by type

Use cases

  • Store architectural decisions and coding conventions once, retrieve them automatically in every AI session without re-explaining
  • Save error patterns and their fixes so your AI agent learns from past debugging and avoids repeating mistakes
  • Maintain cross-project guidelines (security practices, commit conventions, validation rules) that surface in every project's context
  • Delegate bug fixes and features to autonomous execution via task queue while Sugar provides project context and conventions
  • Resolve GitHub issues autonomously by filtering labels and letting Sugar implement fixes based on stored project knowledge

Sugar MCP server FAQ

What is Sugar and how does it work?

Sugar is a local-first memory layer for AI coding agents. It stores project-specific and global knowledge in SQLite databases on your machine, uses semantic search to retrieve relevant context, and integrates with Claude Code and other AI agents via MCP so they can read and write memory directly during sessions.

Is Sugar free?

Sugar is dual-licensed: AGPL-3.0 for open source and personal use (free), and a commercial license for proprietary use. The open source version is fully functional with no feature restrictions.

How do I install Sugar in Claude Code?

Install via pipx (`pipx install sugarai`), then run `claude mcp add sugar -- sugar mcp memory` to connect the memory server. Optionally add the task server with `claude mcp add sugar-tasks -- sugar mcp tasks`.

Do I need API keys or internet access?

No. Sugar is completely local-first and offline-capable. All data stays in SQLite databases on your machine - project memory in `.sugar/memory.db` and global memory in `~/.sugar/memory.db`. No external API calls or authentication required.

What AI agents does Sugar support?

Sugar works with Claude Code (full support), OpenCode, Goose, and Aider. It integrates via MCP for memory and task servers, or via CLI for agents without MCP support.

Can I share memory with my team?

Yes. Commit `.sugar/config.yaml` and `.sugar/prompts/` to your repository to share project settings. Global memory stays on your machine. Project memory can be shared by committing the database or exporting specific memories.

README (reference)

Source of truth, from the repository.

Sugar

Persistent memory for AI coding agents.

<!-- mcp-name: io.github.cdnsteve/sugar -->

Your AI agent starts every session with amnesia. The architecture decisions, conventions, and gotchas you explained last week are gone. Sugar is the local-first memory layer that remembers them for you - per project, across projects, on your machine.

Your memory. Your machine. Your data.

What Sugar Does

Sugar is a memory layer your AI coding agent can read and write directly:

  • Project memory - Decisions, preferences, error patterns, and research stored per-project
  • Global memory - Standards and guidelines shared across every project you work on
  • Semantic search - Retrieve relevant context by meaning, not just keywords
  • MCP integration - Your AI agent reads and writes memory directly during sessions
  • Local-first - SQLite on your disk, no API keys, fully offline-capable
  • Task queue - Optional autonomous execution, powered by the same memory layer

Quick Start

# Install once, use in any project
pipx install sugarai

# Initialize in your project
cd ~/dev/my-app
sugar init

# Store what you know
sugar remember "We use async/await everywhere, never callbacks" --type preference
sugar remember "JWT tokens use RS256, expire in 15 min - see auth/tokens.py" --type decision
sugar remember "When tests fail with import errors, check __init__.py exports first" --type error_pattern

# Retrieve it later
sugar recall "authentication"
sugar recall "how do we handle async"

Your AI agent can also read and write memory directly - no copy-pasting required.

MCP Integration

Connect Sugar's memory to your AI agent so it can access project context automatically.

Claude Code - Memory server (primary):

claude mcp add sugar -- sugar mcp memory

Claude Code - Task server (optional):

claude mcp add sugar-tasks -- sugar mcp tasks

Once connected, Claude can call store_learning to save context mid-session and search_memories to pull relevant knowledge before starting work. The memory server works from any directory - global memory is always available even outside a Sugar project.

Other MCP clients (Goose, Claude Desktop):

# Goose
goose configure
# Select "Add Extension" -> "Command-line Extension"
# Name: sugar
# Command: sugar mcp memory

# OpenCode - one command setup
sugar opencode setup

Global Memory

Some knowledge belongs to you, not just one project. Coding standards, preferred patterns, security practices - these should follow you everywhere.

# Store a guideline that applies to all your projects
sugar remember "Always validate and sanitize user input before any DB query" \
  --type guideline --global

sugar remember "Use conventional commits: feat/fix/chore/docs/test" \
  --type guideline --global

# View your global guidelines
sugar recall "security" --global
sugar memories --global

# Search works project-first, but guidelines always surface
sugar recall "database queries"
# Returns: project-specific memories + relevant global guidelines

Global memory lives at ~/.sugar/memory.db. Project memory lives at .sugar/memory.db. When you search, project context wins - but guideline type memories from global always appear in results so your standards stay visible.

Via MCP, pass scope: "global" to store_learning to save cross-project knowledge directly from your AI session.

Memory types: decision, preference, file_context, error_pattern, research, outcome, guideline

Full docs: Memory System Guide

How Memory Works

Sugar uses two SQLite databases and a tiered search strategy.

Two stores:

  • Project store (.sugar/memory.db) - context specific to one project
  • Global store (~/.sugar/memory.db) - knowledge that applies everywhere

Seven memory types, each with different retrieval behavior:

TypePurposeTTL
decisionArchitecture and implementation choicesNever
preferenceHow you like things doneNever
file_contextWhat files and modules doNever
error_patternBugs and their fixes90 days
researchAPI docs, library findings60 days
outcomeWhat worked, what didn't30 days
guidelineCross-project standards and best practicesNever

Search strategy - project-first with reserved guideline slots:

  1. Search the project store first (local context always wins)
  2. Reserve slots for global guidelines (cross-project standards always surface)
  3. Fill remaining slots with other global results
  4. Deduplicate across both stores

This means a mature project's local context dominates results. A new project with no local memory gets global knowledge automatically. And your guidelines are always visible regardless.

Search engine: Semantic search via sentence-transformers (all-MiniLM-L6-v2, 384-dim vectors) with sqlite-vec. Falls back to SQLite FTS5 keyword search, then LIKE queries. No external API calls - everything runs locally.

# Install with semantic search (recommended)
pipx install 'sugarai[memory]'

# Works without it too - just uses keyword matching
pipx install sugarai

MCP tools available to your AI agent:

ToolWhat it does
search_memorySearch both stores, returns results with scope labels
store_learningSave a memory (pass scope: "global" for cross-project)
recallGet formatted markdown context for a topic
get_project_contextFull project summary including global guidelines
list_recent_memoriesBrowse recent memories by type

MCP resources:

  • sugar://project/context - project summary
  • sugar://preferences - coding preferences
  • sugar://global/guidelines - cross-project standards

Task Queue

The task queue lets you hand off work and let it run autonomously. It reads from the same memory store, so Sugar already knows your preferences and patterns before it starts.

# Add tasks
sugar add "Fix authentication timeout" --type bug_fix --urgent
sugar add "Add user profile settings" --type feature

# Start the autonomous loop
sugar run

Sugar picks up tasks, executes them with your configured AI agent, runs tests, commits working code, and moves to the next task. It runs until the queue is empty or you stop it.

Delegate from Claude Code mid-session:

/sugar-task "Fix login timeout" --type bug_fix --urgent

Advanced task options: New in 3.10: Task Orchestration decomposes large features into a 4-stage workflow (research, plan, implement, review) with specialist agent routing and dependency-ordered sub-tasks.

# Orchestrated execution - 4-stage workflow (New in 3.10)
sugar add "Add OAuth authentication" --type feature --orchestrate

# Iterative mode - loops until tests pass
sugar add "Implement rate limiting" --ralph --max-iterations 10

# Check queue status
sugar list
sugar status

Full docs: Task Orchestration

Autonomous Issue Resolution (optional)

Because Sugar remembers your codebase and conventions, it can also resolve routine issues autonomously. Point it at a GitHub repo, configure which labels to act on (security, bug, dependabot), and Sugar will read each issue, implement the fix, run your tests, and open a PR.

Labeled issue appears on GitHub
  -> Sugar picks it up (label filter: "security", "dependabot", "bug")
  -> AI agent reads the issue, analyzes the affected code
  -> Fix implemented, tests run locally
  -> PR opened - you review and merge

This is one application of the memory layer, not the headline. Use Sugar purely as memory, or enable resolution - your choice. See workflow examples for security auto-fix, bug triage, test coverage, and more.

Supported AI Tools

Works with any CLI-based AI coding agent:

AgentMemory MCPTask MCPNotes
Claude CodeYesYesFull support
OpenCodeYesYessugar opencode setup
GooseYesYesVia MCP
AiderVia CLIVia CLIManual recall

Installation

Recommended: pipx - installs once, available everywhere, no venv conflicts:

pipx install sugarai

Upgrade / Uninstall:

pipx upgrade sugarai
pipx uninstall sugarai
<details> <summary>Other installation methods</summary>

pip (requires venv activation each session)

pip install sugarai

uv

uv pip install sugarai

With semantic search (recommended for memory):

pipx install 'sugarai[memory]'

With GitHub integration:

pipx install 'sugarai[github]'

All features:

pipx install 'sugarai[all]'
</details>

Sugar is project-local by default. Each project gets its own .sugar/ folder with its own database and config. Global memory lives at ~/.sugar/. Like git - one installation, per-project state.

Project Structure

~/.sugar/
└── memory.db          # Global memory (guidelines, cross-project knowledge)

~/dev/my-app/
├── .sugar/
│   ├── sugar.db       # Project memory + task queue
│   ├── config.yaml    # Project settings
│   └── prompts/       # Custom agent prompts
└── src/

Recommended .gitignore:

.sugar/sugar.db
.sugar/sugar.log
.sugar/*.db-*

Commit .sugar/config.yaml and .sugar/prompts/ to share settings with your team.

Configuration

.sugar/config.yaml is created on sugar init:

sugar:
  dry_run: false
  loop_interval: 300
  max_concurrent_work: 3

claude:
  enable_agents: true

discovery:
  github:
    enabled: true
    repo: "user/repository"

Documentation

Requirements

Contributing

Contributions welcome. See CONTRIBUTING.md.

git clone https://github.com/roboticforce/sugar.git
cd sugar
uv pip install -e ".[dev,test,github]"
pytest tests/ -v

License

Dual License: AGPL-3.0 + Commercial


Sugar is provided "AS IS" without warranty. Review all AI-generated code before use.

Related MCP servers

RERemembrallMCP logo

RemembrallMCP

Maintained

Persistent knowledge memory for AI coding agents with field-aware code graphs and hybrid search.

26
Rust
View repository →

Universal trust attestation for AI agents. Create, verify, and negotiate trust proofs.

View repository →

Local keystore + MCP server. Claude can sign EVM transactions but never sees the private key.

2
TypeScript
Apache-2.0
View repository →
EVEVMole logo

EVMole

Active

Extract function selectors, arguments, and state mutability from EVM bytecode without verification.

459
Rust
MIT
View repository →

Read your SisRUN (appsisrun.com.br) training plan: prescribed workouts, pace/HR windows, structure

0
Python
MIT
View repository →

Read-only Cedar ARMS railroad data via Cedar login for authorized carriers.

0
MIT
View repository →