PM

patrickomatik/mcp-bash

Developer tools

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

37 stars 18 forks 품질 63 트렌드 12MIT

patrickomatik/mcp-bash는 MCP 서버 후보가 https://github.com/patrickomatik/mcp-bash.에서 수입되었습니다

개요

patrickomatik/mcp-bash는 MCP 서버 후보가 https://github.com/patrickomatik/mcp-bash.에서 수입되었습니다

개요(AI 번역)

Bash 명령어를 실행하는 간단한 Model-Context-Protocol (MCP) 서버. 이 프로젝트는 MCP 서버 인터페이스를 통해 bash 명령을 실행할 수 있으며, 모든 잠재적 인 보안 위험이 있습니다. 나는이 글을 쓰는 시점에서 공공 도메인에서 다른 것을 찾을 수 없었다, 그래서 나는 내 자신의 썼다. Claude Desktop 을 작성할 때 boon입니다 (테스트를 실행할 수 있으며 결과를 평가하고 문제가 한 패스에 발견됩니다.)

묘사

사이트맵 Bash는 클라이언트 애플리케이션에서 bash 명령을 실행하는 간단한 방법을 제공합니다. 제어 환경에서 명령 실행을 감싸고 실행 명령에서 stdout과 stderr를 모두 반환합니다.

주요 특징:

  • arbitrary bash 명령 실행
  • 명령 실행을 통해 작업 디렉토리를 설정하고 유지
  • Model-Context-Protocol (MCP)를 통한 클린 인터페이스
  • 배포 및 확장

설치

# 필수품

  • Python 3.10 이상
  • pip 또는 다른 패키지 관리자

설정

  1. 저장소를 복제

  2. 가상 환경을 만들고 활성화

  3. 의존성 설치

사용법

서버 시작

Claude 데스크탑 구성

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

README

원문 README의 일부입니다. 원문 보기.

MCP Bash

A simple Model-Context-Protocol (MCP) server for executing bash commands. This project allows you to execute bash commands via an MCP server interface, with all the potential security risks that entails! I couldn’t find anything else like this in the public domain at the time of writing, so I wrote my own. It’s a boon when getting Claude Desktop to write code (it can run the tests, assess the results and fix the issues is finds in one pass.)

Description

MCP Bash provides a simple way to execute bash commands from client applications. It wraps command execution in a controlled environment and returns both stdout and stderr from the executed commands.

Key features:

  • Execute arbitrary bash commands
  • Set and maintain a working directory across command executions
  • Clean interface through the Model-Context-Protocol (MCP)
  • Simple to deploy and extend

Installation

Prerequisites

  • Python 3.10 or higher
  • pip or another package manager

Setup

  1. Clone the repository

    git clone https://github.com/yourusername/mcp-bash.git
    cd mcp-bash
    
  2. Create and activate a virtual environment

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install dependencies

    pip install -e .
    

Usage

Starting the server

python -m mcp.cli.server --module server

Claude Desktop Configuration

To use this with Claude Desktop, add this to your configuration (usually /Users//Library/Application Support/Claude/claude_desktop_config.json, or see ‘Settings -> Developer’ in Claude Desktop UI):

{
  "mcpServers": {
    "Bash": {
      "command": "/Users//.local/bin/uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "mcp",
        "run",
        "/path/to/server.py"
      ]
    }
  }
}

Then ask Claude: “List the files in my current directory using the Bash MCP tool”

Using the API

The server exposes two main functions:

  1. set_cwd(path): Set the working directory for bash commands
  2. execute_bash(cmd): Execute a bash command and return stdout/stderr

Example client code

from mcp.client import MCPClient

async def main():
    # Connect to the MCP server
    client = MCPClient("http://localhost:8000")
    
    # Set working directory
    await client.set_cwd("/path/to/your/directory")
    
    # Execute a command
    stdout, stderr = await client.execute_bash("ls -la")
    
    print(f"Command output: {stdout}")
    if stderr:
        print(f"Error output: {stderr}")

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Security Considerations

This server executes bash commands directly, which can be a lethal security risk if not properly restricted. There’s nothing stopping the LLM from running dangerous commands like rm -rf /. For personal use, the usefulness may outweigh the risks, but take care when deploying.

GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "Bash": { "command": "/Users/<username>/.local/bin/uv", "args": [ "run", "--with", "mcp[cli]", "mcp", "run", "/path/to/server.py" ] } } }