IM

inercia/mcpshell

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

72 stars 16 forks Качество 73 Тренд 22MIT

inercia/mcpshell - кандидат на сервер MCP, импортированный из https://github.com/inercia/mcpshell.

Обзор

inercia/mcpshell - кандидат на сервер MCP, импортированный из https://github.com/inercia/mcpshell.

Обзор (машинный перевод)

MCPShell - это инструмент, который позволяет LLM безопасно выполнять инструменты командной строки** **Модельный контекстный протокол (MCP). Он обеспечивает безопасный мост между LLM и командами операционной системы.

Особенности

** Гибкое исполнение команд**: Запускайте любые команды оболочки как инструменты MCP. Замена параметров через шаблоны. Определения инструментов на основе конфигурации: Определение инструментов в YAML с параметрами ограничения и выходное форматирование. ** Безопасность через ограничения**: Проверка параметров инструмента с использованием выражений CEL перед исполнением, а также необязательные санбоксированные среды для выполнения команд. Быстрое прототипирование инструментов MCP: просто добавьте код оболочки и используйте его как Инструмент MCP в вашем LLM. Простая интеграция: Работает с любым клиентом LLM, поддерживающим протокол MCP. (например, Cursor, VSCode, Witsy)

Быстрый старт

Представьте, что вы хотите, чтобы Cursor (или какой-либо другой клиент MCP) помог вам с вашим клиентом. Проблемы с пространством на жестком диске.

  1. Создайте файл конфигурации /my/example.yaml, определяющий ваши инструменты:

Взгляните на каталог примеров для более сложных и полезных примеров. Возможно, вы предпочитаете, чтобы LLM знал о вашем кластере Kubernetes

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

MCPShell

The MCPShell is a tool that allows LLMs to safely execute command-line tools through the Model Context Protocol (MCP). It provides a secure bridge between LLMs and operating system commands.

Features

  • Flexible command execution: Run any shell commands as MCP tools, with parameter substitution through templates.
  • Configuration-based tool definitions: Define tools in YAML with parameters, constraints, and output formatting.
  • Security through constraints: Validate tool parameters using CEL expressions before execution, as well as optional sanboxed environments for running commands.
  • Quick proptotyping of MCP tools: just add some shell code and use it as a MCP tool in your LLM.
  • Simple integration: Works with any LLM client supporting the MCP protocol (ie, Cursor, VSCode, Witsy…)

Quick Start

Imagine you want Cursor (or some other MCP client) help you with your space problems in your hard disk.

  1. Create a configuration file /my/example.yaml defining your tools:

    mcp:
      description: |
        Tool for analyzing disk usage to help identify what's consuming space.
      run:
        shell: bash
      tools:
        - name: "disk_usage"
          description: "Check disk usage for a directory"
          params:
            directory:
              type: string
              description: "Directory to analyze"
              required: true
            max_depth:
              type: number
              description: "Maximum depth to analyze (1-3)"
              default: 2
          constraints:
            - "directory.startsWith('/')"  # Must be absolute path
            - "!directory.contains('..')"  # Prevent directory traversal
            - "max_depth >= 1 && max_depth <= 3"  # Limit recursion depth
            - "directory.matches('^[\\w\\s./\\-_]+$')"  # Only allow safe path characters, prevent command injection
          run:
            command: |
              du -h --max-depth={{ .max_depth }} {{ .directory }} | sort -hr | head -20
          output:
            prefix: |
              Disk Usage Analysis (Top 20 largest directories):
    

    Take a look at the examples directory for more sophisticated and useful examples. Maybe you prefer to let the LLM know about your Kubernetes cluster with kubectl? Or let it run some AWS CLI commands?

  2. Configure the MCP server in Cursor (or in any other LLM client with support for MCP)

    For example, for Cursor, create .cursor/mcp.json:

    {
        // you need the "go" command available
        "mcpServers": {
            "mcp-cli-examples": {
                "command": "go",
                "args": [
                   "run", "github.com/inercia/[email protected]",
Открыть полный README на GitHub

Установка

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

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ // you need the "go" command available "mcpServers": { "mcp-cli-examples": { "command": "go", "args": [ "run", "github.com/inercia/[email protected]", "mcp", "--tools", "/my/example.yaml", "--logfile", "/some/path/mcpshell/example.log" ] } } }