Skip to main content
Glama

SynaptoMind

CI CodeQL Security Audit Coverage Status GitHub Release License: MIT Docker Bun zumik3-del/synaptomind MCP server

Local persistent memory for AI agents. Your agent remembers decisions, goals, and context across sessions — over MCP (stdio or HTTP). Data stays on your machine. The HTTP listener on port 3005 is an ops plane (health and graph repair), not a second agent API.

Works with Claude Desktop · Cursor · OpenCode · Codex · any MCP client


Quick Start

curl -fsSL https://raw.githubusercontent.com/zumik3-del/synaptomind/main/deploy/install.sh | bash

A piped script has no sibling files, so the shared helpers and config are fetched from the published base by default — no environment variables are needed. DEPLOY_RAW_URL overrides that base (forks/mirrors); an explicit APP_ENV_URL or LIB_RAW_URL still wins. The installer downloads and extracts the release tarball (DIST=binary); the server starts on http://127.0.0.1:3105 (HTTP ops) and http://127.0.0.1:3106/mcp (MCP). Config lives in /var/lib/synaptomind/config.json, reached via the /opt/synaptomind/config.json symlink. The installer seeds ports 3105/3106; the client-config and endpoint examples in this README use the built-in defaults (3005 HTTP ops / 3006 MCP).

For the full install & update guide (flags, channels, rollback, uninstall), see docs/DEPLOY.md. For the deployment convention shared with ziptask and subagentix — canonical layout, unit policy, the two distribution modes and the per-app app.env — see docs/DEPLOY-LAYOUT.md.

Connect your client — add to Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "synaptomind": {
      "url": "http://127.0.0.1:3006/mcp",
      "headers": { "Authorization": "Bearer YOUR_TOKEN" }
    }
  }
}

The installer generates SYNAPTOMIND_SECRET into /opt/synaptomind/.env; read it with sudo grep SYNAPTOMIND_SECRET /opt/synaptomind/.env. That's it — your agent now has persistent memory.


Related MCP server: DevFlow MCP

Use Cases

  • Coding agent memory — architecture decisions, bug root causes, TODOs persist between sessions

  • Project journal — decisions and goals as a connected graph, not scattered notes

  • Idea graph — capture thoughts, let semantic search find connections you missed

  • MCP memory backend — plug persistent memory into any MCP-compatible agent


Example: Auth Decision Across Sessions

You: "Remember: we chose JWT for auth, refresh tokens in httpOnly cookies"

Agent: [memory_store action=create — tags: auth, jwt, security]

--- new session ---

You: "What did we decide about auth?"

Agent: [memory_recall action=search "auth decision" → finds JWT thought with full context]

You: "What should I do next?"

