
ContextBridge
io.github.ThunderEagle由 GitHub 帳號 ThunderEagle 發布v1.0.2更新於 Oct 24, 2026
MCP memory server for AI coding assistants. Windows Service, ONNX embeddings, SQLite vector search.
概覽
僅限 Windows 的 MCP 記憶伺服器,為 AI 程式助理提供可共用、可持久化並支援語意搜尋的記憶儲存。
- 可以做什麼
- ContextBridge 以背景 Windows 服務形式執行,多個 AI 用戶端可透過本機 HTTP 或 stdio 連線。它提供寫入、批次寫入、搜尋、列出、更新與刪除記憶的工具,以及用來儲存與接續暫時性工作階段狀態的交接工具。記憶在行程內以 ONNX 模型產生嵌入,並存放在具向量搜尋的單一 SQLite 資料庫中,讓上下文可跨工作階段與跨工具累積。
- 適用情境
- 當你希望程式助理在工作階段之間記住決策、偏好與專案上下文,或在 Claude Code、Claude Desktop、Cline、VS Code Chat Agents 等多個用戶端之間共用同一份記憶儲存時使用。它適合偏好自包含本機服務、而非外部資料庫或嵌入 API 的 Windows 使用者。
- 執行需求
- Windows 10 或 11,並需要系統管理員 PowerShell 來安裝或解除安裝 Windows 服務。可透過 .NET 10 SDK 全域工具或預先建置的可執行檔安裝。首次設定時會下載嵌入模型(約 22 MB)。未宣告需要帳戶、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 ContextBridge,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
ContextBridge
A zero-dependency MCP memory server for Windows that gives AI coding assistants a shared, persistent memory layer with semantic search.
What is ContextBridge?
AI coding assistants like Claude Code are stateless—each session starts fresh, with no persistent memory of your prior context, decisions, or discoveries. ContextBridge solves this by running as a background Windows Service that all your AI tools connect to. It stores memories persistently, searchable by meaning (not keywords), so context accumulates across sessions and across different tools simultaneously.
Why ContextBridge?
- Zero external dependencies — No Docker, Postgres, Python, or Ollama. Everything runs in one Windows Service process.
- In-process embeddings — Embedding model (all-MiniLM-L6-v2, ~22 MB) runs via ONNX Runtime; no external API calls.
- Single-file storage — SQLite database at
%ProgramData%\ContextBridge\memories.db. Backup is one file copy. - Shared across tools — Claude Code (HTTP), Claude Desktop (stdio), Cline, VS Code Chat Agents all connect to the same memory store in real-time.
- Memory survives service restarts — Memories persist in SQLite; the embedding model loads once on startup and stays warm.
Requirements
- Windows 10 / Windows 11 (required for Windows Service integration)
- Option A: .NET 10 SDK (if installing via
dotnet tool) - Option B: Windows 10+ (no additional prerequisites if downloading a pre-built .exe)
- Admin PowerShell (required to install/uninstall the Windows Service)
Quick Start
Option A: Install via dotnet global tool
If you have the .NET 10 SDK installed:
This places a context-bridge executable on your system PATH.
Option B: Direct download
Download a pre-built executable from GitHub Releases (no SDK required; one-time SmartScreen warning). Add the .exe to your PATH or invoke it directly.
First-run setup
Run these two commands in admin PowerShell (right-click → "Run as Administrator"):
What happens:
service installdownloads the embedding model (~22 MB), registers the Windows Service, sets it to auto-start on boot, and starts it immediately.configureauto-detects installed clients (Claude Code, Claude Desktop, Cline, VS Code Chat) and wires them up to connect to the service.
The service now runs in the background. Your AI tools will see the memory store the next time you restart them.
Verify the service is running:
Expected output: Status = Running
Supported Clients
All clients share the same SQLite database via concurrent connections; memories written by one tool are immediately visible to others.
MCP Tools
ContextBridge exposes seven MCP tools for your AI assistants to use:
Tag conventions (optional; assigned by the AI tool):
project:<repo-name>— scope memories to a projecttype:decision— architectural or technology choicestype:preference— coding style, tooling, workflow preferencestype:pattern— recurring patterns or conventionstype:reference— pointers to external resources or documentation
Handoff — Resuming Sessions
Memories are permanent facts. A handoff is something different: ephemeral session state that lets you resume where you left off in a future session, without reloading conversation history.
How it works
At the end of a session, ask your AI assistant to save its state:
"Save a handoff for project context-bridge with what we were working on."
The model calls handoff_write with a summary of current work — decisions made, next steps, open questions — scoped to the project.
At the start of the next session, the model calls handoff_list automatically (via server instructions) and incorporates any prior handoff as its opening context. It then calls handoff_acknowledge to remove the handoff once processed.
Handoff tools
Key parameters for handoff_write:
content— the session summary (free-form text)project— project identifier, e.g.context-bridge(optional but recommended)ttl_days— how many days to keep the handoff before auto-expiry (default: 7)
Handoffs vs. memories
Do not convert handoff content to memories automatically. Memories are for facts that will remain true indefinitely. If something from a resumed session rises to that level, write it via memory_write separately.
Explicit resumption
If your MCP client supports the prompts capability (e.g. Claude Code), you can trigger a session resumption explicitly:
This invokes the resume-session named prompt, which tells the model to look up any handoff for the specified project and incorporate it.
Expiry and reliability
Handoffs expire after ttl_days and are purged on service startup. If a session crashes before handoff_acknowledge is called, the handoff survives until its TTL — it will surface again in the next session's handoff_list call.
Importing Existing Context
If you've been using Claude Code's built-in file-based memory (~/.claude/projects/<name>/memory/), you can migrate that context into ContextBridge without any special tooling. Just ask:
"Check your memory files and add any relevant entries to context-bridge using
memory_batch_write."
Claude Code reads its own memory index, iterates the entries, and calls memory_batch_write to store them in ContextBridge — where they become semantically searchable and visible to all connected clients immediately.
You can scope the request: "import only entries tagged project:my-repo" or "add everything in your memory files."
Once imported, you can remove the original file-based entries to avoid maintaining two stores. ContextBridge becomes the single source of truth, shared across Claude Code, Claude Desktop, and any other connected client.
CLI Reference
All functionality is controlled via the context-bridge command. Run from any command-line (admin PowerShell required for service install/uninstall/config set).
Service Management
Model Management
Configuration
Configuration is stored in %ProgramData%\ContextBridge\appsettings.json. Changes take effect on next service start.
Client Configuration
This command:
- Detects installed AI clients (Claude Code, Claude Desktop, Cline, VS Code)
- Writes MCP server configuration for each client
- For Claude Code: injects usage guidelines into
~/.claude/CLAUDE.md - Prints which clients were configured
Example output:
Run this again after:
- Installing a new AI client
- Changing the service port (
config set port) - Updating ContextBridge itself
Security
Security model: Kestrel binds exclusively to 127.0.0.1 (localhost only). No authentication, no TLS.
Design rationale: The localhost bind is the security perimeter. A process with enough privilege to intercept traffic on 127.0.0.1 already has broad machine access regardless of additional authentication.
Sensitive data: Treat %ProgramData%\ContextBridge\memories.db as sensitive — it contains plaintext memory content. Any credentials or API keys stored in memories should be considered readable by local processes. Keep backups secure accordingly.
Build from Source
For developers who want to modify, test, or run ContextBridge locally.
Prerequisites
- .NET 10 SDK — provides
dotnetCLI and runtime - Windows 10 / Windows 11
- Admin PowerShell — required to install as a Windows Service
- Git
Clone and Build
Build time: 30–60 seconds on first run; subsequent builds are faster. Warnings are treated as errors per project policy.
Run Tests
This executes all xUnit integration tests (~2–5 minutes):
- Vector search accuracy validation
- Memory persistence across restarts
- All MCP tool implementations
- Schema migrations
- SQLite + sqlite-vec integration
Tests use real temp-file SQLite databases (not in-memory) because sqlite-vec requires file-backed connections.
Run Locally (Console Mode)
To test the service without installing as a Windows Service:
This starts the HTTP MCP server in the foreground:
- Binding:
http://127.0.0.1:5290(localhost only) - Storage:
%LOCALAPPDATA%\ContextBridge\memories.db(user temp directory) - Logging: Console output shows startup, request traces, and errors
The service runs until you press Ctrl+C. Expected startup time: 5–10 seconds (ONNX model loads and JIT-compiles on first run; subsequent starts are faster).
Install as a Windows Service (from source)
Publish the project, then install from the published binary:
Important: Run in admin PowerShell. This registers ContextBridge as a Windows Service with auto-start enabled, identical to the released executable.
Publishing to a separate directory avoids file-locking issues if you rebuild the project while the service is running.
Uninstall:
Roadmap
v1 (current) — Windows Service, in-process embeddings (all-MiniLM-L6-v2), SQLite vector storage, Claude Code + Claude Desktop support.
v2 — Third-party editor support (Cursor, Windsurf), web dashboard, configurable embedding providers.
v3 — Cross-platform support (macOS, Linux), expanded client ecosystem.
Technology Stack
For contributors and those interested in architectural details.
No external dependencies: Core domain logic depends only on C# standard library. Infrastructure and CLI add Microsoft packages and MCP SDK.
Full design rationale: see docs/DESIGN.md and docs/adr/ (Architectural Decision Records).
來源:README.md,提交 bcd280c
工具
0版本歷史
1- v1.0.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分