mcp-linux-ops
Enables LLMs to execute shell commands and perform file operations on a Linux system, exposing tools like execute_command, read_file, write_file, and more.
README
Linux 操作 MCP 服务器
这是一个 Model Context Protocol (MCP) 服务器,允许大模型在 Linux 机器上执行各种操作,包括执行命令、文件操作等。
功能特性
命令执行
- execute_command: 在 Linux 系统上执行 shell 命令
- 支持指定工作目录
- 可配置超时时间
- 返回标准输出、标准错误和退出码
文件操作
- read_file: 读取文件内容
- write_file: 写入文件内容(支持追加模式)
- list_directory: 列出目录内容
- create_directory: 创建目录(支持递归创建)
- delete_file: 删除文件或目录
- file_exists: 检查文件或目录是否存在
- get_file_info: 获取文件或目录的详细信息
- copy_file: 复制文件或目录
- move_file: 移动或重命名文件或目录
安装
- 克隆或下载此项目
- 安装依赖:
npm install
- 构建项目:
npm run build
使用方法
在 Cursor 中配置
在 Cursor 的设置中添加 MCP 服务器配置。编辑你的 MCP 配置文件(通常在 ~/.cursor/mcp.json 或类似位置):
{
"mcpServers": {
"linux-ops": {
"command": "node",
"args": ["/path/to/mcp/dist/index.js"]
}
}
}
或者如果你使用 npm 全局安装:
{
"mcpServers": {
"linux-ops": {
"command": "mcp-linux-ops"
}
}
}
开发模式
在开发时,你可以使用 tsx 直接运行:
npm run dev
工具说明
execute_command
执行 shell 命令并返回结果。
参数:
command(必需): 要执行的 shell 命令workingDirectory(可选): 执行命令的工作目录timeout(可选): 命令超时时间(秒,默认 30)
示例:
{
"command": "ls -la",
"workingDirectory": "/home/user",
"timeout": 10
}
read_file
读取文件内容。
参数:
filePath(必需): 要读取的文件路径encoding(可选): 文件编码(默认 "utf-8")
write_file
写入文件内容。
参数:
filePath(必需): 要写入的文件路径content(必需): 要写入的内容encoding(可选): 文件编码(默认 "utf-8")append(可选): 是否追加模式(默认 false)
list_directory
列出目录内容。
参数:
directoryPath(必需): 要列出的目录路径includeHidden(可选): 是否包含隐藏文件(默认 false)
create_directory
创建目录。
参数:
directoryPath(必需): 要创建的目录路径recursive(可选): 是否递归创建父目录(默认 true)
delete_file
删除文件或目录。
参数:
path(必需): 要删除的文件或目录路径recursive(可选): 删除目录时是否递归(默认 false)
file_exists
检查文件或目录是否存在。
参数:
path(必需): 要检查的文件或目录路径
get_file_info
获取文件或目录的详细信息。
参数:
filePath(必需): 文件或目录路径
copy_file
复制文件或目录。
参数:
source(必需): 源文件或目录路径destination(必需): 目标路径recursive(可选): 复制目录时是否递归(默认 true)
move_file
移动或重命名文件或目录。
参数:
source(必需): 源文件或目录路径destination(必需): 目标路径
安全注意事项
⚠️ 警告: 此服务器允许执行任意 shell 命令,具有与运行用户相同的权限。请确保:
- 只在受信任的环境中使用
- 不要在生产环境中以 root 权限运行
- 考虑添加命令白名单或权限控制
- 限制可访问的文件系统路径
许可证
MIT
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.