MCP cover image
See in Github
2025-02-15

Servidor MCP y cliente para ejecutar comandos de Linux

1

Github Watches

1

Github Forks

1

Github Stars

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 <repository-url>
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"

Sudo Commands

Important Note: The Linux Command MCP server CANNOT execute interactive commands like sudo.

When you need to run a sudo command:

  1. Execute the command manually on the server
  2. Copy and paste the output
  3. Share the results

Troubleshooting

  • Ensure PM2 is running: pm2 list
  • Check server logs: pm2 logs linux-command-mcp-server
  • Verify server and client builds

Using Linux Commands in Claude Desktop

Example Interactions

Here are some safe, generic examples of how you can ask Claude to run Linux commands:

  1. Check System Information

    • "Can you show me the Linux kernel version?"
    $ uname -r
    
  2. List Directory Contents

    • "Show me the contents of the home directory"
    $ ls ~
    
  3. Check Available Disk Space

    • "What's the disk usage on this system?"
    $ df -h
    
  4. View System Uptime

    • "How long has this system been running?"
    $ uptime
    
  5. Check Network Interfaces

    • "What network interfaces are available?"
    $ ip addr
    
  6. System Memory Information

    • "Can you show me the memory usage?"
    $ free -h
    

Important Usage Guidelines

  • Privacy: Only run commands that do not reveal sensitive information
  • Safety: Avoid commands that modify system configuration
  • Scope: Focus on informational and diagnostic commands

What to Avoid

❌ Do NOT run commands that:

  • Reveal personal file names or paths
  • Contain sensitive system configurations
  • Modify system settings
  • Require sudo or root permissions

Example Conversation

User: "Can you check the Linux kernel version?"

Claude: Certainly! I'll run the command to show the Linux kernel version.

$ uname -r
5.15.0-91-generic

This kernel is running Ubuntu 22.04.3 LTS.

Security Considerations

  • Only run this on trusted networks
  • Limit access to the server
  • Be cautious with command execution

Security and Best Practices

  • Always be mindful of the information you're requesting
  • Use commands that provide system-level, non-sensitive information
  • When in doubt, ask Claude to clarify the command's purpose

Contributing

Improve and expand the Linux Command MCP by:

  • Adding more safe, generic command examples
  • Enhancing documentation
  • Suggesting improvements to command execution

License

MIT license

Contact

  • Email: xkiranj.1980@gmail.com

  • Blockchain: 0xkiran.eth

    • Ethereum: 0x67F367edb83d8fdF48E7E7Cfcb35183e746c292c
    • Bitcoin: bc1q688np092y8raxag5e6573chrcgck5756yv476v

相关推荐

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

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

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

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

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

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

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

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

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

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

  • https://jgadvisorycpa.com
  • This GPT assists in finding a top-rated business CPA - local or virtual. We account for their qualifications, experience, testimonials and reviews. Business operators provide a short description of your business, services wanted, and city or state.

  • apappascs
  • Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.

  • Mintplex-Labs
  • La aplicación AI de escritorio todo en uno y Docker con trapo incorporado, agentes de IA, creador de agentes sin código, compatibilidad de MCP y más.

  • modelcontextprotocol
  • Servidores de protocolo de contexto modelo

  • ShrimpingIt
  • Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx

  • n8n-io
  • Plataforma de automatización de flujo de trabajo de código justo con capacidades de IA nativas. Combine el edificio visual con código personalizado, auto-anfitrión o nube, más de 400 integraciones.

  • OffchainLabs
  • Implementación de la prueba de estaca Ethereum

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llM 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Resumen de los mejores recursos del mundo.

    Reviews

    5 (1)
    Avatar
    user_08BEPPmW
    2025-04-15

    As a dedicated user of the CodeLogic-MCP-Server, I am thoroughly impressed with its reliability and performance. The seamless integration and efficient code management make my tasks significantly easier. The intuitive interface and robust features have truly enhanced my productivity. Highly recommend for any engineering team!