claude-terminal-mcp
Terminal — 适用于 Linux 的 Claude Desktop 扩展
一个 Claude Desktop 扩展,为您的本地 Linux 机器上的 Claude 提供终端、文件系统和后台作业访问权限。
解决了 Linux 版 Claude Desktop 上无法加载 claude_desktop_config.json 风格 MCP 服务器的问题(该机制仅适用于 macOS/Windows);在 Linux 上,添加工具的唯一方法是通过可安装的扩展。
⚠️ 安全性 — 请先阅读
安装此扩展即授予 Claude 对您用户帐户的无限制 shell 访问权限。 您的用户在终端中能做的任何事情,Claude 都可以通过此工具完成:读取您的用户可以读取的任何文件、修改他们可以修改的任何内容、安装软件、打开网络连接等。
安装此扩展时,请将其视为授予某人访问您机器的 SSH 会话。请勿在包含您不希望 Claude 查看的敏感数据的机器或共享系统上安装它。
内置了一个最小的安全拒绝列表,拒绝了一些明显的破坏性单行命令(rm -rf /、rm -rf ~、fork 炸弹、原始磁盘设备上的 dd/mkfs、shutdown/reboot)。这是一个最后的安全网,而不是沙箱。 坚定的命令可以轻易绕过它。它的存在是为了防止因一时疏忽而清空您的主目录。
要加强限制,请编辑 server.js 顶部的 DENYLIST 数组并重新构建。要完全移除它们,请设置 DENYLIST = [] 并重新构建。
Related MCP server: claude-linux-mcp
功能说明
向 Claude 公开 8 个工具:
工具 | 用途 |
| 通过 |
| 读取带有可选行范围切片的文本文件。 |
| 列出条目,包含类型(文件/目录)、大小和修改时间。 |
| 创建或覆盖文本文件。会自动创建父目录。 |
| 生成一个分离的子进程;返回一个 |
| 后台作业的状态以及 stdout/stderr 的最后 N 行。 |
| 所有作业(运行中、已退出、已终止)。 |
| 向作业发送 SIGTERM;如果 5 秒后仍然存活,则发送 SIGKILL。 |
运行状态(记录、作业临时文件)位于 /tmp/claude-term-mcp/ 下,并在重启时清除。
安装
从 Releases 页面 下载最新的
Terminal.mcpb。打开 Claude Desktop → Settings → Extensions。
滚动到底部的 Extension Developer 部分。点击 Install Extension 并选择您下载的
Terminal.mcpb文件。Claude Desktop 会显示带有红色“开发者信息未经 Anthropic 验证”警告的扩展详情。确认您信任该来源,然后点击 Install。
安装时,Claude Desktop 会询问 Default working directory(默认工作目录)——这是 Claude 在未指定目录时运行 shell 命令的位置。选择您的主要项目文件夹,或留空以默认为您的主目录。
回到 All extensions,确保 Terminal 已开启。
在聊天中,打开连接器/工具选择器并为该对话启用 Terminal。
您可以稍后从 Settings → Extensions → Terminal 更改默认工作目录。
要求
Linux 上的 Claude Desktop ≥ 0.10.0(也在 macOS 上测试过)
Node.js ≥ 16(Claude Desktop 捆绑了它用于运行扩展的最新 Node,因此不需要系统 Node)
PATH 中的
bash
无需 npm install 步骤 — 该扩展是零依赖的纯 Node 程序。
配置
所有配置均通过 Claude Desktop 的 UI 在安装时或在 Settings → Extensions → Terminal 下完成。
字段 | 类型 | 用途 |
Default working directory | 目录 | Claude 未指定目录时 shell 命令运行的位置。留空则默认为 |
要自定义拒绝列表或其他行为,请编辑 server.js 并重新构建(见下文)。
已知问题
黄色横幅:“Tool result could not be submitted. The request may have expired or the connection was interrupted.” 这会在触发 Claude 动态工具加载步骤的每一轮中出现。404 错误发生在向 Anthropic 后端提交工具搜索结果时,而不是 MCP 工具本身——您的工具调用在横幅出现后会立即正确运行并返回。这只是外观问题。同样的问题也出现在官方的文件系统扩展中。这很可能是客户端↔后端协议不匹配,将在未来的 Claude Desktop 版本中修复。
从源码构建
git clone https://github.com/LukeLamb/claude-terminal-mcp
cd claude-terminal-mcp
# Edit whatever you want in server.js / manifest.json.
# If you change the tool surface, update both places.
# Bump the version in manifest.json so Claude Desktop treats the install as an update.
# Build the bundle:
zip -j Terminal.mcpb manifest.json package.json server.js
# Then install Terminal.mcpb via Claude Desktop → Settings → Extensions → Install Extension.卸载
Settings → Extensions → All extensions → Terminal → Remove。
隐私政策
没有任何数据离开您的机器。 此扩展完全在本地运行:
数据收集: 无。该扩展不会向外拨号、发送遥测数据或进行任何自身的网络请求。您观察到的所有网络调用都是您要求 Claude 运行的(例如
curl、wget、git push)。数据使用与存储: 命令记录(不包括 stdin,包括 stdout + stderr + 退出代码)被写入
/tmp/claude-term-mcp/runs/<timestamp>.log,以便 Claude 稍后可以在同一对话中引用它们。后台作业状态(命令、pid、stdout/stderr 日志文件、退出代码、状态)被写入/tmp/claude-term-mcp/jobs/<job-id>/。第三方共享: 无。此扩展不会向 Anthropic、扩展作者或任何第三方传输任何内容。(Claude Desktop 本身作为正常聊天流程的一部分,会单独将工具输入/输出发送给 Anthropic——这是您与 Anthropic 的关系,而非此扩展的关系。)
保留期限:
/tmp/claude-term-mcp/在每次重启时都会被清除。要手动清除:rm -rf /tmp/claude-term-mcp。权限范围: 命令以您自己的用户权限运行——与您在终端中输入它们的效果相同。
联系方式 / 问题: 在 https://github.com/LukeLamb/claude-terminal-mcp/issues 提交 issue。
许可证
MIT。自由使用,感谢署名,不提供任何担保。
Available Tools
8 toolskill_backgroundADestructive
Terminate a running background job (SIGTERM, then SIGKILL after 5s).
Inputs: job_id (required).
list_backgroundARead-only
List all background jobs (running, exited, killed).
Inputs: no named parameters.
list_directoryARead-only
List entries in a directory with type, size, and mtime.
Inputs: path (required).
read_backgroundARead-only
Read status and last N lines of stdout/stderr for a background job. tail=0 returns full logs.
Inputs: job_id (required), tail.
read_fileARead-only
Read a text file with optional line-range slicing.
Inputs: path (required), offset, limit.
run_backgroundADestructive
Start a long-running command in the background. Returns a job_id you can poll with read_background.
Inputs: command (required), cwd.
run_commandADestructive
Run a shell command via bash -lc on the user's machine. Returns stdout/stderr/exit_code. Default cwd is the user-configured default working directory (or $HOME if unset). Output capped at 100KB per stream; full transcript saved to log_path.
Inputs: command (required), cwd, timeout, env.
write_fileADestructive
Create or overwrite a text file. Parent directories are created.
Inputs: path (required), content (required), overwrite.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a distinct purpose: run_command for synchronous commands, run_background for long-running, and separate tools for file operations and background job management. No overlap.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., kill_background, list_directory, read_file), making the set predictable.
With 8 tools, the server covers essential terminal operations (command execution, file read/write, listing, background jobs) without excessive tool count.
Core operations are present, but missing file deletion, rename, and persistent directory change tools; however, these can be accomplished via run_command, so only minor gaps.
Maintenance
Related MCP Connectors
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Remote MCP access to user-authorized Linux, Windows and Intel Mac devices for AI assistants.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Related MCP Servers
- AlicenseAqualityBmaintenanceAllows Claude desktop app to execute terminal commands and edit files on your computer through MCP, with features including command execution, process management, and diff-based file editing.2510,411MIT
- AlicenseAqualityCmaintenanceGive Claude Desktop full desktop control on Linux/X11: screenshot, mouse, keyboard, windows, clipboard, app launch. Zero-dependency MCP extension, MIT-licensed.15MIT
- FlicenseNot gradedqualityDmaintenanceProvides filesystem access to Claude via the MCP protocol, enabling local file operations through natural language.-
- AlicenseNot gradedqualityDmaintenanceExposes an interactive terminal over MCP, enabling remote shell command execution, file operations, and directory management via ChatGPT or Claude Desktop.2MIT