mcp-shell-execute
v1.0.0
Published
MCP Shell Command Execution Server
Downloads
80
Maintainers
Readme
MCP Shell Execute
A Model Context Protocol (MCP) capability for executing shell commands.
Installation
npm install mcp-shell-execute
Usage
In your MCP configuration
Add the shell execute capability to your MCP configuration:
{
"capabilities": {
"shell": {
"provider": "mcp-shell-execute"
}
}
}
API
The shell execute capability provides one method:
execute.command
Executes a shell command and returns its output.
Parameters:
command
(string, required): The command to executetimeout
(number, optional): Timeout in milliseconds (default: 60000)
Returns:
stdout
(string): Standard output from the commandstderr
(string): Standard error from the commandexitCode
(number): Exit code from the command (0 for success)
Example:
// Request
{
"method": "execute.command",
"params": {
"command": "echo 'Hello, World!'",
"timeout": 5000
}
}
// Response
{
"stdout": "Hello, World!\n",
"stderr": "",
"exitCode": 0
}
Development
- Install dependencies:
npm install
- Build:
npm run build
- Run in development mode:
npm run dev
Security Considerations
This capability executes shell commands on the host system. Make sure to:
- Validate and sanitize input commands
- Run with appropriate permissions
- Consider using a restricted shell or command whitelist for production use