
xkiranj/linux-command-mcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
MCP-сервер и клиент для запуска команд Linux
Обзор
Linux Command MCP - это удаленная система выполнения команд, построенная с использованием протокола Model Context Protocol (MCP), позволяющая безопасное и стандартизированное выполнение команд Linux. Серверы MCP настроены в файле claude desktop config.json, обычно расположенном по адресу ~/.config/Claude/claude desktop config.json. - "командир": указывает исполнителю (узел, npx, uvx) - "аргс": Полный путь к исполняемому серверу - Убедитесь, что путь является абсолютным путем к вашему index.js Всегда используйте полные, абсолютные пути - Проверьте разрешения файлов - Убедитесь, что указанный файл выполняется - Node.js (v18.x или более поздняя версия) - npm - PM2 (для управления процессами) Доступные команды: 1. exec - Исполнить команду Linux 2. list [directory] - List Directory contents 3. help - Показать эту помощь 4. exit - Выход клиента Linux Command MCP теперь поддерживает интерактивные скрипты через stdin! Теперь вы можете вводить интерактивные скрипты, используя параметр stdin:
Обзор (машинный перевод)
Обзор
Linux Command MCP - это удаленная система выполнения команд, построенная с использованием протокола Model Context Protocol (MCP), позволяющая безопасное и стандартизированное выполнение команд Linux.
Конфигурация для серверов Claude Desktop MCP
Понимание конфигурации
Серверы MCP сконфигурированы в файле claude_desktop_config.json, обычно расположенном на ~/.config/Claude/claude_desktop_config.json.
Структура конфигурации
Конфигурация Linux Command MCP Server
Конфигурация
[[Т2]]: указывает исполнителя [[Т3]], [[Т4]], [[Т5]]
- [[Т6]]: Полный путь к исполняемому серверу Убедись, что твой путь — это абсолютный путь к тебе [7].
###Важные настройки Всегда используйте полные, абсолютные пути.
- Проверка разрешений на использование файлов
- Убедитесь, что указанный файл является исполняемым
Предпосылки
Node.js (v18.x или более поздняя версия)
- npm
- PM2 (для управления процессами)
##Установка
- Клонировать хранилище
2.Установка зависимостей сервера
3.Установка зависимостей клиентов
Использование
Запуск сервера
- Перейдите в каталог сервера
2 Начать с PM2
Использование клиента
Доступные команды:
- exec - выполнить команду Linux
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
Linux Command MCP (Model Context Protocol)
Overview
Linux Command MCP is a remote command execution system built using the Model Context Protocol (MCP), allowing secure and standardized execution of Linux commands.
Configuration for Claude Desktop MCP Servers
Understanding the Configuration
The MCP servers are configured in the claude_desktop_config.json file, typically located at ~/.config/Claude/claude_desktop_config.json.
Configuration Structure
"mcpServers": {
"server-name": {
"command": "node|npx|uvx",
"args": ["server-specific-arguments"],
"env": {
"OPTIONAL_ENVIRONMENT_VARIABLES": "value"
}
}
}
Linux Command MCP Server Configuration
"linux-command": {
"command": "node",
"args": [
"/full/path/to/linux-command-mcp/server/dist/index.js"
]
}
Configuration Explained
"command": Specifies the executor (node,npx,uvx)"args": Full path to the server’s executable- Ensure the path is an absolute path to your
index.js
Important Configuration Tips
- Always use full, absolute paths
- Verify file permissions
- Ensure the specified file is executable
Prerequisites
- Node.js (v18.x or later)
- npm
- PM2 (for process management)
Installation
- Clone the repository
git clone
cd linux-command-mcp
- Install server dependencies
cd server
npm install
npm run build
- Install client dependencies
cd ../client
npm install
npm run build
Usage
Starting the Server
- Navigate to the server directory
cd server
- Start with PM2
npm run pm2:start
Using the Client
Available Commands:
- exec - Execute a Linux command
- list [directory] - List directory contents
- help - Show this help
- exit - Exit the client
Execute commands directly:
# In the client directory
npm start
exec "ls -l"
exec "list /home"
exec "uname -a"
Interactive Commands & Stdin Support
✨ NEW: The Linux Command MCP server now supports interactive scripts via stdin!
Using stdin Parameter
You can now provide input to interactive scripts using the stdin parameter:
// Example: Run an interactive Python game
await callTool('execute-command', {
command: 'python3 /path/to/interactive_script.py',
stdin: '15\n2\n1\n2\n1\n' // Automated responses
});
How it works:
- The
stdinparameter sends input to the script before execution - Input is sent line-by-line (use
\nfor newlines) - Script runs to completion with automated responses
- All output is captured and returned
Interactive Script Examples
Python game with input:
# Game expects: number of sticks, then player moves
stdin: "15\n2\n1\n2\n1\n"
Setup wizard:
# Wizard expects: username, email, confirm
stdin: "johndoe\[email protected]\ny\n"
Multiple choice prompt:
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →Конфигурация
"mcpServers": {
"server-name": {
"command": "node|npx|uvx",
"args": ["server-specific-arguments"],
"env": {
"OPTIONAL_ENVIRONMENT_VARIABLES": "value"
}
}
}