JUHE API Marketplace
andresthor avatar
MCP Server

Command-Line MCP Server

Allows AI assistants to safely execute common Unix/macOS terminal commands through a controlled interface with comprehensive security features.

9
GitHub Stars
5/25/2026
Last Updated
MCP Server Configuration
1{
2 "name": "cmd-line",
3 "command": "/path/to/venv/bin/cmd-line-mcp",
4 "args": [
5 "--config",
6 "/path/to/config.json"
7 ],
8 "env": {
9 "CMD_LINE_MCP_SECURITY_REQUIRE_SESSION_ID": "false",
10 "CMD_LINE_MCP_SECURITY_AUTO_APPROVE_DIRECTORIES_IN_DESKTOP_MODE": "true"
11 }
12}
JSON12 lines
  1. Home
  2. MCP Servers
  3. cmd-line-mcp

README Documentation

Command-Line MCP Server

PyPI version

An MCP server that lets AI assistants run terminal commands safely. Commands are categorized (read/write/system), directories are whitelisted, and dangerous patterns are blocked automatically.


Quick Start

pip install cmd-line-mcp

# Or from source
git clone https://github.com/andresthor/cmd-line-mcp.git
cd cmd-line-mcp
pip install -e .

Run the server:

cmd-line-mcp                        # default config
cmd-line-mcp --config config.json   # custom config

Claude Desktop Setup

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "cmd-line": {
      "command": "/path/to/venv/bin/cmd-line-mcp",
      "args": ["--config", "/path/to/config.json"],
      "env": {
        "CMD_LINE_MCP_SECURITY_REQUIRE_SESSION_ID": "false",
        "CMD_LINE_MCP_SECURITY_AUTO_APPROVE_DIRECTORIES_IN_DESKTOP_MODE": "true"
      }
    }
  }
}

Restart Claude Desktop after saving.

[!TIP] Set require_session_id: false to prevent approval loops in Claude Desktop.


How It Works

Commands go through a validation pipeline before execution:

  1. Pattern matching — blocks dangerous constructs (system(), shell escapes, etc.)
  2. Command classification — each command must be in the read, write, system, or blocked list
  3. Directory check — target directory must be whitelisted or session-approved
  4. Approval check — write/system commands require session approval

Pipes, semicolons, and & are supported — each segment is validated independently.

What's Allowed

CategoryCommandsApproval
Readls, cat, grep, find, head, tail, sort, wc, …Auto
Writecp, mv, rm, mkdir, touch, chmod, awk, sed, …Required
Systemps, ping, curl, ssh, xargs, …Required
Blockedsudo, bash, sh, python, eval, …Always denied

What's Blocked

Shells, scripting interpreters, and known command-execution vectors are blocked — including indirect execution through awk system(), sed /e, find -exec, tar --checkpoint-action, env, and xargs. See docs/SECURITY.md for the full list.


Configuration

The server works out of the box with sensible defaults. Customize via JSON config, environment variables, or .env files:

# Whitelist directories
export CMD_LINE_MCP_SECURITY_WHITELISTED_DIRECTORIES="/projects,/var/data"

# Add commands (merges with defaults)
export CMD_LINE_MCP_COMMANDS_READ="jq,rg"

See docs/CONFIGURATION.md for full configuration reference, MCP tool documentation, and directory security details.


License

MIT

Quick Install

Quick Actions

View on GitHubView All Servers

Key Features

Model Context Protocol
Secure Communication
Real-time Updates
Open Source

Boost your projects with Wisdom Gate LLM API

Supporting GPT-5, Claude-4, DeepSeek v3, Gemini and more.

Enjoy a free trial and save 20%+ compared to official pricing.

Learn More
JUHE API Marketplace

Accelerate development, innovate faster, and transform your business with our comprehensive API ecosystem.

JUHE API VS

  • vs. RapidAPI
  • vs. API Layer
  • API Platforms 2025
  • API Marketplaces 2025
  • Best Alternatives to RapidAPI

For Developers

  • Console
  • Collections
  • Documentation
  • MCP Servers
  • Free APIs
  • Temp Mail Demo

Product

  • Browse APIs
  • Suggest an API
  • Wisdom Gate LLM
  • Global SMS Messaging
  • Temp Mail API

Company

  • What's New
  • Welcome
  • About Us
  • Contact Support
  • Terms of Service
  • Privacy Policy
Featured on Startup FameFeatured on Twelve ToolsFazier badgeJuheAPI Marketplace - Connect smarter, beyond APIs | Product Huntai tools code.marketDang.aiFeatured on ShowMeBestAI
Copyright © 2026 JUHEDATA HK LIMITED - All rights reserved