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
访问服务器

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选