exec-mcp
Enables executing a single bounded remote shell command on a configured host, returning truncated stdout/stderr tails and an authoritative exec summary.
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 /healthzGET /metricsPOST /execwithAccept: text/event-streamfor SSE event streamingPOST /mcpfor 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 -con 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_CWDis used.timeout_seconds: maximum runtime. Values aboveMAX_TIMEOUT_SECONDSare rejected. On timeout, the server aborts the exec and sendsSIGTERM, thenSIGKILLafter 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.ENVandBASH_ENVare removed before spawning.
Output semantics:
- MCP
tools/callreturns final text, not live SSE events. - The final text contains bounded stdout/stderr tail content followed by
[exec summary]. [exec summary]is authoritative forexit,signal,duration_ms, byte counts,truncated, andtimed_out.- stderr output alone is not failure. Non-zero exit code, signal, or
timed_out=trueis 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_execswithactive,max,oldest_age_seconds, andstates. too_many_active_execsusually means real concurrency pressure, not necessarily a service fault.- v11 tracks active execs through
ExecRegistryand releases slots throughfinally, 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
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.