exec-mcp

exec-mcp

Enables executing a single bounded remote shell command on a configured host, returning truncated stdout/stderr tails and an authoritative exec summary.

Category
Visit Server

README

exec-mcp

A dependency-free Node.js implementation for a bounded remote exec MCP gateway.

It intentionally exposes one capability: run a single bounded remote shell command and return a capped result with stdout/stderr tails plus an authoritative exec summary. It is not a GitOps API, not a Kubernetes API, and not a file-management API. Higher-level tools such as kubectl, git, docker, helm, argocd, and flux are left to the remote shell.

Current interface

  • GET /healthz
  • GET /metrics
  • POST /exec with Accept: text/event-stream for SSE event streaming
  • POST /mcp for MCP Streamable HTTP / JSON-RPC tool calls

The MCP server exposes exactly one tool:

exec

The tool executes one command on the configured remote execution host. In the current dev deployment, the ssh-mcp connector runs commands on dev-debian through SSH.

MCP tool contract

Request arguments:

{
  "command": "kubectl get pods -A",
  "cwd": "/root/config-git",
  "timeout_seconds": 120,
  "max_output_bytes": 5242880,
  "env": {
    "NO_COLOR": "1"
  }
}

Field semantics:

  • command: command string run through /bin/sh -c on the configured remote execution host. Use explicit quoting for pipelines, redirection, &&, and variable expansion. Avoid interactive or unbounded long-running commands.
  • cwd: working directory on the remote execution host. It must be under the configured allowlist. If omitted, DEFAULT_CWD is used.
  • timeout_seconds: maximum runtime. Values above MAX_TIMEOUT_SECONDS are rejected. On timeout, the server aborts the exec and sends SIGTERM, then SIGKILL after the configured kill grace period.
  • max_output_bytes: maximum combined stdout/stderr bytes forwarded before truncation. The process is still drained until exit. Final byte counts and bounded tails are included in the summary.
  • env: additional environment variables. Invalid variable names are ignored. ENV and BASH_ENV are removed before spawning.

Output semantics:

  • MCP tools/call returns final text, not live SSE events.
  • The final text contains bounded stdout/stderr tail content followed by [exec summary].
  • [exec summary] is authoritative for exit, signal, duration_ms, byte counts, truncated, and timed_out.
  • stderr output alone is not failure. Non-zero exit code, signal, or timed_out=true is failure.
  • Output may be truncated. Do not assume the returned text is the full command output.

Concurrency semantics:

  • Active execs are bounded by MAX_CONCURRENT_EXECS.
  • When full, the tool returns too_many_active_execs with active, max, oldest_age_seconds, and states.
  • too_many_active_execs usually means real concurrency pressure, not necessarily a service fault.
  • v11 tracks active execs through ExecRegistry and releases slots through finally, timeout abort, client-close abort, and a reaper fallback.

Cancellation boundary:

  • The current connected request can be aborted by client close/disconnect.
  • There is no cancel-by-exec-id API in v11.
  • v11 protects local active-slot bookkeeping; it does not provide full remote process lifecycle governance.

Commands

npm test
npm run build
npm run validate
npm start

Validation status

Current local validation:

node --test: 32 tests, 32 pass
npm run build: pass
npm run validate: pass

Memory smoke writes 5 MB from a child process while forwarding only 1 KiB plus summary/tail metadata. The gateway drains child output and keeps only bounded tails in memory.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured