MindSync MCP server — local-first multi-agent memory sync and focus conflict detection
Project description
MindSync MCP
Local-first Model Context Protocol server for multi-agent memory sync and focus conflict detection.
Use it when several coding agents (Claude Code, Codex, Cursor, Gemini CLI, Grok, custom agents, …) share one developer machine and need:
- A shared session/focus registry (who is editing what)
- Conflict warnings when focuses overlap
- Optional durable fact sync to your remote host over SSH (offline queue when remote is down)
No cloud account. No hard-coded hosts or home directories.
Features
| Tool | Purpose |
|---|---|
get_sync_context |
Load local state + compiled truth (optional remote pull) |
update_focus |
Per-agent focus/project/branch (+ optional paths); conflict warnings |
queue_durable_fact |
Write fact remotely, or queue offline if unreachable / unconfigured |
sync_offline_facts |
Flush offline queue; consolidate + pull truth |
pull_truth |
Windows-safe SCP pull of compiled-truth markdown |
health |
Paths, queue depth, remote reachability |
Design principles:
- Offline-first — local tools always work; remote is opt-in and best-effort.
- Locked local state — exclusive lockfiles around state/queue writes.
- Safe remote writes — identifier allowlists + base64 text transport over SSH.
- No false-positive conflicts — same project alone is not a conflict; token/path overlap is.
- Generic by default — zero personal paths in code; configure via env.
Install
git clone https://github.com/adityarya24/mindsync-mcp.git
cd mindsync-mcp
python -m pip install -e ".[dev]"
Quick start (local only)
No env vars required. State lives under ~/.mindsync.
MCP client config
After pip install -e .:
{
"mcpServers": {
"mindsync": {
"command": "mindsync"
}
}
}
Or run the module path explicitly:
{
"mcpServers": {
"mindsync": {
"command": "python",
"args": ["-m", "mindsync.server"]
}
}
}
(Windows: use your venv’s python.exe if agents don’t see the same PATH.)
Optional remote sync
Remote features stay disabled until both are set:
export MINDSYNC_SSH_HOST=my-server # SSH config Host or user@host
export MINDSYNC_REMOTE_ROOT=/opt/mindsync # directory on that host
See .env.example for the full list and examples/remote/ for sample server-side scripts (mindsync_fact.py, mindsync_consolidate.py).
| Env var | Default | Meaning |
|---|---|---|
MINDSYNC_HOME |
~/.mindsync |
Local data root |
MINDSYNC_SSH_HOST |
(empty) | SSH host; empty disables remote |
MINDSYNC_REMOTE_ROOT |
(empty) | Remote project root; empty disables remote |
MINDSYNC_REMOTE_ENV_FILE |
config/mindsync.env |
Optional file sourced on remote before commands |
MINDSYNC_REMOTE_WRITE_SCRIPT |
tools/mindsync_fact.py |
Relative to remote root |
MINDSYNC_REMOTE_CONSOLIDATE_SCRIPT |
tools/mindsync_consolidate.py |
Relative to remote root |
MINDSYNC_REMOTE_TRUTH_SUBDIR |
compiled-truth |
Markdown summaries directory |
MINDSYNC_SSH_TIMEOUT |
3 |
SSH connect timeout (seconds) |
MINDSYNC_FOCUS_STALE_SECS |
7200 |
Ignore older focus entries |
MINDSYNC_REMOTE_CACHE_TTL |
30 |
Cache TTL for online probe |
MINDSYNC_LOCK_TIMEOUT |
5 |
Local lock wait (seconds) |
SSH must be key-based / BatchMode-friendly (no interactive password prompts).
Local data layout
Under MINDSYNC_HOME (default ~/.mindsync):
local-state.json— active project + per-agent focus maplocal-audit.jsonl— append-only action logoffline_queue.jsonl— durable facts waiting for remotecompiled-truth/*.md— pulled remote summaries.locks/— exclusive lockfiles
Agent usage pattern
- Start:
get_sync_context(agent_name)(setrefresh_remote=truewhen remote is configured). - Work:
update_focus(agent_name, project, branch, focus, paths=[...]). - Milestone:
queue_durable_fact(agent_name, entity, attribute, text). - Reconnect:
sync_offline_facts(agent_name).
Layout
mindsync-mcp/
├── mindsync/
│ ├── server.py # FastMCP tools
│ ├── storage.py # JSON/JSONL + locks
│ ├── bridge.py # optional SSH/SCP
│ ├── conflict.py # focus overlap
│ └── config.py # env-based settings
├── examples/remote/ # sample remote hooks
├── tests/
├── .env.example
└── pyproject.toml
Develop / test
python -m pip install -e ".[dev]"
python -m pytest -q
python scripts/smoke_test.py
GitHub Actions runs the same suite on every push/PR to master
(Python 3.10 + 3.12, Ubuntu + Windows).
Security & Trust Boundaries
Local Privileges & Trust Boundary
- User Permissions: MindSync runs with the privileges of the executing user. It interacts with the local filesystem and performs SSH/SCP operations under this user context.
- Client Isolation: The MCP interface is a trust boundary. MindSync is designed to be wired into trusted local agent clients only.
Untrusted Truth & Manifest Validation
- Remote Data Injection Protection: Since the compiled truth is pulled from a remote server via SCP, MindSync treats all incoming files as untrusted:
- Filename / Entity Validation: All pulled filenames must strictly match the regex pattern
^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$and cannot contain path traversal characters (..,/,\), Alternate Data Streams (colon:), or reserved Windows device names (e.g.CON,PRN,AUX,NUL,COM1..9,LPT1..9). - UTF-8 Validation: Staged truth files are parsed as UTF-8; non-UTF-8 files fail manifest validation and are rejected.
- Atomic Swapping: Truth updates are staged in a temp directory, validated, and swapped directory-wide under an exclusive lock (
truth.lock). Partial/mixed staging states are impossible, and any filesystem errors immediately abort and roll back the swap.
- Filename / Entity Validation: All pulled filenames must strictly match the regex pattern
Local Storage Isolation & Permissions Migration
- Secure File/Directory Defaults: MindSync enforces Unix directory permission
0700and file permission0600for all queue, spool, state, and audit logs. - Auto-Migration: Upon starting, MindSync scans the configured
MINDSYNC_HOMEdirectory and dynamically migrates permissions of all existing user files to0600.
Shell Injection & Error Sanitation
- Base64 Transport: Fact payloads are base64-encoded prior to transport and decoded on the remote side, avoiding raw shell interpolation of free text.
- Secret Scrubbing: Raw SSH/SCP stdout/stderr errors are sanitized before being returned to clients to prevent leaking server paths, usernames, key files, or host metadata.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mindsync_mcp-1.0.1.tar.gz.
File metadata
- Download URL: mindsync_mcp-1.0.1.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b14bdbb6b853322c817ae3cc9257c17f2218de709b791c89951dfc8041a30d1a
|
|
| MD5 |
97ab32910f403285c12364f1794b40d9
|
|
| BLAKE2b-256 |
f35e2041a5cba804e9c3f6997ecfdf84feabb50b8c65d74782b1216a6f87b7ca
|
Provenance
The following attestation bundles were made for mindsync_mcp-1.0.1.tar.gz:
Publisher:
release.yml on adityarya24/mindsync-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mindsync_mcp-1.0.1.tar.gz -
Subject digest:
b14bdbb6b853322c817ae3cc9257c17f2218de709b791c89951dfc8041a30d1a - Sigstore transparency entry: 2194930808
- Sigstore integration time:
-
Permalink:
adityarya24/mindsync-mcp@68d27c9755efcf3b778c9f45a138addd1d4e6ac4 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/adityarya24
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@68d27c9755efcf3b778c9f45a138addd1d4e6ac4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mindsync_mcp-1.0.1-py3-none-any.whl.
File metadata
- Download URL: mindsync_mcp-1.0.1-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e06433ded82086d4d30ea2e34085fc40b4d3f80ebe17c666676862a8662ca89c
|
|
| MD5 |
d7bf99cc3986fd56bf884c017e7cf619
|
|
| BLAKE2b-256 |
3d886205e993e05b83bc4ce24960ea0311be8ed24bf08ef9fdfce0ec4de41f50
|
Provenance
The following attestation bundles were made for mindsync_mcp-1.0.1-py3-none-any.whl:
Publisher:
release.yml on adityarya24/mindsync-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mindsync_mcp-1.0.1-py3-none-any.whl -
Subject digest:
e06433ded82086d4d30ea2e34085fc40b4d3f80ebe17c666676862a8662ca89c - Sigstore transparency entry: 2194930816
- Sigstore integration time:
-
Permalink:
adityarya24/mindsync-mcp@68d27c9755efcf3b778c9f45a138addd1d4e6ac4 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/adityarya24
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@68d27c9755efcf3b778c9f45a138addd1d4e6ac4 -
Trigger Event:
push
-
Statement type: