SyncContext

SyncContext

MCP server that provides a shared semantic memory layer for AI coding agents, enabling teams to store, search, and sync context, decisions, and knowledge across projects with project-based isolation and multi-backend support.

Category
访问服务器

README

SyncContext

Shared team memory for AI coding agents. Sync context, decisions, and knowledge across your entire team via the Model Context Protocol.

License: MIT Python 3.12+ MCP Docker


The Problem

AI coding agents (Claude Code, Cursor, Windsurf) each maintain isolated context. Developer A's agent knows nothing about Developer B's decisions. This leads to:

  • Conflicting architecture decisions across team members
  • Repeated mistakes and lost institutional knowledge
  • Painful onboarding for new developers
  • No shared understanding between frontend, backend, and infra

The Solution

SyncContext provides a shared semantic memory layer that connects your team's AI agents. One token per project, shared brain, unlimited team members.

Developer A (Frontend) --> saves: "Button uses Tailwind, prop X is required"
Developer B (Backend)  --> searches: "frontend patterns" --> gets full context
Developer C (New hire) --> runs: get_project_context --> instant onboarding

How It Works

  1. Your team deploys SyncContext (self-hosted or cloud)
  2. Each developer adds the server URL + their project token to their MCP client
  3. On first connection, the project is auto-created in the database
  4. AI agents read and write shared memories scoped to the project
MCP Client (Claude Code, Cursor)
    │
    │  Authorization: Bearer <project-token>
    │  X-Project-Name: "My Project"
    │
    ▼
SyncContext Server (HTTPS)
    │
    ├── New token? → Auto-create project in DB
    ├── Known token? → Load existing project
    │
    ▼
PostgreSQL + pgvector (semantic search)

Quick Start

Option 1: Connect to a hosted instance

Add to your .mcp.json (Claude Code) or MCP settings (Cursor):

{
  "mcpServers": {
    "synccontext": {
      "url": "https://your-synccontext-server.com/mcp",
      "headers": {
        "Authorization": "Bearer your-project-token",
        "X-Project-Name": "My Project"
      }
    }
  }
}

That's it. The project is auto-created on first connection.

Option 2: Self-hosted with Docker

git clone https://github.com/infinity-ai-dev/SyncContext.git
cd SyncContext
cp .env.example .env
# Edit .env: set SYNCCONTEXT_GEMINI_API_KEY

docker compose up -d

Option 3: Local development (stdio)

# Requires PostgreSQL with pgvector
uv sync
uv run synccontext

MCP Client Configuration

Cloud / HTTP mode (recommended)

Works with any MCP client that supports HTTP transport:

{
  "mcpServers": {
    "synccontext": {
      "url": "https://your-server.com/mcp",
      "headers": {
        "Authorization": "Bearer your-project-token",
        "X-Project-Name": "My Project"
      }
    }
  }
}

Local / stdio mode

For local development with a direct database connection:

{
  "mcpServers": {
    "synccontext": {
      "command": "uv",
      "args": ["--directory", "/path/to/SyncContext", "run", "synccontext"],
      "env": {
        "SYNCCONTEXT_PROJECT_TOKEN": "my-team-token",
        "SYNCCONTEXT_DATABASE_URL": "postgresql://user:pass@localhost:5432/synccontext",
        "SYNCCONTEXT_GEMINI_API_KEY": "your-key"
      }
    }
  }
}

Tools (14 total)

Memory Management

Tool Description
save_memory Store decisions, patterns, bugs, conventions with metadata
get_memory Retrieve a specific memory by UUID
update_memory Update content (auto re-embeds if changed)
delete_memory Remove a specific memory
bulk_save_memories Import multiple memories at once

Search & Discovery

Tool Description
search_memories Semantic search across all team knowledge
search_by_file Find context about specific files
find_similar Discover related memories by similarity
list_memories Browse recent memories with filters

Project Overview

Tool Description
get_project_context Full project summary (onboarding)
list_tags All knowledge categories with counts
list_contributors Who's contributing knowledge

Admin

Tool Description
create_project Create a new project (admin token required)
list_projects List all registered projects (admin token required)

Architecture

┌─────────────────────────────────────┐
│  Claude Code / Cursor / Windsurf    │
│           (MCP Client)              │
└──────────┬──────────────────────────┘
           │ HTTPS + Bearer Token
┌──────────▼──────────────────────────┐
│     SyncContext MCP Server          │
│  ┌────────────┐  ┌───────────────┐  │
│  │ Auth       │  │ Per-request   │  │
│  │ Middleware │──│ Project Scope │  │
│  └────────────┘  └───────────────┘  │
│  ┌────────────┐  ┌───────────────┐  │
│  │ Embedding  │  │ Memory +      │  │
│  │ Provider   │  │ Search Service│  │
│  └────────────┘  └───────────────┘  │
└──────────┬──────────────────────────┘
           │
┌──────────▼──────────────────────────┐
│  PostgreSQL + pgvector              │
│  ┌──────────┐  ┌──────────────────┐ │
│  │ projects │  │ memories +       │ │
│  │ (tokens) │──│ memory_vectors   │ │
│  └──────────┘  └──────────────────┘ │
└─────────────────────────────────────┘

Multi-Project Isolation

Each project token maps to an isolated namespace. Multiple teams share the same server with full data isolation:

Token A ("sc_frontend...")  → Project "Frontend App"  → memories scoped to frontend
Token B ("sc_backend...")   → Project "Backend API"   → memories scoped to backend
Token C ("sc_infra...")     → Project "Infrastructure" → memories scoped to infra

Embedding Providers (auto-detected)

Provider Dimensions Cost Offline Detected by
Gemini 768 Free (1500 req/min) No GEMINI_API_KEY set
OpenAI 1536 $0.02/1M tokens No OPENAI_API_KEY set
Ollama 768 Free Yes OLLAMA_BASE_URL set

Vector Store Backends

Backend Best For Persistence
pgvector (default) Relational queries + vectors Disk (durable)
Redis Stack Sub-ms latency AOF + volume (durable)

Configuration

All settings via environment variables (prefix SYNCCONTEXT_):

Variable Default Description
PROJECT_TOKEN — Default project token (stdio mode)
ADMIN_TOKEN — Admin token for create/list projects
DATABASE_URL postgresql://... PostgreSQL connection string
VECTOR_STORE pgvector pgvector or redis
EMBEDDING_PROVIDER auto auto, gemini, openai, or ollama
GEMINI_API_KEY — Gemini API key
OPENAI_API_KEY — OpenAI API key
OLLAMA_BASE_URL — Ollama server URL
TRANSPORT stdio stdio, sse, or streamable-http
HOST 0.0.0.0 HTTP bind address
PORT 8080 HTTP port

Self-Hosted Deployment (Docker Swarm)

Prerequisites

  • Docker Swarm with Traefik
  • PostgreSQL with pgvector extension
  • A domain pointing to your server

1. Prepare the database

# Install pgvector
docker exec $(docker ps -q -f name=postgres) bash -c \
  "apt-get update && apt-get install -y postgresql-16-pgvector"

# Create database + extensions
docker exec $(docker ps -q -f name=postgres) psql -U postgres -c "CREATE DATABASE synccontext"
docker exec $(docker ps -q -f name=postgres) psql -U postgres -d synccontext -c \
  'CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE EXTENSION IF NOT EXISTS "vector";'

2. Deploy the stack

See deploy/swarm-stack.yml for a complete Portainer-ready stack with Traefik integration.

3. Tables are created automatically

On first startup, the container runs migrations and creates all tables. Check logs to confirm.


Development

uv sync --extra dev
uv run pytest tests/ -v     # 53 tests
uv run ruff check core/ server/
uv run synccontext           # run locally (stdio)

Docker Images

Multi-arch images for linux/amd64 and linux/arm64:

docker pull infinitytools/synccontext:latest

Roadmap

  • [x] 14 MCP tools (CRUD, search, bulk, admin)
  • [x] pgvector + Redis backends
  • [x] Gemini / OpenAI / Ollama embeddings (auto-detected)
  • [x] Docker multi-arch builds (amd64 + arm64)
  • [x] Multi-project with per-request auth
  • [x] Auto-create projects from Bearer token
  • [x] Auto-migrations on container startup
  • [ ] SyncContext Cloud (managed SaaS)
  • [ ] Web dashboard for memory management
  • [ ] Webhook notifications on memory changes
  • [ ] Memory expiration / archival policies
  • [ ] RAG integration (index entire codebases)

License

MIT — see LICENSE for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选