synapse-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@synapse-mcprecall what we decided about the auth token expiry"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Synapse Cortex (synapse-cortex)
Biomimetic Cognitive Graph Memory, Spreading Activation, and Progressive Context Packing for Autonomous AI Agents.
Why Synapse?
AI agents without memory forget everything between sessions. However, naive vector databases (flat RAG) introduce critical cognitive flaws:
Belief Drift & Hallucination: Flat vector search blindly retrieves outdated memories alongside new ones. If a task status changes from In Progress to Completed, traditional RAG frequently returns both, causing the model to hallucinate progress.
Disconnected Knowledge: Real-world knowledge forms an associative graph. If an agent knows "Module X manages authentication" and "Module X experienced an outage under load Y", it must associate these facts when debugging auth bottlenecks without explicit keywords.
Context Window Bleed: Dumping raw conversation transcripts into system prompts consumes thousands of tokens and triggers attention dilution.
Episodic Amnesia: Agents repeatedly attempt failed operations because they lack structured counterfactual guardrails (Situation → Action → Outcome → Lesson).
Synapse solves this with a biomimetic cognitive memory architecture designed specifically for long-running autonomous agents.
Related MCP server: agent-memory-mcp
Core Tripartite Architecture
┌────────────────────────────────────────┐
│ Autonomous Agent Runtime │
└───────┬────────────────────────▲───────┘
│ retain() │ recall()
▼ │
┌───────────────────────────────────────────────────────────┐
│ SYNAPSE COGNITIVE CORTEX │
│ │
│ [Tier 1: Mental Models] [Tier 2: Observations] │
│ Dynamic AST Markdown Deduplicated Pattern Clusters│
│ │
│ [Tier 3: Graph Storage] [Tier 4: Research Vault] │
│ FTS5 (BM25) + Dense Vector Quarantined Harvested Docs │
└───────────────────────────▲───────────────────────────────┘
│ reflect()
┌────────┴────────┐
│ Background Loop │
│ Belief Revision │
│ Hebbian Decay │
└─────────────────┘retain()— Micro-Episodic Storage: Extracts atomic facts, categorizes knowledge (architecture,sop,decision,preference,incident), generates 384-dim dense vectors, and establishes synaptic associative graph edges.recall()— Hybrid Spreading Activation: Combines SQLite FTS5 (BM25 lexical search), dense vector cosine similarity, and multi-hop graph spreading activation. Context is packed progressively using multi-tiered token budgeting (L0 Abstract < 40 tokens, L1 Overview < 300 tokens).reflect()— Cascading Belief Revision: Resolves factual contradictions, supersedes stale beliefs, applies Hebbian reinforcement based on retrieval co-activation, and rolls up obsolete nodes into compact abstract summaries.
Quickstart
Installation
The quickest way to install Synapse Cortex and the synapse-mcp server binary:
pip install synapse-cortex(Or for optional development and testing tools: pip install "synapse-cortex[dev]").
Installing from Source (Developers)
Linux & macOS
git clone https://github.com/nafispradipta/synapse-agent.git
cd synapse-agent
# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install package in editable mode
pip install -e ".[dev]"Windows (PowerShell)
git clone https://github.com/nafispradipta/synapse-agent.git
cd synapse-agent
# Create and activate virtual environment
python -m venv .venv
.venv\Scripts\Activate.ps1
# Install package in editable mode
pip install -e .
# (Optional) Install development and testing dependencies
pip install -e ".[dev]"Windows (Command Prompt - cmd.exe)
git clone https://github.com/nafispradipta/synapse-agent.git
cd synapse-agent
# Create and activate virtual environment
python -m venv .venv
.venv\Scripts\activate.bat
# Install package in editable mode
pip install -e .Basic Usage
from synapse.adapter import SynapseAdapter
# Initialize in-memory or persistent SQLite storage
adapter = SynapseAdapter({"db_path": "./data/synapse.db", "token_budget": 250})
# 1. Retain an architectural rule or invariant
adapter.retain(
content="Always enable WAL mode and set busy_timeout >= 5000ms for concurrent SQLite operations.",
category="architecture",
salience=0.95,
title="SQLite Concurrency Rule"
)
# 2. Record an episodic learning experience
adapter.record_episode(
title="Database Lock Incident Under High Load",
situation="Agent workers experienced database lock contention during concurrent batch writes.",
action_taken="Switched journal mode to WAL and increased busy timeout to 5000ms.",
outcome="Lock contention eliminated completely across all concurrent workers.",
lessons_learned="Always enable WAL mode and configure busy_timeout >= 5000ms.",
salience=0.95
)
# 3. Recall packed context for your agent prompt
recalled_context = adapter.recall("How to handle SQLite database locks under high load?")
for block in recalled_context:
print(block)Model Context Protocol (MCP) Server
Synapse includes a built-in JSON-RPC 2.0 MCP server, enabling AI coding assistants (Claude Desktop, Cursor, Windsurf, OpenCode, Codex, Pi CLI, Hermes, Zed, etc.) to tap directly into the shared cognitive memory cortex.
MCP Configuration
Add the synapse entry to your assistant's MCP configuration (mcpServers block):
{
"mcpServers": {
"synapse": {
"command": "synapse-mcp"
}
}
}Shared Memory Pool: By default,
synapse-mcpautomatically stores memory in~/.synapse/synapse.db. This means all your AI assistants (Claude, Cursor, terminal agents) automatically share the exact same persistent brain across all projects on your machine.If you prefer an isolated database for a specific project, simply add the
SYNAPSE_DB_PATHenvironment variable:{ "mcpServers": { "synapse": { "command": "synapse-mcp", "env": { "SYNAPSE_DB_PATH": "/path/to/project/data/synapse.db" } } } }
Direct CLI Execution
For terminal-based coding agents or stdio inspection:
synapse-mcpAvailable MCP Tools
Tool | Description |
| Hybrid semantic vector + BM25 search across all past memories, SOPs, and architectural decisions. |
| Store an atomic rule, decision, or SOP with salience weighting. |
| Record a structured episodic experience (Situation → Action → Outcome → Lesson). |
| Retrieve real-time cortex statistics (active nodes, edges, vectors, superseded counts). |
Configuration & Dual-Engine Architecture
Synapse operates using two complementary cognitive engines: The Embedding Engine (for dense associative vector search) and The LLM Engine (for subconscious reflection and mental model synthesis).
┌────────────────────────────────────────────────────────────────────────┐
│ SYNAPSE COGNITIVE ENGINES │
├──────────────────────────────────┬─────────────────────────────────────┤
│ 1. Dense Embedding Engine │ 2. LLM Engine │
│ (Vector Search & Association) │ (Belief Revision & Reflection) │
├──────────────────────────────────┼─────────────────────────────────────┤
│ Primary: sentence-transformers │ Any OpenAI-Compatible Provider: │
│ (all-MiniLM-L6-v2, 384-dim) │ OpenAI, Ollama, vLLM, Groq, etc. │
│ │ │
│ Fallback: Built-in pure-Python │ Fallback: Built-in rule-based │
│ CRC32 n-gram vectorizer │ deterministic heuristics │
│ (Zero dependencies, 0 token cost)│ (Operates offline without API keys) │
└──────────────────────────────────┴─────────────────────────────────────┘1. The Embedding Engine (Vector Search)
Synapse generates 384-dimensional dense vectors to power hybrid retrieval (BM25 lexical + vector cosine similarity):
Zero-Dependency Built-In Fallback: If no external libraries are installed, Synapse automatically uses a built-in deterministic subword n-gram vectorizer. It requires zero external packages, zero model downloads, and zero API costs.
Neural Embeddings (Optional): If you install
sentence-transformers, Synapse seamlessly upgrades to neural embeddings usingall-MiniLM-L6-v2(or your configuredSYNAPSE_EMBEDDING_MODEL):pip install sentence-transformers
2. The LLM Engine (Cognitive Synthesis)
The LLM is invoked during background consolidation to synthesize high-level Mental Models, extract abstract takeaways from episodic experiences, and resolve complex factual contradictions:
Provider-Agnostic: Any standard OpenAI-compatible API is supported (local runners like Ollama, vLLM, LM Studio, or hosted endpoints like OpenAI, Groq, DeepSeek).
Graceful Fallback: If no LLM endpoint or API key is provided, Synapse automatically uses deterministic rule-based heuristics. Core memory operations (
retain(),recall(),record_episode()) never crash or block.
Environment Configuration
Copy the environment template:
cp .env.example .envEdit .env according to your requirements:
# SQLite Database location (default: ./data/synapse.db)
SYNAPSE_DB_PATH=./data/synapse.db
# Context Packing Token Budget
SYNAPSE_TOKEN_BUDGET=250
# Standard OpenAI-Compatible LLM Settings
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_API_KEY=your_api_key_here
OPENAI_MODEL=gpt-4o-mini
# (Optional) Dedicated Synapse Endpoint Override
# SYNAPSE_BASE_URL=http://localhost:11434/v1
# SYNAPSE_API_KEY=
# SYNAPSE_MODEL=
# (Optional) Embedding Model Override (defaults to all-MiniLM-L6-v2)
# SYNAPSE_EMBEDDING_MODEL=all-MiniLM-L6-v2
# (Optional) Markdown Knowledge Base / Vault Path
# SYNAPSE_VAULT_PATH=./vaultNote for Local Runners (Ollama, vLLM): If you are running locally with Ollama or vLLM, set
OPENAI_BASE_URL=http://localhost:11434/v1and leaveOPENAI_API_KEYandOPENAI_MODELblank to use your active model.
Testing
Synapse comes with an exhaustive test suite covering all cognitive subsystems:
pytest============================= 248 passed in 29.18s =============================Belief Revision & Contradiction Resolution:
test_contradiction_resolver.pyCounterfactual Guardrails:
test_counterfactual_guardrail.pySpreading Activation & Retainment:
test_synapse_retriever.py,test_synapse_storage.pyHebbian Reinforcement & Abstract Rollups:
test_hebbian_and_rollup.py,test_hebbian_outcome_feedback.pyMetacognitive Calibration:
test_metacognitive_scorer.py
Technical Design & Honest Trade-Offs
To maintain transparency and help developers choose the right tool for their architecture:
Semantic Search vs. Subword Fallback:
The default zero-dependency vectorizer uses subword CRC32 n-gram hashing. It excels at fast keyword matching, spelling variations, and offline local operations without downloading heavy packages.
For true conceptual paraphrasing and cross-lingual understanding (e.g. "How is login token handled?" matching "Autentikasi API memakai JWT"), configure an OpenAI-compatible embedding endpoint (
OPENAI_EMBEDDING_MODELvia Ollama or OpenAI) or installsentence-transformers.
Automated Belief Revision Scope:
Real-time arbitration resolves numeric attributes (ports, memory, limits), technology version updates (e.g.
PostgreSQL 14 → 16), and task lifecycle states (In Progress → Completed).Broad semantic belief revisions that require reasoning over prose are synthesized during background consolidation cycles with LLM assistance.
Performance & Target Scale:
Vector cosine similarity is computed in-memory across candidate graph nodes in Python.
This design is lightweight and optimal for personal and team agent memory graphs (<10,000 active nodes). It is not designed to replace high-scale multi-million vector databases (Milvus, Pinecone).
Multi-Project Isolation:
By default,
synapse-mcpdefaults to~/.synapse/synapse.dbso multiple assistants share context across repositories.For strictly isolated project environments, always set
SYNAPSE_DB_PATH=./data/synapse.db.
License
MIT License. See LICENSE for details.
Available Tools
4 toolssynapse_get_statsA
Get real-time statistics and node counts of the Synapse memory cortex.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden alone; 'get' plus 'statistics' implies a safe read-only, zero-side-effect call, which is helpful. It also discloses the data is real-time, but says nothing about cost, auth, or whether the snapshot is expensive to compute.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; the resource and scope arrive immediately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter diagnostic call, the description conveys enough to invoke it correctly. Since there is no output schema, it partially compensates by naming the return content (statistics and node counts), though the exact metrics returned remain unspecified.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so there is nothing for the description to disambiguate. Baseline 4 applies for a parameterless tool.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (get) and resource (real-time statistics and node counts) scoped to the Synapse memory cortex. This clearly separates it from the sibling memory operations (recall, retain, record_episode), though it never names them explicitly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is only implied: an agent can infer this is the tool for inspecting cortex health rather than reading or writing memories. There is no explicit statement of when to call it, when not to, or which sibling to prefer for adjacent needs.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
synapse_recallA
Recall memories, SOPs, and past architectural decisions from Synapse Memory Engine using hybrid semantic vector and BM25 search.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The search query, topic, concept, or technical question. | |
| budget | No | Max token budget for recalled context (default 300). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It usefully discloses the hybrid vector+BM25 retrieval mechanism and that results are bounded by a token budget, but it does not state that the operation is read-only/non-mutating, what the result structure or ranking looks like, or any permission requirements.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single dense sentence with no filler, front-loading the action and the target resources before the retrieval mechanism. Every clause carries information an agent needs.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a retrieval tool with no annotations and no output schema, the description explains what is searched and how, but leaves the return format and result characteristics (snippets, scores, ordering) unexplained. The omission is a meaningful gap for a recall tool whose output shape matters.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents both parameters thoroughly, including the token budget default. The description adds no parameter-level detail beyond what the schema provides, so the baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('Recall') and concrete resource types (memories, SOPs, past architectural decisions), plus the retrieval mechanism. This clearly distinguishes it as the read-side counterpart to synapse_retain and synapse_record_episode, though it never names the siblings explicitly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use it (retrieving prior context) but gives no explicit guidance on when to prefer it over synapse_get_stats or how it relates to the write-side siblings. Usage is inferable from the verb and resource list rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
synapse_record_episodeC
Record an episodic learning memory (Situation -> Action -> Outcome -> Lesson) so agents never repeat past mistakes.
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Short concise episode title. | |
| outcome | Yes | Final result of the action. | |
| salience | No | Impact factor (default 0.9). | |
| situation | Yes | Context or problem description. | |
| action_taken | Yes | Action executed to address or resolve it. | |
| lessons_learned | Yes | Key takeaways or rules discovered. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses that this is a persistence operation, but says nothing about whether entries are deduplicated, embedded/indexed for later recall, mutable or overwritable, or what happens when salience is changed. The 'salience' impact factor behavior is also unexplained.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; the verb and resource lead and the rationale trails. Nothing is wasted.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
A six-parameter, five-required mutation with no annotations and no output schema needs more than one sentence. Nothing tells the agent what the call returns, whether the record is immediately recallable via synapse_recall, or how salience affects later retrieval.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so all six parameters are already documented in the schema, establishing a baseline of 3. The description's 'Situation -> Action -> Outcome -> Lesson' framing only restates the parameter names in sequence and adds no format, length, or content guidance beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('Record') and a specific resource ('episodic learning memory'), plus the narrative structure (Situation -> Action -> Outcome -> Lesson). It is clearly distinguishable from synapse_recall in intent, but it never names siblings or explicitly contrasts with synapse_retain, which is the closest functional neighbor.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The clause 'so agents never repeat past mistakes' hints at motivation but gives no condition for when to call this versus synapse_retain (both are write-side tools) or when to skip recording. No prerequisites, no exclusions, no alternatives are named.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
synapse_retainB
Save an atomic fact, architectural decision, permanent directive, or SOP into Synapse Memory.
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The atomic fact, rule, or decision content to remember. | |
| category | No | Knowledge category (default 'decision'). | decision |
| salience | No | Importance score 0.0 to 1.0 (0.95+ for critical permanent invariants). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden. "Save" implies a persistent mutation, but nothing states whether writes are idempotent, whether duplicate facts are merged or duplicated, whether existing entries can be overwritten, or what identifier comes back. For a memory-write tool with zero annotation coverage, this leaves real gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; the verb leads and the accepted content types follow. It is efficient, though it stops short of the second sentence that would carry the missing usage and behavioral context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no annotations and no output schema, the description is the only place to learn how this write behaves and what it returns, and it says nothing about either. For a mutation tool in a memory system with three sibling tools, the definition is under-specified relative to its complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so content, category, and salience are already fully documented, including the enum values and the 0.95+ salience guidance. The description's type list loosely echoes the category enum but adds no syntax, formatting, or content-granularity guidance beyond the schema. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
"Save an atomic fact, architectural decision, permanent directive, or SOP" gives a specific verb and enumerates the resource types, which the opaque name "synapse_retain" does not convey on its own. It is clear what the tool does, but it never contrasts itself with the sibling synapse_record_episode, which by name plausibly also writes to the same memory store.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The enumerated content types (atomic fact, decision, directive, SOP) implicitly scope when to use this tool, and the word "atomic" hints at granularity. But there is no explicit statement of when to prefer synapse_recall, synapse_record_episode, or synapse_get_stats, and no guidance on deduplication or repeat saves.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v1.0.4- First observed
synapse_get_stats - First observed
synapse_recall - First observed
synapse_record_episode - First observed
synapse_retain
TDQS
Scored across 4 tools
The read/write split is clear: synapse_recall and synapse_get_stats are retrieval, while synapse_retain and synapse_record_episode are storage. synapse_retain and synapse_record_episode both write memories, which could be confused, but the descriptions distinguish atomic facts/SOPs from structured Situation-Action-Outcome-Lesson episodes.
All tools share the synapse_ namespace prefix and use verb-based names, giving a predictable pattern. Minor deviation: recall and retain are bare verbs while record_episode and get_stats use verb_noun form, but the set still reads consistently.
Four tools is a tight, focused surface for a memory engine, and each one has a distinct role (store fact, store episode, recall, stats). It sits at the low end of the comfortable range, with room for lifecycle operations without feeling padded.
Core workflows (store and retrieve memories, check stats) are covered, but the lifecycle is incomplete: there is no update/edit, delete/forget, or list/enumerate operation. For a persistent memory system, the inability to correct or remove outdated facts or SOPs is a notable gap.
Maintenance
Related MCP Connectors
Shared long-term memory for AI agents: save and recall context as a searchable knowledge graph.
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Persistent memory for AI agents, for code, research and everyday life. Stale facts retire.
Persistent memory for AI agents. Search and store durable facts, preferences and decisions.
Related MCP Servers
- AlicenseCqualityDmaintenanceProvides persistent memory and knowledge graph capabilities for AI assistants using local SQLite storage. Enables creating, searching, and managing entities, relationships, and observations with vector search support across conversations.715 npm15MIT
- AlicenseNot gradedqualityBmaintenanceEnables persistent, graph-based memory for AI agents, allowing them to store, traverse, and recall relationships between facts, decisions, and context across sessions for efficient reasoning and reduced token usage.MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to maintain long-term memory by logging and retrieving facts and decisions in a SQLite database, with relevance ranking and full history tracking.730 PyPIMIT
- AlicenseNot gradedqualityCmaintenanceProvides AI assistants with persistent long-term memory by organizing experiences into documents, memory atoms, and a knowledge graph, and enabling hybrid BM25/vector/graph retrieval with decay, reinforcement, and automatic recall.MIT