# GhostLink MCP server

> Provides AI coding agents with sandboxed, policy-gated access to local repositories for searching, reading, patching, and running curated commands.

- Repository: https://github.com/bgorzelic/ghostlink
- Page: https://hostedmcp.org/servers/bgorzelic/ghostlink
- Transport: stdio
- Stars: 0
- License: ISC
- Latest version: 0.1.0

## Install

### Claude Code

```sh
claude mcp add --env 'GHOSTLINK_REPO_ROOT=<GHOSTLINK_REPO_ROOT>' ghostlink -- npx -y @bgorzelic/ghostlink
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "ghostlink": {
      "command": "npx",
      "args": [
        "-y",
        "@bgorzelic/ghostlink"
      ],
      "env": {
        "GHOSTLINK_REPO_ROOT": "<GHOSTLINK_REPO_ROOT>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "ghostlink": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@bgorzelic/ghostlink"
      ],
      "env": {
        "GHOSTLINK_REPO_ROOT": "<GHOSTLINK_REPO_ROOT>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"ghostlink","type":"stdio","command":"npx","args":["-y","@bgorzelic/ghostlink"],"env":{"GHOSTLINK_REPO_ROOT":"<GHOSTLINK_REPO_ROOT>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "ghostlink": {
      "command": "npx",
      "args": [
        "-y",
        "@bgorzelic/ghostlink"
      ],
      "env": {
        "GHOSTLINK_REPO_ROOT": "<GHOSTLINK_REPO_ROOT>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add ghostlink --env 'GHOSTLINK_REPO_ROOT=<GHOSTLINK_REPO_ROOT>' -- npx -y @bgorzelic/ghostlink
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.ghostlink]
command = "npx"
args = ["-y", "@bgorzelic/ghostlink"]

[mcp_servers.ghostlink.env]
GHOSTLINK_REPO_ROOT = "<GHOSTLINK_REPO_ROOT>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'GHOSTLINK_REPO_ROOT=<GHOSTLINK_REPO_ROOT>' ghostlink npx -- -y @bgorzelic/ghostlink
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "ghostlink": {
      "command": "npx",
      "args": [
        "-y",
        "@bgorzelic/ghostlink"
      ],
      "env": {
        "GHOSTLINK_REPO_ROOT": "<GHOSTLINK_REPO_ROOT>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `GHOSTLINK_REPO_ROOT` | yes | no | Absolute path to the repository the server is confined to. Every tool call is sandboxed beneath this path. |
| `GHOSTLINK_LOG` | no | no | Optional path for the JSON audit log of tool calls. Omit to disable file logging. |

## FAQ

### How do I configure GhostLink for Claude Code?

Create a .mcp.json file in your target repository root containing the ghostlink command and the GHOSTLINK_REPO_ROOT environment variable.

### Is it safe to give an AI agent access to my files with GhostLink?

Yes, it uses a repo-root sandbox that rejects path traversal and symlink escapes, and it prevents arbitrary shell execution by using an allowlist of commands.

### What happens if a file patch fails?

The server performs an atomic rollback to return the files to their original state if any part of the write operation fails.

### Can I see a log of what the AI agent has done?

Yes, every tool call produces a JSONL audit entry that can be sent to stdout or a file.
