Skip to main content
Glama
mhingston

shell-mcp

by mhingston

shell-mcp

A deliberately small MCP server that exposes a single tool, run_shell, for executing arbitrary shell commands over Streamable HTTP.

It uses the stable v2 Model Context Protocol TypeScript SDK (@modelcontextprotocol/server and @modelcontextprotocol/node) and runs on Node.js 20+.

WARNING

run_shell has the same operating-system permissions as the shell-mcp process. Treat access to this server as equivalent to shell access. The default bind address is loopback-only. A bearer token is required if you bind to a non-loopback address.

Tool

run_shell

Input

Required

Description

command

yes

Command string to execute.

shell

no

Shell executable/path, e.g. bash, sh, zsh, pwsh, powershell.exe, or cmd.exe. Defaults to the platform shell.

cwd

no

Working directory. Defaults to the server process working directory.

env

no

Environment variables to add or override for the command.

timeoutMs

no

Command timeout in milliseconds. Defaults to 30 seconds.

The result includes stdout, stderr, exit code, terminating signal, duration, timeout state, and whether the output limit was exceeded.

Related MCP server: mcp2term

Run

npm install
npm run build
npm start

The MCP endpoint defaults to:

http://127.0.0.1:3000/mcp

For development:

npm run dev

Configuration

Environment variable

Default

Purpose

HOST

127.0.0.1

HTTP listen address.

PORT

3000

HTTP listen port.

SHELL_MCP_TOKEN

unset

Optional bearer token on loopback; required for non-loopback binds.

SHELL_MCP_DEFAULT_TIMEOUT_MS

30000

Default command timeout.

SHELL_MCP_MAX_TIMEOUT_MS

600000

Maximum timeout accepted by the tool.

SHELL_MCP_MAX_OUTPUT_BYTES

1048576

Maximum combined stdout/stderr retained before the command is terminated.

Example network bind:

HOST=0.0.0.0 \
SHELL_MCP_TOKEN='use-a-long-random-secret' \
npm start

Configure the MCP client to send:

Authorization: Bearer use-a-long-random-secret

For anything beyond a trusted local network, put the endpoint behind TLS and an authenticated reverse proxy rather than exposing the Node process directly.

Examples

Bash:

{
  "command": "uname -a && pwd",
  "shell": "bash"
}

PowerShell:

{
  "command": "Get-ChildItem Env: | Select-Object -First 5",
  "shell": "pwsh"
}

Development

npm run check

Design

  • One MCP tool; no resources or prompts.

  • Streamable HTTP only; no stdio transport.

  • Stateless MCP handler with a fresh McpServer per request, following the v2 SDK serving model.

  • Explicit shell invocation for POSIX shells, PowerShell, and cmd.exe.

  • Process-tree termination on timeout or output overflow.

  • Loopback binding by default, with bearer authentication required for non-loopback binds.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessSyncing

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

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Execute terminal commands locally or remotely via SSH with session persistence and environment variable support. Manage terminal sessions that maintain state for up to 20 minutes, enabling efficient command execution workflows. Connect using stdio or SSE for flexible integration with AI models and a
    1
    2
    MIT
  • F
    license
    B
    quality
    D
    maintenance
    Enables 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
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides tools for executing shell commands both synchronously and asynchronously with real-time output streaming and process management capabilities. It enables users to start background tasks, monitor progress, and manage long-running processes via Stdio or HTTP transports.
    225
    MIT

Latest Blog Posts

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/mhingston/shell-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server