Agent: [memory_status action=frontier → "Implement refresh token rotation" ranked #1]

Core loop: capture → link → retrieve → act. No manual organization — the graph connects related thoughts automatically.

sequenceDiagram
    participant U as You
    participant A as Agent
    participant S as SynaptoMind

    U->>A: "Remember JWT for auth"
    A->>S: memory_store(action=create, content, tags)
    S-->>A: thought_id
    
    Note over U,A: --- new session ---
    
    U->>A: "What about auth?"
    A->>S: memory_recall(action=search, "auth")
    S-->>A: JWT thought + context chain
    A->>S: memory_status(action=frontier)
    S-->>A: ranked next actions

Features

Concept

What it does

Thoughts

Individual notes/ideas. Each gets an embedding for semantic search and links to other thoughts.

Slots

Context windows summarizing your state: pending items, project context, active goals and architecture decisions. Agents read these on startup.

Frontier

Ranks "what to do next" over directive/todo/pending thoughts. Deferred pending items join once their wake_days delay has elapsed.

Primer

Compact project summary for quick context injection. Promotes the most relevant thoughts into one document.

Clusters

Group related thoughts; inspect and maintain their graph membership.

  • Graph storage — thoughts, edges, projects, tags in SQLite

  • Hybrid search — vector (vec0) + BM25 (FTS5) via Reciprocal Rank Fusion

  • Local embeddings — @huggingface/transformers, no API keys

  • MCP server — stdio + HTTP transport

  • Auto-clustering — batch grouping by embedding proximity

  • Background jobs — decay, preview-token retention


Architecture

SynaptoMind runs as a single Bun process: the HTTP server on port 3005 (health and health-check ops endpoints), the MCP server on port 3006 (stdio or HTTP), and a child process that serves local embeddings over IPC. Every thought operation is served over MCP; the HTTP listener is an ops plane, documented in docs/API.md. Storage is SQLite — one database, or one per user when users[] is configured — using the vec0 extension for vector search, FTS5 for full-text search, and an edges table for the graph.

graph LR
    A[AI Agent] -->|MCP| B[SynaptoMind]
    O[Ops / monitoring] -->|HTTP health| B
    B --> C[(SQLite)]
    C --> D[vec0 — vector search]
    C --> E[FTS5 — full-text search]
    C --> F[Graph — edges & links]

Layers and the rules that enforce them, the runtime modes, the read and write paths traced end to end, the DI convention and the Core/Pillar/Scaffolding map: docs/ARCHITECTURE.md.


Connecting MCP Clients

The same server entry works for every client that speaks MCP over HTTP — only the config file differs:

Client

Config file

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json

Cursor

.cursor/mcp.json (project) or the global equivalent

OpenCode

~/.config/opencode/opencode.json (under the mcp key, with "type": "remote")

{
  "mcpServers": {
    "synaptomind": {
      "url": "http://127.0.0.1:3006/mcp",
      "headers": { "Authorization": "Bearer YOUR_TOKEN" }
    }
  }
}

For clients that prefer stdio:

{
  "command": "bun",
  "args": ["run", "/path/to/synaptomind/src/index.ts", "--stdio"],
  "env": { "SYNAPTOMIND_SECRET": "your-token" }
}

By default the stdio process is a single-owner client: it opens an MCP session against the shared database but does not start its own embedder child process or the decay / preview-token-retention jobs at startup. The standalone HTTP server owns the scheduled jobs. An embedding request can still start a local child on demand; stdio does not reuse the HTTP server's embedder process.

If you run stdio with no separate server, opt into local ownership with the --stdio-standalone flag (args: ["run", "...", "--stdio", "--stdio-standalone"]) or SYNAPTOMIND_MCP_STDIO_STANDALONE=true / "mcp": { "stdioStandalone": true } in config.json.

See docs/codex-plugin.md for installation and usage.

Connect web ChatGPT to a private SynaptoMind MCP server without exposing an inbound network port. See docs/secure-mcp-tunnel.md for setup, validation, and the security boundary.


Configuration

All settings in config.json. Priority: env vars > config.json > defaults.

The HTTP listener port resolves in that order too: SYNAPTOMIND_PORT overrides config.json server.port, which overrides the built-in 3005 (DEFAULTS, ENV_MAPPINGS and applyEnvOverrides() in src/config.ts).

Setting

Default

Description

server.port

3005

HTTP ops port (health, health-check)

server.host

127.0.0.1

Bind address

mcp.httpPort

3006

MCP HTTP transport port

mcp.stdioStandalone

false

Let a --stdio process own the embedder + background jobs (default: shared HTTP server owns them)

embedder.model

Xenova/multilingual-e5-small

HuggingFace embedding model

db.path

./data/synaptomind.db

SQLite database path

Auth tokens via env vars only:

Env var

Purpose

SYNAPTOMIND_SECRET

Bearer token in single-user mode (users: [], the default)

SYNAPTOMIND_USER_TOKEN_<ID>

Per-user bearer token when config.json has a users list; SYNAPTOMIND_SECRET is then inert

In multi-user mode every HTTP request must present one of the configured users' tokens and is served that user's database. Without a token the server fails closed: authenticated API and MCP requests are rejected with 401 and a warning is logged at startup. For local development only, SYNAPTOMIND_ALLOW_INSECURE=true disables auth entirely in single-user mode.

Multi-user: config.json may carry a users list — one SQLite database and one bearer token per user, all served by the same process. Adding, rotating and removing users, and switching an existing install over, is in CONFIG.md § Users.

See config.json.example for all options. Full reference: docs/CONFIG.md. Custom MCP instructions: docs below.


From source (development)

docker compose up -d --build

Volumes mount ./data and ./config.json.

Published image (production)

The compose file resolves the image via the SYNAPTOMIND_IMAGE variable (default :local, built from source):

SYNAPTOMIND_IMAGE=ghcr.io/zumik3-del/synaptomind:latest docker compose pull && docker compose up -d

Tagged releases publish ghcr.io/zumik3-del/synaptomind:<version> (and :latest for non-prereleases) via the release workflow; the deploy/ framework does not manage containers.

Container user

The container runs as a non-root user (uid/gid 10001). Make sure the mounted paths are writable/readable by that uid:

sudo chown -R 10001:10001 data   # required once when upgrading from older (root-run) images
chmod 644 config.json            # config.json must be readable by uid 10001

Auth

echo "SYNAPTOMIND_SECRET=your-secret-token" > .env

See .env.example for all variables. Without a token (SYNAPTOMIND_SECRET in single-user mode, or a configured user's token when config.json has a users list) the server fails closed — authenticated requests are rejected with 401. Use SYNAPTOMIND_ALLOW_INSECURE=true for local development only (single-user mode).

For full Docker guide (updating, backup, troubleshooting), see docs/DOCKER.md.

Every thought operation is an MCP tool call (stdio or POST /mcp on port 3006). The HTTP listener serves the ops endpoints only — /health and the two /api/health-check routes — and answers 404 for everything else; see docs/API.md.

Agent: [memory_store action=create
        content="First session went well" tags=["retrospective"]
        cwd="/path/to/project"]

Agent: [memory_recall action=search query="session retrospective" limit=5
        cwd="/path/to/project"]

Arguments, envelopes and per-action examples: docs/mcp-tools.md.

Health check

curl http://127.0.0.1:3005/health

Graph health report

curl "http://127.0.0.1:3005/api/health-check?severity=warning" \
  -H "Authorization: Bearer $SYNAPTOMIND_SECRET"

Category

Tools

Recall

memory_recall (search, get, context, chain, list)

Store

memory_store (create, update, link, link_batch, unlink, unlink_batch, retype, bulk_create)

Supersede

memory_supersede (archive, archive_batch, merge)

Status

memory_status (slots, frontier, config, health)

Projects

memory_manage (list, create, update, delete)

Consolidate

memory_crystallize (graph, cluster, auto_cluster)

Reflect

memory_reflect (reflect)

Primers

memory_primers (list, delete)

Retention

retention_review (list, delete, compact)

Guide

memory_guide

Every action answers in one response envelope — { items, meta } for collections, { item, meta } for single objects — and the project-scoped actions take an optional cwd that narrows an answer to one project: without it a read answers across every project and says so in meta, while a created thought lands in the default project. For action-level detail (parameters, the dry-run/confirm pattern, examples), see docs/mcp-tools.md.

Breaking 0.x changes: the 0.x line pruned several subsystems from the MCP tools, the HTTP surface and the configuration surface. The 0.20 release shrank HTTP to the three ops endpoints: every /api/* thought route is gone and answers 404, with the route → MCP tool map and the dropped capabilities in docs/API.md. CHANGELOG.md records every removal per release; the pages linked here document only the surface that still exists, and a configuration file that still carries retired keys loads unchanged and ignores them.


Custom Instructions

The MCP server sends instructions to the AI agent on startup. To customize:

  1. Create a markdown file (e.g., instructions.md)

  2. Set the path in config.json:

"mcp": {
  "instructionsFile": "./instructions.md"
}

Or via env var:

export SYNAPTOMIND_MCP_INSTRUCTIONS_FILE=./instructions.md

Falls back to default instructions if file not found.


Development

bun run test             # canonical suite (src/), sharded across parallel processes
bun run test:unit        # fast lane: everything except the entry-point/child-boot tests
bun run test:integration # slow lane: those entry-point/child-boot tests only
bun run test:serial      # single-process oracle (`bun test src`), same file set
bun run test:all         # full suite (src/ + deploy/ + eval/ + scripts/)
bun run test:deploy      # deploy shell integration (deploy/)
bun run test:eval        # retrieval quality gates (eval/)
bun run test:perf        # perf scale (SYNAPTOMIND_PERF_SUITE=1)
bun run test:isolated    # subprocess-heavy embedder IPC + http transport lifecycle
bun run eval             # memory evaluation harness (recall@k, MRR, baselines)
bunx biome check src/ eval/   # lint (advisory)
bun run format           # apply Biome formatting (src eval scripts deploy)
bun run format:check     # verify formatting — blocking CI gate

bun test (without a script) still runs the full suite; the canonical developer gate is bun run test, which runs exactly the same src/**/*.test.ts set as bun test src but splits the files across several bun test processes — Bun runs test files sequentially in one process, so sharding is what uses the extra cores. bun run test:serial is the single-process fallback for bisecting a failure, and --shards N (or a -- passthrough, e.g. bun run test -- --bail) is honoured by the runner. Lanes and shard weights live in src/test/lanes.ts.

vec0.so is installed by bun install into the checkout that ran it, so a fresh git worktree has no copy of its own. bunfig.toml preloads src/test/preload.ts for tests only: when the running checkout has no vec0.so, it points the test process at the main checkout's copy and prints one line naming the file it used. A local copy always wins (and SYNAPTOMIND_VEC0_PATH overrides everything), so a genuinely broken extension still fails loudly.

For step-by-step usage scenarios, see docs/SCENARIOS.md.

For performance benchmarks (search latency, write throughput, embedding speed), see docs/BENCHMARK.md.

For the memory evaluation harness (metrics, datasets, thresholds), see docs/EVAL.md.

Releasing

Releases are created by CI on main; the version is set explicitly, not derived from commit types.

  1. From a clean dev tree, prepare the bump: bash scripts/release.sh <version> (or bun run release <version>) — bumps version in package.json, the version and image tag in server.json, and regenerates the pending CHANGELOG.md section. It does not create a tag, commit, or push.

  2. Commit the bump + changelog, push, and open a PR dev → main.

  3. Merging the PR triggers .github/workflows/release.yml on main: it verifies the tree (tsc + bun test), creates the annotated tag v<version> plus the GitHub Release (prerelease when the version contains -), and separately publishes the Docker image.


Contributing

See CONTRIBUTING.md.

License

MIT


Topics

mcp mcp-server ai-memory agent-memory llm-memory persistent-memory self-hosted local-first knowledge-graph semantic-search ai-agents sqlite rag

Available Tools

10 tools
memory_crystallizeA

Read and maintain the cluster graph: cluster thoughts plus the cluster edges pointing at their members. Additive only: nothing is deleted or overwritten. Answers { item, meta } / { items, meta }, with one documented exception: action=graph answers { items: nodes, edges, meta }, because a graph is two collections. Actions: graph, cluster, auto_cluster (Union-Find; preview→confirm, clusters created only with confirm: true). memory_recall action=search with is_cluster=true reads them; this tool creates them.

Inputs: action (required), cwd, tags, limit, +12 more. Returns: result

memory_guideA
Read-onlyIdempotent

Read the built-in reference instead of guessing an action, a parameter or a response shape. Read-only and parameterless: one text document, no writes. Call it first in a session, or whenever a name, an argument or an envelope field is uncertain — one call is cheaper than a rejected one. It covers every tool's actions, the shared envelopes and error shape, cwd scoping, preview/confirm, thought fields and statuses, edge types, search modes and filters, retention and decay, health-check scoring and reflection semantics. For current state use memory_status action=config or action=health, memory_recall and memory_primers.

Inputs: no named parameters. Returns: result

memory_manageA
Destructive

Manage projects — the containers thoughts belong to; the thoughts themselves are memory_recall and their writes memory_store. Every action answers in one envelope: list returns { items, meta }, the single-project actions return { item, meta }. Actions: list (each project's id, name, description and local_path — the way to resolve a path to its project), create, update, delete (preview→confirm).

Inputs: action (required), name, fields, confirm, +4 more. Returns: result

memory_primersA
Destructive

The always-at-hand set — thoughts recalled often enough to be injected into every conversation — and the only tool that reviews or removes them. list answers { items, meta }, delete { item, meta}. Primers are created automatically on the search path, never by this tool; list returns them most-hit first (up to 500); read the thought itself with memory_recall action=get. delete removes the primer record only (the thought and its edges stay) and is preview-first: confirm=true must echo the meta.preview.token back, and a missing, stale or mismatched one needs a fresh preview. Deletion is not permanent: the thought is promoted again on its next recall while its hit count still reaches the threshold.

Inputs: action (required), confirm, primer_id, preview_token. Returns: result

memory_recallA

Search and retrieve thoughts. One envelope per action: collections answer { items, meta }, single objects { item, meta }; meta carries reason and preview when they apply. Id lookup runs before both search legs: a full UUID is an explicit reference and ignores status/cwd/tag/min_importance, while a hex prefix of 13+ characters is only a timestamp window, so it takes the status/cwd/tag/min_importance scope of the call like any other query, falling back to the ordinary search when it addresses nothing inside it. is_cluster is a shape constraint, not a scope. Actions: search (hybrid RRF by default, vector-only with hybrid=false; is_cluster=true is the cluster-only preset; may mutate via primer promotion/hit count), get, context (chain's { thought, upstream, downstream } view from a query or a thought_id), chain, list (paged inventory without a query: status/cwd/tag/is_cluster, limit/offset, total in meta.counts). Status defaults: search active, list all. cwd is optional for search, list and context: it scopes to one project, and omitted it answers across every project with a meta.warnings note; get/chain accept and ignore it. Output: compact (default) returns id, content, status, tags, project; compact=false or fields widen it.

Inputs: action (required), cwd, tag, mode, +23 more. Returns: result

memory_reflectA

Close a session: write down its decisions, pending items and goals. Reflect is the session-level write path — row-level CRUD is memory_store, clustering memory_crystallize, retiring a thought memory_supersede. Actions: reflect (summary, decisions, pending, goals). cwd is a write scope: omitted, decisions/pending land in the default project and meta.scope is null. Answers { item, meta }.

Inputs: action (required), cwd, pending, summary, +6 more. Returns: result

memory_statusA
Read-onlyIdempotent

Read-only system state — what the store holds and how it is configured, not the thoughts (memory_recall) or their writes (memory_store). Actions: slots (project_context and active_goals as stored rows; pending_items derive from pending thoughts and architecture_decisions from primers), frontier (next actions ranked, limit 1-50), config, health. cwd is optional for slots and frontier: it scopes to one project, and omitted it leaves meta.scope null with a meta.warnings note — slots then reads only the global rows. Answers { items, meta } for slots and frontier, { item, meta } for config and health.

Inputs: action (required), k, cwd, fix, +8 more. Returns: result

memory_storeA
Destructive

Store and modify thoughts. Single objects answer { item, meta }, batches { items, meta } with counters in meta.counts; a preview sets meta.preview={token,destructive:true}. Actions: create; update (tags merge by default, tags_mode=replace overwrites); link; link_batch and unlink_batch (up to 1000 edges each, one transaction, one row per occurrence; unlink_batch confirm-gated); unlink and retype (preview→confirm, unlink dry-run by default, retype returns both edge ids); bulk_create (up to 10000 thoughts). A write returns compact thoughts unless you read the row back with memory_recall compact=false.

Inputs: action (required), cwd, tags, links, +20 more. Returns: result

memory_supersedeA
Destructive

Retire a thought without deleting it: archive one, archive a batch, or merge one thought onto another and transfer its edges. Reading is memory_recall, creating and linking memory_store, permanent removal retention_review. Actions: archive (idempotent), archive_batch (one row per requested occurrence), merge (source→target, reports edges_transferred). All actions preview by default and set meta.preview={token,destructive:true}; confirm=true executes after revalidating state. Answers { item, meta } for archive and merge, { items, meta } for archive_batch with the aggregate in meta.counts.archived/failed.

Inputs: action (required), cwd, confirm, source_id, +7 more. Returns: result

retention_reviewA
Destructive

Review retention candidates: list candidates, preview or confirm deletion, or compact candidates into a summary. To keep a thought instead of deleting it, call memory_store action=update with is_protected=true (which also drops it out of the candidate list). Answers the shared envelope { items, meta } for list and { item, meta } for delete/compact; a preview sets meta.preview={token,destructive:true}.

Inputs: action (required), limit, fields, offset, +8 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 10 tools

    Disambiguation3/5

    Most tools have explicitly stated boundaries, and several descriptions go out of their way to say 'reading is memory_recall, writing is memory_store,' which helps a lot. However, read surfaces genuinely overlap: memory_recall action=list (paged inventory), memory_status action=slots/frontier, memory_primers action=list, and retention_review action=list all return rows from the same store, and memory_recall action=search with is_cluster=true overlaps memory_crystallize. An agent must read long, densely cross-referenced descriptions to choose correctly.

    Naming Consistency3/5

    Eight of ten tools share a clean memory_<verb|noun> prefix, but retention_review breaks the prefix entirely and memory_primers drops the verb form. Within the prefix the second token mixes verbs (recall, store, supersede, manage, crystallize, reflect) with nouns (status, guide, primers), so the pattern is readable but not predictable.

    Tool Count4/5

    Ten tools is a sensible count for the domain and each tool maps to a distinct lifecycle area (store, recall, supersede, clusters, primers, projects, retention, session close). The caveat is that memory_recall and memory_store each bundle six to ten actions, so the effective surface is much larger than ten suggests.

    Completeness4/5

    The surface covers the full lifecycle: create/update/link/retype, search/get/context/chain/list, supersede/archive/merge, clustering, project containers, session reflection, primers, and a self-documenting guide. The main gap is permanent deletion, which is only reachable through retention candidates — there is no direct hard-delete for an arbitrary thought, which could dead-end an agent needing to remove a specific row.

    Maintenance

    ActivityActive
    ResponsivenessUsually handled

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Basic Memory is a knowledge management system that allows you to build a persistent semantic graph from conversations with AI assistants. All knowledge is stored in standard Markdown files on your computer, giving you full control and ownership of your data. Integrates directly with Obsidan.md
      2
      12
      12,352 PyPI
      4,735
      AGPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Persistent semantic memory for AI agents — hybrid SQLite + FTS5 with DAG-based summaries, context compaction, and 7 MCP tools. Open source, self-hosted, zero API cost.
      161
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Self-hosted semantic memory for AI agents. Save worklogs, decisions, and notes via MCP, then recall them across sessions by meaning rather than keyword. Backed by Postgres + pgvector with local embeddings (multilingual-e5-base).
      1
      MIT