Logo de cli-bridge

cli-bridge

Comunidade
anshupriyan

MCP server for Claude Desktop and other Model Context Protocol clients — sandboxed filesystem access (read/write/edit/search) plus Dev Mode-gated shell command execution, scoped to a single workspace root. Local-first, no cloud dependency, full audit logging. Built in TypeScript.

Publicado poranshupriyan
Repositóriocli-bridge
IdiomaTypeScript
Forks
2
Estrelas
14
Ferramentas disponíveis
0
Tipo de transportestdio
Categorias
LicençaMIT
Links
  • Conecte ferramentas a fluxos de trabalho de IA

    cli-bridge disponibiliza recursos MCP que podem ser usados por clientes e agentes de IA compatíveis.

  • 0 ferramentas disponíveis

    Confira abaixo as ações que podem ser chamadas, incluindo nomes e descrições quando fornecidos pelo servidor.

  • Configuração pronta para copiar

    Use os exemplos de instalação para configurar este servidor no seu cliente MCP preferido.

  • Indicadores da comunidade de código aberto

    14 estrelas e 2 forks no repositório vinculado.

cli-bridge

A local Model Context Protocol (MCP) server that gives Claude Desktop — or any MCP-compatible client — sandboxed filesystem access and gated shell command execution, scoped entirely to a single workspace root directory.


What is this?

cli-bridge is a lightweight MCP server that plugs into Claude Desktop (or any MCP client) and gives it:

  • 📂 Filesystem tools — read, write, edit, search, and grep files, all confined to one workspace root
  • 💻 Shell execution — run real commands on your machine, gated behind an explicit Dev Mode toggle
  • 📝 Project memory — an append-only journal (PROJECT_LOG.md) so an agent can pick up context across sessions
  • 🔒 Audit logging — every tool call recorded to a local log file, nothing sent anywhere else

Everything runs locally, on your machine — no external API calls, no cloud dependency, no telemetry.


⚠️ Dev Mode — Read Before Enabling Shell Execution

[!CAUTION] execute_command can run any executable available on your system, with the same permissions as the app hosting the MCP client. This is real shell execution, not a sandbox.

Default stateDev Mode is OFF every time the server starts. execute_command is blocked before anything spawns.
Turning it onRequires an explicit toggle_dev_mode({ enable_dev_mode: true }) call — nothing enables it silently.
Your responsibilityOnce enabled, any command run — including destructive ones (deleting files, modifying system state, installing software, network calls) — executes for real. There is no command allowlist, no confirmation beyond your MCP client's own approval settings, and no undo.
LiabilityThis project's author/developer is not responsible for data loss, system damage, security incidents, or any other consequence of enabling Dev Mode or using execute_command. Enabling it is a decision you make, at your own risk.

Everything else — reading, searching, editing files in the workspace — works fully with Dev Mode left off. If you're unsure, leave it off.


Features

