mcp-cli-exec MCP Server
This server allows you to execute command-line interface (CLI) commands with structured output and specific configurations.
Execute commands: Run single or multiple CLI commands sequentially with structured results (stdout, stderr, exit code, execution duration)
Configuration options: Specify working directory and set optional timeouts per command
Cross-platform support: Works on both Windows and Unix-like systems
Clean output: Automatically strips ANSI escape codes from stdout and stderr
Error handling: Provides graceful error management with structured error responses
Command isolation: Each command runs independently in the initially specified working directory
Enables running shell commands with structured output, including support for single commands, chained commands, or arrays of commands in specified working directories. Returns detailed execution results with stdout, stderr, exit codes, and execution duration.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-cli-exec MCP Serverlist files in my current directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-cli-exec MCP Server
A powerful CLI command execution MCP server that enables running shell commands with structured output. This package focuses specifically on command execution functionality, differentiating it from other MCP CLI tools.
Features
Tools
cli-exec-raw
Execute a raw CLI command and return structured output
Takes a command string and optional timeout (default: 5 minutes)
Returns detailed execution results including stdout, stderr, exit code
Handles errors gracefully with structured error responses
cli-exec
Execute one or more CLI commands in a specific working directory
Supports single commands, && chained commands, or array of commands
All commands execute in the specified working directory
Returns detailed results for each command:
Success/failure status
Exit code
stdout and stderr (ANSI codes stripped)
Execution duration
Working directory
Stops on first command failure
Optional timeout per command (default: 5 minutes)
Note: Due to execution context limitations, each command runs independently. Directory changes (cd) within commands do not affect subsequent commands. All commands execute in the initially specified working directory.
Output Format
Commands return structured results including:
Success/failure status
Exit code
stdout and stderr (with ANSI codes stripped)
Execution duration
Working directory
Detailed error information if applicable
Example Usage
cli-exec-raw
Simple command execution:
{
"command": "echo Hello World"
}With timeout:
{
"command": "long-running-script.sh",
"timeout": 300000
}cli-exec
Single command in specific directory:
{
"workingDirectory": "/path/to/project",
"commands": "npm install"
}Multiple commands (all run in the same working directory):
{
"workingDirectory": "C:\\project",
"commands": [
"dir /b",
"npm run build"
]
}Related MCP server: MCP Server
Installation
Optionally install from npm:
npm install -g mcp-cli-exec
# or with pnpm
pnpm add -g mcp-cli-execOr just use npx in your configuration
For Cline VSCode Extension
Add to %APPDATA%/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json:
{
"mcpServers": {
"mcp-cli-exec": {
"command": "npx",
"args": ["-y", "mcp-cli-exec"]
}
}
}For Claude Desktop
Add to the appropriate config file:
Windows: %APPDATA%/Claude/claude_desktop_config.json
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"mcp-cli-exec": {
"command": "npx",
"args": ["-y", "mcp-cli-exec"]
}
}
}Special Windows Configuration
If you encounter the ENOENT spawn npx issue on Windows, use this alternative configuration that specifies the full paths:
{
"mcpServers": {
"mcp-cli-exec": {
"command": "C:\\Users\\jim\\AppData\\Roaming\\nvm\\v22.1.0\\node.exe",
"args": [
"C:\\Users\\jim\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npx-cli.js",
"-y",
"mcp-cli-exec"
]
}
}
}Development
Install dependencies:
pnpm installBuild the server:
pnpm run buildFor development with auto-rebuild:
pnpm run watchDebugging
Since MCP servers communicate over stdio, debugging can be challenging. The MCP Inspector provides helpful debugging tools:
pnpm run inspectorThis will provide a URL to access the inspector in your browser, where you can:
View all MCP messages
Inspect request/response payloads
Test tools interactively
Monitor server state
Error Handling
The server includes comprehensive error handling:
Input validation for all tool parameters
Structured error responses
Command timeout handling
Working directory validation
ANSI code stripping for clean output
Technical Details
Built with TypeScript and the MCP SDK
Uses execa for reliable command execution
Default command timeout: 5 minutes
Supports Windows and Unix-like systems (use appropriate commands for your OS, e.g., 'dir' vs 'ls')
Executes commands sequentially, stopping on first failure
Each command runs independently in the specified working directory
Available Tools
2 toolscli-execC
Execute one or more CLI commands in a specific working directory
| Name | Required | Description | Default |
|---|---|---|---|
| commands | Yes | Commands to execute | |
| timeout | No | Optional timeout in milliseconds per command (default: 5 minutes) | |
| workingDirectory | Yes | Working directory to execute commands in |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but only states basic functionality. It doesn't disclose critical behavioral traits like execution safety (potential for destructive commands), authentication needs, error handling, output format, or rate limits. The mention of 'timeout' in the schema isn't reinforced in the description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every element ('Execute', 'CLI commands', 'specific working directory') earns its place, making it optimally concise.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a CLI execution tool with no annotations and no output schema, the description is insufficient. It lacks details on execution behavior (e.g., sequential vs. parallel), error propagation, security implications, or return values, leaving significant gaps for an agent to understand tool usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score of 3 for adequate coverage through structured data alone.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Execute') and resource ('CLI commands') with additional context about working directory. It distinguishes from sibling 'cli-exec-raw' by specifying 'in a specific working directory', though the distinction isn't fully explicit about what makes the sibling different.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus the sibling 'cli-exec-raw'. It mentions the working directory context but doesn't explain alternative scenarios, prerequisites, or exclusions for tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cli-exec-rawC
Execute a raw CLI command and return structured output
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | The CLI command to execute | |
| timeout | No | Optional timeout in milliseconds (default: 5 minutes) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool executes commands and returns structured output, but fails to address critical behavioral aspects such as security implications, execution environment, error handling, or potential side effects. This is inadequate for a tool that executes arbitrary CLI commands.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise and front-loaded in a single sentence that captures the core functionality. Every word earns its place with no wasted text, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of executing arbitrary CLI commands (which involves security, environment, and side-effect considerations), no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what 'structured output' means, execution constraints, or safety warnings, leaving significant gaps for agent understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with clear parameter descriptions in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as command syntax examples or timeout behavior details. Baseline 3 is appropriate when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Execute a raw CLI command and return structured output'. It specifies the verb ('execute'), resource ('raw CLI command'), and outcome ('return structured output'). However, it doesn't explicitly differentiate from its sibling 'cli-exec', which likely has similar functionality, preventing a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its sibling 'cli-exec' or other alternatives. It lacks context about appropriate use cases, prerequisites, or exclusions, leaving the agent with minimal direction beyond the basic purpose.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
2 tool updates
v1.0.0- First observed
cli-exec - First observed
cli-exec-raw
TDQS
The two tools have significant overlap in purpose, both executing CLI commands. While cli-exec-raw specifies 'raw' and 'structured output', the distinction is subtle and could easily lead to confusion about which to use for basic command execution. The descriptions don't clearly delineate when to choose one over the other.
Both tools follow a consistent cli-exec prefix pattern with hyphenated suffixes. The naming is predictable and readable, though the suffix conventions differ slightly (one has no suffix, the other uses '-raw'). This minor deviation keeps it from a perfect score.
With only 2 tools, the server feels thin for a CLI execution domain. While it covers basic execution, more operations like command validation, history tracking, or batch processing might be expected. The count is borderline minimal but functional for core tasks.
For a CLI execution server, there are notable gaps. Missing tools for command chaining, environment variable management, output parsing beyond 'structured', or error handling make the surface incomplete. Agents will hit dead ends when needing advanced CLI interactions beyond simple execution.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A paid remote MCP for CLI tool MCP, built to return verdicts, receipts, usage logs, and audit-ready
Remote shell and detached long-running jobs on your own machines — no SSH, open ports or VPN.
Execute code in 8 languages (Python, JS, TS, Go, Java, C++, C, Bash) in gVisor sandboxes.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows LLMs to execute shell commands and receive their output in a controlled manner.7MIT
- AlicenseNot gradedqualityDmaintenanceA cross-platform shell command execution server that supports Windows, macOS, and Linux environments with PowerShell, CMD, GitBash, and Bash shells, optimized for Japanese language environments.25MIT
- FlicenseBqualityDmaintenanceEnables safe execution of system shell commands with real-time streaming output and rich metadata capture. Provides configurable command execution with timeout controls, environment management, and extensible plugin architecture for monitoring command lifecycles.4-
- FlicenseBqualityDmaintenanceAn MCP server that enables users to execute arbitrary shell commands on their local machine and receive the output. It provides a terminal tool for running system commands through MCP-compatible clients using the Python SDK.1-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/jakenuts/mcp-cli-exec'
If you have feedback or need assistance with the MCP directory API, please join our Discord server