XL

xkiranj/linux-command-mcp

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

25 stars 8 forks 품질 70 트렌드 0MIT

MCP 서버 및 Linux 명령 실행을 위한 클라이언트

개요

Linux 명령 MCP는 Model Context Protocol (MCP)을 사용하여 내장 된 원격 명령 실행 시스템이며 Linux 명령의 보안 및 표준화 된 실행을 허용합니다. MCP 서버는 claude desktop config.json 파일에서 일반적으로 ~/.config/Claude/claude desktop config.json에 위치해 있습니다. - "command": executor (node, npx, uvx) - "args": 서버의 실행에 대한 전체 경로 - 경로는 index.js에 절대 경로입니다. - 항상 전체 사용, 절대 경로 - 파일 권한을 검증 - 지정된 파일이 실행되도록 보장 - Node.js (v18.x 이상) - npm - PM2 (공정 관리) 사용 가능한 명령: 1. 실행 - 리눅스 명령 실행 2. 목록 [directory] - 목록 디렉토리 내용 3. 도움말 -이 도움말 표시 4. 출구 - 클라이언트를 종료 : Linux 명령 MCP 서버는 이제 stdin을 통해 대화 형 스크립트를 지원합니다! 이제 stdin 매개 변수를 사용하여 대화 형 스크립트에 입력 할 수 있습니다

개요(AI 번역)

개요

Linux 명령 MCP는 Model Context Protocol (MCP)을 사용하여 내장 된 원격 명령 실행 시스템이며 Linux 명령의 보안 및 표준화 된 실행을 허용합니다.

Claude 데스크탑 MCP 서버 구성

구성 이해

MCP 서버는 claude_desktop_config.json] 파일로 구성되며, 일반적으로 ~/.config/Claude/claude_desktop_config.json에 있습니다.

구성 구조

Linux 명령 MCP 서버 구성

윤곽 설명

  • "command": executor (node], npx], uvx)를 지정합니다.
  • "args": 서버의 실행 가능한 전체 경로
  • 경로는 절대 경로가 당신의 index.js

중요한 구성 팁

  • 항상 전체 사용, 절대 경로
  • 파일 권한 검증
  • 지정된 파일을 실행할 수 있습니다.

필수품

  • Node.js (v18.x 이상)
  • 시간
  • PM2 (공정관리)

설치

  1. 저장소를 복제

  2. 서버 의존성 설치

  3. 클라이언트 의존성 설치

사용법

서버 시작

  1. 서버 디렉토리에 Navigate

  2. PM2로 시작

클라이언트 사용

유효한 명령:

  1. exec - Linux 명령 실행
  2. 명세.

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

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

  1. Clone the repository
git clone 
cd linux-command-mcp
  1. Install server dependencies
cd server
npm install
npm run build
  1. Install client dependencies
cd ../client
npm install
npm run build

Usage

Starting the Server

  1. Navigate to the server directory
cd server
  1. Start with PM2
npm run pm2:start

Using the Client

Available Commands:

  1. exec - Execute a Linux command
  2. list [directory] - List directory contents
  3. help - Show this help
  4. 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 stdin parameter sends input to the script before execution
  • Input is sent line-by-line (use \n for 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:

GitHub에서 전체 README 보기

설치

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" } } }