Skip to main content
Glama
TMYTiMidlY

portal-mcp-server

by TMYTiMidlY

local_exec

Execute commands directly on the MCP server machine, with optional sudo and credential injection via named secrets. Requires explicit enablement and a timeout.

Instructions

Run a command on the MCP SERVER's OWN machine (local), NOT over SSH — for anything on a remote host use remote_exec instead. This departs from the project's core goal (driving remote hosts as if local); it's a useful but off-target derivative, so it is OFF by default: the operator must explicitly set PORTAL_ALLOW_LOCAL_EXEC=1 in the server process's env to enable it.

★ credentials: if the command needs a secret, don't have the user paste it into the chat — they run portal secret set <name> in their own terminal; you pass secrets=[""] and reference it as the uppercased env var ($NAME), injected into the local child's env and redacted from output. This lets a local script use an API token without the value ever entering this conversation.

★ use_sudo: run the command under sudo on THIS machine (local_exec). The sudo password is resolved out-of-band (NEVER an argument): the per-user credential agent populated by portal sudo set-local, or a top-level <local>: section's sudo_password_command in hosts.yaml. Fed to sudo -S -k on stdin (never on argv/audit). May be combined with secrets (their values ride the same stdin channel, read+exported inside the sudo'd shell). This is the LOCAL counterpart of remote_exec(use_sudo=True); the reserved identity <local> is distinct from any SSH host named local / localhost.

timeout (seconds, REQUIRED — no default): held open until the command exits or timeout elapses. Keepalive pings stop the client aborting a hung call, so pass a SMALL one for an exploratory / re-runnable command (e.g. 10–30) to fail fast, raising it only for a genuinely slow but bounded command. Hard ceiling (PORTAL_MAX_TIMEOUT, default 300s): a request above it is refused — local_exec has no background runner, so split the work into shorter steps.

★ secrets flags the result "high_risk": briefly tell the user you ran a local command with their stored credential, or only do so with prior permission.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
secretsNo
timeoutYes
use_sudoNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries full burden. It covers credentials, sudo, timeout behavior, keepalive pings, and risk flagging. However, it does not explicitly describe the return format or output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is lengthy but well-structured with bullet points and sections. It front-loads the purpose. While verbose, the complexity of the tool justifies the detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters, no annotations, and existing output schema, the description covers all necessary aspects: usage, parameters, behavior, and safety. It is complete enough for an agent to select and invoke correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description adds rich semantics for all 4 parameters: command, secrets (redacted env vars), timeout (required, no default, ceiling), and use_sudo (out-of-band password). Provides clear usage details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool runs a command on the MCP server's own machine, distinguishing it from remote_exec. The verb 'run a command' and resource 'local machine' are specific and accurate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use (local commands) and when not (remote, use remote_exec). Also explains it is off by default and requires an environment variable. Provides guidance on secrets and sudo usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/TMYTiMidlY/portal-mcp-server'

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