editor-mcp

editor-mcp

A secure, isolated MCP server providing full code editor functionality for AI pair programming, with Docker-based command execution and Cloudflare Tunnel remote access.

Category
Visit Server

README

Editor MCP — Model Context Protocol Code Agent

A secure, isolated, and feature-complete Model Context Protocol (MCP) server providing full code editor functionality (read_file, write_file, list_dir, search_files, set_workspace, run_command, git_status, git_diff).

Designed to run inside Docker and be exposed securely via Cloudflare Tunnel for remote AI pair programming from any MCP-compatible LLM client (fully tested and verified working with Claude Desktop, Claude Online, and Google Gemini).


🏗 Architecture & Security Model

[LLM Client / Connector]
           │
           ▼  HTTPS (Streamable HTTP + Bearer Token Auth)
  [Cloudflare Tunnel]
           │
           ▼
 [MCP Server Container]  ──(bind mount)──► Host Workspace Files
           │
           ▼  (Docker Socket / API)
[Workspace Container]   ◄── Isolated CLI execution (`run_command`)

Key Security & Capability Features

  • Path Traversal Guard: All file operations validate resolved paths against designated WORKSPACE_ROOT whitelist. Symlinks pointing outside the workspace root are automatically blocked.
  • Isolated & Flexible CLI Execution: run_command executes arbitrary, complex shell commands (chaining &&, ||, pipes |, redirects) inside a dedicated sibling Docker container (mcp-workspace:latest).
  • Rich Developer Toolset: The workspace container includes bash, git, node, npm, python3, pip, curl, wget, jq, ripgrep, build-base (gcc/g++/make), tar, zip, unzip, and openssh-client.
  • Custom Environment Variables: run_command supports passing dynamic key-value environment variables per execution.
  • Audit Logging: Every tool call is logged with timestamps to logs/audit.log.
  • Bearer Token Auth & OAuth 2.0: Mandated Bearer token authentication on all HTTP/SSE MCP endpoints. Includes built-in standard OAuth 2.0 endpoints for seamless integration with Google Gemini and other strict OAuth clients.

🛠 Quick Start

1. Requirements

  • Node.js 20+
  • Docker & Docker Compose

2. Environment Setup

Copy the sample environment file and adjust your settings:

cp .env.example .env

Key environment variables in .env:

  • PORT: Server HTTP port (default 3000)
  • AUTH_TOKEN: Static Bearer token required for clients
  • WORKSPACE_ROOT: Directory path on host storing target projects (default ./workspaces)
  • DEFAULT_WORKSPACE: Subfolder name inside WORKSPACE_ROOT (default default)
  • WORKSPACE_IMAGE: Docker image name for execution container (default mcp-workspace:latest)
  • TUNNEL_TOKEN: Cloudflare Tunnel token

3. Local Development & Testing

Build TypeScript source files:

npm run build

Run test suites:

# Security & path traversal tests
node dist/runner-fs.js

# Full End-to-End HTTP & Auth verification
node dist/runner-e2e.js

4. Docker Compose Deployment

Build all images and run the MCP server and Cloudflare Tunnel:

# Build both server and workspace execution images
docker compose --profile tools build

# Start MCP server and cloudflared tunnel
docker compose up -d

📖 Cloudflare Tunnel Setup Guide: For detailed step-by-step instructions on creating a tunnel in Cloudflare Zero Trust, obtaining TUNNEL_TOKEN, and configuring public domain routing, see [docs/CLOUDFLARE_TUNNEL_SETUP.md](file:///mnt/data/REPO/editor-mcp/docs/CLOUDFLARE_TUNNEL_SETUP.md).


🧰 Detailed MCP Tools Specification

Tool Name Description Parameters
ping Health check and sanity test tool message (string, optional)
set_workspace Set or switch the active workspace subfolder path (string, required) — relative path within workspace root
read_file Read content of a file within active workspace (up to 5MB limit) filePath (string, required)
write_file Write, overwrite, or append content to a file filePath (string), content (string), mode (enum: create | overwrite | append, default: overwrite)
replace_file_content Precision in-place string replacement within a file filePath (string), targetContent (string), replacementContent (string)
list_dir List files and subdirectories in a directory dirPath (string, optional, default: .)
get_file_tree Visual directory tree structure visualization dirPath (string, optional), maxDepth (number, optional)
search_files Search for text/patterns across workspace files using recursive grep query (string, required), subDir (string, optional, default: .)
ripgrep_search High-speed regex or literal pattern search via ripgrep query (string), isRegex (boolean), caseInsensitive (boolean), subDir (string)
run_command Execute arbitrary CLI shell commands inside isolated workspace container command (string, required), workingDir (string, optional, default: .), env (object/map, optional), timeoutMs (number, optional, default: 60000)
git_status Get git repository status of active workspace None
git_diff Get uncommitted or staged git changes staged (boolean, optional, default: false)
get_environment_info Inspect container tool versions (node, npm, python, git, ripgrep, gcc) None
fetch_url Fetch and extract readable text/JSON from web URLs url (string), maxBytes (number, optional)
web_search Search web queries and return top titles, URLs, and snippets query (string)

📑 Governance & Guidelines

For LLM agent operational guidelines and behavioral rules, see [AGENT.md](file:///mnt/data/REPO/editor-mcp/AGENT.md).


📜 License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured