Skip to main content
Glama

Bash MCP Server

by touwaeriol
  • Linux

Bash MCP Server

English | 中文

English

A Model Context Protocol (MCP) server that enables execution of bash commands on the host machine.

Features

  • Execute arbitrary bash commands
  • Configurable working directory
  • Command timeout support
  • Returns stdout, stderr, and exit code

Installation

Using pip
pip install bash-mcp
From source
git clone https://github.com/touwaeriol/bash-mcp.git cd bash-mcp pip install -e .

Configuration

Add to your Claude Desktop configuration:

{ "mcpServers": { "bash-mcp": { "command": "python", "args": ["-m", "bash_mcp"] } } }

Usage

The server provides an execute_command tool with the following parameters:

  • command (required): Bash command to execute
  • cwd (optional): Working directory for command execution
  • timeout (optional): Command timeout in seconds (default: 30)
Example Request
{ "tool": "execute_command", "arguments": { "command": "ls -la", "cwd": "/home/user", "timeout": 10 } }
Example Response
{ "success": true, "stdout": "total 24\ndrwxr-xr-x 6 user user 4096 Dec 10 10:00 .\n...", "stderr": "", "code": 0, "command": "ls -la", "executedAt": "2024-12-10T10:00:00.000Z" }

Security Warning

⚠️ WARNING: This MCP server can execute arbitrary system commands. Use with caution:

  • Only use in trusted environments
  • Be careful with commands that could damage your system
  • Consider implementing access controls

Development

Requirements
  • Python >= 3.8
  • mcp >= 0.1.0
  • pydantic >= 2.0.0
Local Development
# Clone the repository git clone https://github.com/touwaeriol/bash-mcp.git cd bash-mcp # Install in development mode pip install -e . # Run the server python -m bash_mcp

License

MIT License


中文

一个用于在宿主机上执行 bash 命令的 MCP(Model Context Protocol)服务器。

功能特性

  • 执行任意 bash 命令
  • 支持指定工作目录
  • 可配置命令超时时间
  • 返回标准输出、标准错误和执行状态

安装

使用 pip
pip install bash-mcp
从源码安装
git clone https://github.com/touwaeriol/bash-mcp.git cd bash-mcp pip install -e .

配置

在 Claude Desktop 的配置文件中添加:

{ "mcpServers": { "bash-mcp": { "command": "python", "args": ["-m", "bash_mcp"] } } }

使用示例

MCP 服务器提供了一个 execute_command 工具,支持以下参数:

  • command (必需): 要执行的 bash 命令
  • cwd (可选): 工作目录
  • timeout (可选): 超时时间(秒),默认 30 秒
示例请求
{ "tool": "execute_command", "arguments": { "command": "ls -la", "cwd": "/home/user", "timeout": 10 } }
示例响应
{ "success": true, "stdout": "total 24\ndrwxr-xr-x 6 user user 4096 Dec 10 10:00 .\n...", "stderr": "", "code": 0, "command": "ls -la", "executedAt": "2024-12-10T10:00:00.000Z" }

安全注意事项

⚠️ 警告: 此 MCP 服务器可以执行任意系统命令,请谨慎使用:

  • 仅在受信任的环境中使用
  • 避免执行可能造成系统损坏的命令
  • 建议配置适当的权限和访问控制

开发

依赖项
  • Python >= 3.8
  • mcp >= 0.1.0
  • pydantic >= 2.0.0
本地开发
# 克隆仓库 git clone https://github.com/touwaeriol/bash-mcp.git cd bash-mcp # 安装开发依赖 pip install -e . # 运行服务器 python -m bash_mcp

许可证

MIT License

-
security - not tested
F
license - not found
-
quality - not tested

An MCP server that enables Claude to execute bash commands on the host machine with configurable working directories and timeouts.

  1. English
    1. Features
    2. Installation
    3. Configuration
    4. Usage
    5. Security Warning
    6. Development
    7. License
  2. 中文
    1. 功能特性
    2. 安装
    3. 配置
    4. 使用示例
    5. 安全注意事项
    6. 开发
    7. 许可证

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    This MCP server enables users to execute shell commands in the current iTerm2 session through integration with Claude Desktop, facilitating seamless command execution via the Model Context Protocol.
    Last updated -
    3
    514
    296
    TypeScript
    MIT License
    • Apple
  • A
    security
    A
    license
    A
    quality
    Allows 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.
    Last updated -
    19
    7,040
    3,572
    JavaScript
    MIT License
    • Apple
  • -
    security
    F
    license
    -
    quality
    An MCP server that allows AI assistants like Claude to execute terminal commands on the user's computer and return the output, functioning like a terminal through AI.
    Last updated -
    38
    Python
    • Apple
  • -
    security
    -
    license
    -
    quality
    A server built with mcp-framework that allows users to extend Claude's capabilities by adding custom tools that can be used through the Claude Desktop client.
    Last updated -
    TypeScript

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/touwaeriol/bash-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server