
Ghostlink
io.github.bgorzelic由 GitHub 帳號 bgorzelic 發布v0.1.0更新於 Oct 24, 2026
Sandboxed repo access for coding agents: search, read, patch, run, git -- confined to a repo root.
概覽
在本機執行的沙箱式 MCP 伺服器,讓編碼助理在單一儲存庫根目錄內搜尋、讀取、套用修補、執行白名單指令並檢視 git 狀態。
- 可以做什麼
- 以正規表達式與 glob 篩選搜尋程式碼,並在大小上限與二進位偵測下讀取檔案
- 以 dry-run、沙箱驗證與原子回滾方式套用統一 diff 修補
- 執行固定指令集(test、lint、typecheck、build、smoke),參數受白名單限制並具逾時控制
- 檢視 git 狀態(分支、領先/落後)以及已暫存或未暫存的 diff
- 每次呼叫回傳結構固定的 JSON 信封並附來源資訊,同時寫入一筆 JSONL 稽核記錄
- 適用情境
- 當助理需要在本地 git 儲存庫上工作、但不應取得原始 shell 權限時使用:適合編碼代理的搜尋、讀取、套用修補、驗證循環,且操作被限制在單一儲存庫根目錄內、輸出有上限。
- 執行需求
- 透過 npm 套件(npx)或建置後的原始碼以 STDIO 在本機執行。需要 Node.js 18+、已安裝 ripgrep,以及一個 git 儲存庫。必須設定環境變數 GHOSTLINK_REPO_ROOT,值為儲存庫的絕對路徑。GHOSTLINK_LOG 為選用,用來選擇稽核記錄方式(stdout、file 或 off)。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Ghostlink,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
GhostLink
A security-hardened MCP server that gives AI coding agents safe, deterministic access to local repositories.
[CI] [npm] [TypeScript] [Node] [Tests] [License: ISC]
Add it to any MCP client that supports STDIO. For Claude Code, create .mcp.json in the target repo root:
Then run claude in that directory — six repo tools appear, all confined to GHOSTLINK_REPO_ROOT. Every tool call returns the same deterministic ToolEnvelope:
On error, "error": { "code": "...", "message": "..." } replaces "data". Full tool schemas: docs/TOOLS.md.
Tools
What is GhostLink?
GhostLink is a local-first Model Context Protocol server that exposes your codebase to AI coding agents through a small set of policy-gated tools. It solves a specific problem: AI agents need to search, read, patch, and verify code, but giving them raw shell access is a liability. GhostLink provides a sandboxed capability plane where every tool call is confined to a single repository root, every output follows a deterministic JSON shape, and every invocation is audit-logged.
Why GhostLink?
Architecture
GhostLink is a three-layer stack designed for extensibility without core changes:
The createServer() factory knows nothing about transport. Adding HTTP/SSE in Phase 2 means writing a new transport binding and auth middleware -- the server factory and all tool implementations remain unchanged. Phase 3 (agent runtime) adds memory resources and orchestration as consumers of GhostLink, not modifications to it.
Quick Start
Prerequisites
- Node.js 18+
- ripgrep (
brew install ripgrep) - A git repository to expose
Install
From npm:
Or from source:
Smoke Test (Raw STDIO)
GhostLink speaks JSON-RPC 2.0 over STDIO. Test it directly:
This returns all 6 tools and their schemas.
Client Configuration
GhostLink works with any MCP client that supports STDIO transport. The npx snippet at the top of this page works everywhere; a source checkout uses node with the built entry point instead:
The transport is always STDIO. Ready-to-use .mcp.json and CLAUDE.md templates for target projects live in templates/.
Security Model
GhostLink enforces defense-in-depth at every layer:
- Repo-root sandbox -- All file operations confined to
GHOSTLINK_REPO_ROOT. Path traversal, symlink escape, null bytes, and absolute paths outside the root are all rejected before any filesystem access. - No shell execution --
repo.runusesspawnwithshell: false. Commands are limited to a fixed allowlist (test, lint, typecheck, build, smoke) with per-command argument allowlists. Environment is stripped to six safe variables. - Output caps -- Every tool that returns bulk data enforces hard maximums (200 search results, 10MB file reads, 200KB stdout/stderr, 2MB diffs). Truncation is flagged, never silent.
- Atomic patch rollback --
repo.apply_patchvalidates all paths and computes all patches before writing anything. If any write fails, completed writes are rolled back to their original state. - Timeout enforcement --
repo.runkills processes at configurable timeouts (default 120s, hard cap 300s) with SIGTERM then SIGKILL.
Full threat model and mitigations: docs/SECURITY.md.
Audit Logging
Every tool call produces a JSONL audit entry: {ts, tool, ok, duration_ms, error_code?, repo_root}.
Set via environment variable:
Prompt Templates
docs/PROMPTS.md contains ready-to-use prompts for high-autonomy agent operation, including orchestrator prompts, sub-agent role definitions (Protocol Engineer, Toolsmith, Security Reviewer, Test Engineer, Docs Engineer), and multi-instance coordination patterns.
Development
Full verification after edits:
Documentation
Roadmap
Phase 1 -- Local STDIO [Shipped, v0.1.0]
Deterministic tool surface, repo-root sandbox, curated command execution, 108 tests, JSONL audit logging, npm package published.
Phase 2 -- Remote Transport [Planned]
HTTP/SSE transport, OAuth 2.1 authentication, multi-user tenant separation, per-tenant rate limiting, schema versioning, structured audit logging with correlation IDs.
Phase 3 -- Agent Runtime [Future]
Persistent memory resources exposed via MCP, optional policy-gated memory write tools, orchestration layer (external to GhostLink), evaluation loops, sub-agent coordination framework.
License
ISC
來源:README.md,提交 9f40c5f
工具
0版本歷史
1- v0.1.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分