Cover image
Try Now
2025-03-29

镜像://github.com/mkusaka/mcp-shell-server

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

MCP Shell Server

A server that uses the Model Context Protocol (MCP) to execute shell commands. It functions as a bridge that allows AI agents to safely execute shell commands.

Features

  • Execute shell commands (single-line and multi-line support)
  • Support for various shells (bash, zsh, fish, powershell, cmd, etc.)
  • Detailed error handling and logging
  • MCP Inspector compatible

Installation

From npm (as a user)

# Using npm
npm install -g @mkusaka/mcp-shell-server

# Using yarn
yarn global add @mkusaka/mcp-shell-server

# Using pnpm
pnpm add -g @mkusaka/mcp-shell-server

From source (for development)

# Clone the repository
git clone https://github.com/mkusaka/mcp-shell-server.git
cd mcp-shell-server

# Install dependencies
pnpm install

# Build the project
pnpm build

MCP Configuration

Cursor Configuration

Add the following to your Cursor configuration file (~/.cursor/config.json):

{
  "mcpServers": {
    "shell": {
      "command": "npx",
      "args": ["-y", "@mkusaka/mcp-shell-server"]
    }
  }
}

Rule Configuration

Add the following to your Cursor rules file:

You have tools at your disposal to solve the coding task. Follow these rules regarding tool calls:
1. ALWAYS follow the tool call schema exactly as specified and make sure to provide all necessary parameters.
2. The conversation may reference tools that are no longer available. NEVER call tools that are not explicitly provided.
3. **NEVER refer to tool names when speaking to the USER.** For example, instead of saying 'I need to use the shell_exec tool to execute your command', just say 'I will execute your command'.
4. Only calls tools when they are necessary. If the USER's task is general or you already know the answer, just respond without calling tools.
5. Before calling each tool, first explain to the USER why you are calling it.

Usage

Direct Execution

node dist/index.js
# or as an executable
./dist/index.js

Development Mode

pnpm dev

Testing with MCP Inspector

pnpm inspect

Command Line Arguments

-s, --shell <shell>  Specify the path to the shell to use
-h, --help           Display help message
-V, --version        Display version information

Tool Reference

shell_exec

Executes commands in the specified shell.

Parameters:

  • command (string, required): The shell command to execute

Resource Reference

The server provides the following system information as resources:

hostname

Returns the hostname of the system.

URI: hostname://

platform

Returns the operating system platform.

URI: platform://

shell

Returns the shell path being used by the server.

URI: shell://

username

Returns the current username.

URI: username://

system-info

Returns comprehensive system information in JSON format, including:

  • hostname
  • platform
  • shell
  • username
  • CPU count
  • Total memory
  • Free memory
  • System uptime

Usage Examples

Basic Command Execution

{
  "name": "shell_exec",
  "parameters": {
    "command": "echo Hello, World!"
  }
}

Multi-line Command (Heredoc) Execution

{
  "name": "shell_exec",
  "parameters": {
    "command": "cat << EOF | grep 'example'\nThis is an example text.\nAnother line without the keyword.\nEOF"
  }
}

Development

Project Structure

src/
├── index.ts                # Main entry point
└── shell-server/
    ├── index.ts            # Shell server implementation
    └── lib/
        └── logger.ts       # Logging configuration

Logging

Logs are written to the mcp-shell.log file.

License

MIT

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • JackKuo666
  • 🔍使AI助手可以通过简单的MCP接口搜索和访问PYPI软件包信息。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

    Reviews

    5 (1)
    Avatar
    user_QSD4UGca
    2025-04-17

    I've been using mkusaka_mcp-shell-server for a few weeks now, and it has been stellar! The efficiency and reliability it brings to my daily tasks are unmatched. The seamless integration and easy setup process are commendable. Highly recommend this tool for anyone needing a robust shell server solution. Kudos to MCP-Mirror for this fantastic product!