ToolDescription
read_file(path, start_line?, end_line?)Reads UTF-8 file contents, optional line-range support
list_directory(path, recursive?)Lists directory contents (names, sizes, dir flags)
search_files(pattern, path?)Recursive glob search (e.g. *.ts, **/*.js)
grep_content(pattern, path?, case_sensitive?, max_results?)Fast fixed-string search via bundled @vscode/ripgrep, capped at max_results (default 50)
get_dev_mode_status()Reports whether shell execution is ENABLED or BLOCKED
get_recent_journal_entries(count?, project?)Reads the last N entries from PROJECT_LOG.md

All tools are strictly confined to the workspace root directory.

ToolDescription
write_file(path, content)Overwrites/creates a file, auto-creates parent directories
edit_file(path, old_str, new_str)Targeted find-and-replace; errors on zero or multiple matches
execute_command(command, args, cwd?, timeout?)Shell execution, gated by Dev Mode — see warning above
toggle_dev_mode(enable_dev_mode)Enables/re-locks shell execution for the current session only
log_journal_entry(summary, files_changed?, commit_hash?, project?)Appends a structured entry to PROJECT_LOG.md

Security Architecture

┌─────────────────────────────────────────────┐
│              MCP Client (Claude)             │
└────────────────────┬──────────────────────────┘
                      │ tool calls
┌────────────────────▼──────────────────────────┐
│                  cli-bridge                    │
│  ┌───────────────────────────────────────────┐ │
│  │ 1. Path Confinement (resolveSafePath)      │ │
│  │ 2. Symlink Resolution (fs.realpathSync)    │ │
│  │ 3. Dev Mode Gate (execute_command only)    │ │
│  │ 4. Shell Metacharacter Scan (Windows only) │ │
│  │ 5. Audit Log Write (.cli-bridge-audit.log) │ │
│  └───────────────────────────────────────────┘ │
└────────────────────┬──────────────────────────┘
                      │ confined to
              <workspaceRoot>/
  • Path Confinement — every path (including command cwd) resolves strictly relative to the workspace root; traversal attempts are rejected.
  • Symlink Protection — symlinks pointing outside the workspace boundary are resolved and blocked.
  • Dev Mode Gating — execute_command is hard-blocked at the handler entry point until explicitly toggled on.
  • No Command Allowlist — once Dev Mode is on, any executable on the host can run. See the warning above.
  • Shell Metacharacter Scanning — Windows build-tool wrappers (npm, npx, yarn, pnpm, tsc, jest, eslint, prettier) run with shell: true; arguments are scanned for & | ; $ > < ^ and blocked if found. Everything else runs with shell: false.
  • Audit Logging — every tool call is recorded as JSON in <workspaceRoot>/.cli-bridge-audit.log (timestamp, arguments truncated to 200 chars, status: success / error / blocked).

Compatibility

PlatformStatus
🪟 Windows 11 (x64)✅ Tested and verified
🍎 macOS (arm64 / x64)⚠️ Architecturally supported (pure ESM + auto-resolved ripgrep binary), not yet live-tested
🐧 Linux (x64)⚠️ Architecturally supported, not yet live-tested

Windows-specific handling (the .cmd/.bat wrapper allowlist and shell-metacharacter scan) only applies when process.platform === 'win32'. On macOS/Linux, all commands spawn directly with shell: false. If you run this on macOS or Linux, feedback/issues are welcome.


Token-Efficient Workflows

  1. Use grep_content to locate keywords/functions before reading full files.
  2. Use read_file with start_line/end_line once you have coordinates.
  3. Use edit_file for targeted changes instead of rewriting whole files.
  4. Use git diff / git log / git show via execute_command (Dev Mode required) to verify changes on disk.

Project Journal

An append-only development log at <workspaceRoot>/PROJECT_LOG.md, meant to be read by an agent at the start of a new session to recover prior context. Agents call log_journal_entry after completing work, including file lists and commit hashes.


Installation

Prerequisites: Node.js v18.17.0+ (v20 or v24 LTS recommended)

bash
npm install
npm run build

Configuration in Claude Desktop

Finding your config file (Windows)

Depending on how Claude Desktop was installed (standard installer vs. MSIX/Microsoft Store package), its configuration file location differs. You can run this PowerShell command to locate your claude_desktop_config.json automatically:

powershell
Get-ChildItem -Path "$env:APPDATA\Claude\claude_desktop_config.json", "$env:LOCALAPPDATA\Packages\Claude_*\LocalCache\Roaming\Claude\claude_desktop_config.json" -ErrorAction SilentlyContinue | Select-Object FullName

[!NOTE] If neither path returns a result, the configuration file has likely not been created yet (which happens after opening Claude Desktop for the first time) or is installed in a non-standard location.

Manual File Paths Reference

  • Windows: %APPDATA%\Claude\claude_desktop_config.json (or %LOCALAPPDATA%\Packages\Claude_...\LocalCache\Roaming\Claude\claude_desktop_config.json for Store/MSIX installs)
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Registering cli-bridge

Claude Desktop

Add cli-bridge to the mcpServers object inside your claude_desktop_config.json:

json
{
  "mcpServers": {
    "cli-bridge": {
      "command": "node",
      "args": [
        "<PATH_TO_CLI_BRIDGE>/build/index.js",
        "<PATH_TO_YOUR_WORKSPACE>"
      ],
      "env": {
        "WORKSPACE_ROOT": "<PATH_TO_YOUR_WORKSPACE>"
      }
    }
  }
}

Qwen Studio

Add cli-bridge to the mcpServers object in your Qwen Studio configuration:

json
{
  "mcpServers": {
    "cli-bridge": {
      "command": "npx",
      "args": [
        "node",
        "<PATH_TO_CLI_BRIDGE>/build/index.js",
        "<PATH_TO_YOUR_WORKSPACE>"
      ],
      "env": {
        "WORKSPACE_ROOT": "<PATH_TO_YOUR_WORKSPACE>"
      }
    }
  }
}

[!IMPORTANT] Windows Path Formatting in JSON: Because claude_desktop_config.json is a standard JSON file, single backslashes copied directly from File Explorer's address bar (e.g. C:\Projects\cli-bridge) will cause JSON parsing errors unless escaped.

You have two valid options for Windows paths:

  1. Double Backslashes: "C:\\Projects\\cli-bridge\\build\\index.js"
  2. Forward Slashes (Recommended): "C:/Projects/cli-bridge/build/index.js" (works natively in Node.js on Windows and is easier to type)
FormatExample PathStatus
❌ Single Backslash"C:\Projects\cli-bridge"Fails JSON Parsing
✅ Double Backslash"C:\\Projects\\cli-bridge"Valid JSON
✅ Forward Slash"C:/Projects/cli-bridge"Valid & Recommended
  • Replace <PATH_TO_CLI_BRIDGE> with the folder where you cloned cli-bridge.
  • Replace <PATH_TO_YOUR_WORKSPACE> with the target project workspace folder you want cli-bridge to manage.

Testing and Debugging

bash
npx @modelcontextprotocol/inspector node build/index.js <YOUR_DEFAULT_WORKSPACE_PATH>

Instalação

TypingMind
{
  "mcpServers": {
    "cli-bridge": {
      "command": "npx",
      "args": [
        "cli-bridge",
        "<YOUR_DEFAULT_WORKSPACE_PATH>"
      ]
    }
  }
}

Use o MCP de cli-bridge com vários modelos de IA

O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho. Assim, após conectar cli-bridge, é possível usá-lo com diferentes modelos de IA no TypingMind, em vez de configurá-lo separadamente para cada modelo. Este MCP é executado localmente no seu dispositivo por meio do conector MCP do TypingMind.

Guia de configuração para usar o conector local

Use esta opção quando o servidor MCP precisar acessar arquivos locais, aplicativos ou recursos privados no seu computador.

1

Abra as configurações de MCP

No TypingMind, vá até Configurações, Configurações avançadas e depois Model Context Protocol e selecione Configurar conector.

  1. Abra o TypingMind no navegador.
  2. Clique no ícone de Ajustes.
  3. Acesse Configurações avançadas.
  4. Abra a seção Model Context Protocol.
  5. Clique em Configurar conector e selecione Este dispositivo.
Tela de configuração do conector MCP do TypingMind com a opção Este dispositivo selecionada
2

Execute o comando do conector

Selecione Este dispositivo, copie o comando do TypingMind e execute-o no Terminal. Mantenha o processo em execução enquanto usa o MCP.

  1. Copie o comando de configuração exibido pelo TypingMind.
  2. Abra o Terminal no macOS ou o Windows Terminal no Windows.
  3. Cole e execute o comando.
  4. Autorize a instalação do pacote se o Terminal pedir confirmação para continuar.
  5. Mantenha o processo em execução na janela do Terminal enquanto usa as ferramentas MCP.
3

Adicione cli-bridge como servidor

Quando o status do conector for Pronto, clique em Editar e cole a configuração do servidor MCP.

  1. Aguarde até que o status do conector mostre Pronto.
  2. Clique em Editar.
  3. Cole a configuração do servidor MCP de cli-bridge.
  4. Salve a lista de servidores.
  5. Atualize para confirmar se o conector ainda está pronto para uso.
Configurações de MCP do TypingMind mostrando um servidor ativo e o botão Editar
{
  "mcpServers": {
    "cli-bridge": {
      "command": "npx",
      "args": [
        "-y",
        "cli-bridge"
      ]
    }
  }
}
4

Use a conexão com diferentes modelos

Salve a lista de servidores, abra Plugins, ative as ferramentas MCP de cli-bridge, selecione qualquer modelo de IA compatível no TypingMind e use as ferramentas no chat ou atribua-as a um agente de IA.

  1. Abra a página Plugins no TypingMind.
  2. Ative as ferramentas MCP de cli-bridge.
  3. Inicie um chat e escolha o modelo de IA que deseja usar.
  4. Use as ferramentas MCP no chat ou atribua-as a um agente de IA.
  5. Mude para outro modelo de IA sempre que necessário, sem reconectar o MCP.
Chat do TypingMind usando ferramentas MCP ativadas com um modelo de IA selecionado
Pode usar cli-bridge para me ajudar nesta tarefa?
cli-bridge
Claro. Já li.
Veja o que encontrei usando cli-bridge.

Perguntas frequentes

Para que serve o servidor MCP cli-bridge?

cli-bridge é um servidor MCP que permite que aplicativos de IA compatíveis se conectem a ferramentas externas e informações de contexto. No TypingMind, basta adicionar esse servidor MCP uma vez para disponibilizar suas ferramentas no seu espaço de trabalho com IA.

Posso usar o MCP cli-bridge com vários modelos de IA no TypingMind?

Sim. O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho, permitindo usar cli-bridge com diferentes modelos de IA, como Claude, ChatGPT, Gemini ou outros modelos configurados no TypingMind, sem configurar o servidor MCP separadamente para cada modelo.

Por que usar o MCP cli-bridge com o TypingMind?

O TypingMind é uma das melhores interfaces de chat com LLMs porque reúne vários modelos de IA, prompts, plugins, agentes de IA, chaves de API e ferramentas MCP em um só espaço de trabalho. Com cli-bridge conectado, é possível usar suas ferramentas MCP nos seus modelos preferidos e manter seu fluxo de trabalho de chat organizado no TypingMind.

Como conecto o MCP cli-bridge ao TypingMind?

cli-bridge funciona por meio do conector MCP local do TypingMind. Essa é a melhor opção quando o servidor MCP precisa acessar arquivos locais, apps de desktop, ferramentas de linha de comando ou recursos privados no seu computador.

Quais ferramentas o MCP cli-bridge oferece no TypingMind?

cli-bridge disponibiliza recursos MCP que podem ser ativados na página Plugins do TypingMind e usados no chat ou atribuídos a agentes de IA.

Preciso compartilhar minhas chaves de API com o TypingMind para usar o MCP cli-bridge?

Não. O TypingMind prioriza o uso local e permite manter seus provedores de modelos, chaves de API, prompts e configuração MCP sob seu controle. Se cli-bridge exigir autenticação, adicione os cabeçalhos, as configurações OAuth ou a configuração local exigidos por esse servidor MCP ao criar a conexão.

Servidores MCP relacionados

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