Skip to main content
Glama
amazon-quick-exec-mcp

amazon-quick-exec-mcp

by mlzoo

amazon-quick-exec-mcp — a real shell for Amazon Quick

中文

Amazon Quick's built-in agent tools (run_python, ripgrep, and friends) execute inside quickwork-sandbox: they cannot reach localhost and cannot see most of your filesystem. Local MCP servers are different — Quick launches them as ordinary child processes of the desktop app, outside that sandbox.

So this server runs commands on the real machine, as you. Sync execution, background jobs, process-tree cleanup, an audit log, and a narrow guard against the handful of commands nobody means to run.

Commands go through a login shell (zsh -lc), so PATH matches Terminal. That matters more than it sounds: anything installed under ~/.local/bin, ~/.toolbox/bin, or by a version manager only exists once the profile is sourced.

Install

git clone <this repo> && cd quick-exec-mcp

uv sync                                # create the venv
./.venv/bin/python test_exec_mcp.py    # 70 checks over real MCP stdio
python install.py install              # register with Quick

Then in Quick: Settings → Capabilities → Connectors → Local Shell (exec) → Refresh. Ask it call shell_info as a first message — it reports the user, host and PATH your commands actually get, which is how you confirm you are outside the sandbox.

Requires Python 3.10+ and uv. install.py is stdlib-only, so it runs with any python3.

python install.py status       what Quick currently has registered
python install.py install      add this server, enabled
python install.py disable      keep the entry, turn it off
python install.py enable       turn it back on
python install.py uninstall    remove the entry

It edits the active profile's mcp_config.json — the same file the Connectors UI writes — and backs it up to mcp_config.json.bak before every write. A reinstall preserves secret:// references and any env you set by hand. See docs/how-quick-loads-mcp.md for the file layout, the schema, and the gotchas that cost the most time.

Related MCP server: permission-aware-mcp

Tools

Tool

What it does

shell_execute

Run and wait. Returns exit_code, stdout, stderr, duration_s, timed_out

shell_start

Run in the background, returns a job_id. For builds, installs, dev servers

shell_job_output

Snapshot of a job's output so far. Safe to call repeatedly

shell_job_wait

Block until a job exits, then return its output. Beats polling

shell_job_kill

Kill a job and its whole process tree

shell_list_jobs

Every job started this session, running and finished

shell_info

Configuration plus a live whoami / hostname / PATH probe

shell_execute takes cwd (defaults to $HOME, ~ expands), timeout (default 120s), stdin, and env (merged over the inherited environment).

Configuration

Set these in the env block of the exec entry in Quick's mcp_config.json.

Variable

Default

Meaning

QUICK_EXEC_SHELL

/bin/zsh

Which shell to use

QUICK_EXEC_SHELL_ARGS

-lc

-l sources the profile; drop it to skip that

QUICK_EXEC_DEFAULT_CWD

$HOME

Working directory when cwd is omitted

QUICK_EXEC_DEFAULT_TIMEOUT

120

Default timeout, seconds

QUICK_EXEC_MAX_TIMEOUT

3600

Ceiling on the timeout argument

QUICK_EXEC_MAX_BYTES

60000

Per-stream output cap, roughly 15k tokens

QUICK_EXEC_READER_GRACE

2

Seconds to keep draining the pipes after the child exits

QUICK_EXEC_MAX_FINISHED_JOBS

50

Finished jobs retained before the oldest are dropped

QUICK_EXEC_AUDIT_LOG

~/.quick-exec-mcp/audit.jsonl

Audit log path

QUICK_EXEC_LOG_LEVEL

WARNING

INFO logs every call to stderr

QUICK_EXEC_ALLOW_DANGEROUS

unset

1 turns the command guard off

Audit log

Every command appends one JSON line to ~/.quick-exec-mcp/audit.jsonl — time, command, cwd, exit code, duration — and refusals are logged too. This is how you find out what Quick actually ran on your machine.

tail -20 ~/.quick-exec-mcp/audit.jsonl | jq -c '[.ts, .kind, .exit_code, .command]'

Command guard

Refused by default (QUICK_EXEC_ALLOW_DANGEROUS=1 disables it):

  • recursive delete of /, $HOME, /System, /Applications, /usr, and peers

  • mkfs*, diskutil eraseDisk/reformat/partitionDisk, dd of=/dev/disk*

  • fork bombs

  • shutdown / reboot / halt in command position

  • csrutil disable, spctl --master-disable (turning off SIP / Gatekeeper)

Patterns are matched against the command both verbatim and with quotes stripped, because rm -rf "$HOME" is how a model writes that as often as not. They stay deliberately narrow, so ordinary work goes through: rm -rf on a specific directory is allowed, rm -rf "$HOME/project" is allowed, and so is grep shutdown /etc/hosts — shutdown there is an argument, not a command.

This guards against a model slipping, not against malice. It is pattern matching, so any indirection ($(echo rm) -rf /) defeats it, and anyone who can reach this server can already run anything you can.

Behaviour worth knowing

  • Timeouts kill the whole process tree. Children run in their own process group (start_new_session=True); on timeout the group gets SIGTERM then SIGKILL, so a timed-out npm install leaves no orphans. Output produced before the timeout is kept, with timed_out: true.

  • timeout is a real bound, even against a process that escapes. Anything that calls setsid — a daemon, mostly — leaves the process group, survives the kill, and keeps the inherited stdout pipe open. Waiting for end-of-file on that pipe would hang the call forever and make the connector look dead, so the drain gets its own QUICK_EXEC_READER_GRACE budget and the reply comes back with output_incomplete: true. Expect roughly timeout + 5s in that case: SIGTERM, the escalation to SIGKILL, then the grace period.

  • timeout: 0 or a negative value means "use the default", not "give up immediately".

  • Truncation keeps the head and the tail. Over the cap, the first third and last two thirds survive with a note about how many bytes went missing in between. A failing build puts the useful part at the end; keeping only the head would discard exactly what you need.

  • stdout and stderr come back separately, never interleaved.

  • Interactive pagers are disabled via PAGER=cat, GIT_PAGER=cat, TERM=dumb, NO_COLOR=1, so git log cannot hang in less or return a wall of ANSI escapes. Override any of them through env.

Tests

./.venv/bin/python test_exec_mcp.py

70 checks driving the server over real MCP stdio — initialize, tools/list, tools/call, the whole JSON-RPC exchange Quick makes — rather than importing the module and calling functions. Tools that look fine in Python and break over the wire are exactly the failure this catches. Covered: handshake, tool schemas, login-shell PATH (compared against an actual zsh -lc), stream separation, stdin, env overrides, invalid UTF-8, timeout with orphan detection via pgrep, an orphan that escapes the process group entirely, head-and-tail truncation, background job lifecycle, job pruning, and the audit log.

The destructive guard cases — rm -rf "$HOME" and friends — are asserted against _guard() in-process, so they are never handed to a shell. A suite that sends them to a live server and trusts a regex to stop them is one bad regex away from deleting the home directory of whoever ran it. The one case that does go over the wire runs with HOME pointed at a throwaway directory and then asserts that directory is still intact, so a future regression destroys a temp dir instead.

Security

This gives Quick full shell access as your user — read and write any file you can, read credential files, call the AWS CLI, push code, make network requests. Bypassing the sandbox is the point of it, not a bug.

  • Leave Quick's global_default tool permission on prompt so calls are confirmed before they run.

  • Read ~/.quick-exec-mcp/audit.jsonl now and then.

  • Do not register this on a machine or client you do not trust.

  • Keep credentials out of the config file; Quick's secret store (secret://) exists for that, and a reinstall preserves those references.

License

MIT — see LICENSE.

Available Tools

7 tools
shell_executeA

Run a shell command on this Mac and wait for it to finish.

Runs through a login shell, so pipes, globs, redirects, &&, $VARS, heredocs and shell functions all work — pass the command exactly as you would type it in Terminal. Use this for anything that finishes within the timeout.

For work that outlives the timeout (builds, installs, dev servers) use shell_start instead.

Args: command: Shell command line, e.g. "ls -la ~/Documents | head -20". cwd: Working directory. Defaults to the user's home. ~ is expanded. timeout: Seconds before the process tree is killed. Default 120, max 3600. Zero or negative means "use the default", not "give up immediately". stdin: Text piped to the command's stdin. env: Extra environment variables, merged over the inherited environment.

Returns: exit_code, stdout, stderr, duration_s, cwd, timed_out, and stdout_truncated / stderr_truncated flags.

Inputs: command (required), cwd, env, stdin, +1 more.

shell_infoA

Report how this server is configured and what environment commands see.

Worth calling first in a session: it proves the server is running on the real host as the real user rather than inside Quick's sandbox.

Inputs: no named parameters.

shell_job_killA

Kill a background job and its whole process tree.

Args: job_id: Id returned by shell_start.

Inputs: job_id (required).

shell_job_outputA

Read the output captured so far from a background job.

Safe to call repeatedly while the job runs — it returns a snapshot and does not consume the buffer.

Args: job_id: Id returned by shell_start. tail_lines: Return only the last N lines of each stream. 0 means all.

Returns: running, exit_code (null while running), stdout, stderr, elapsed_s.

Inputs: job_id (required), tail_lines.

shell_job_waitA

Block until a background job exits, then return its output.

Cheaper and more reliable than polling shell_job_output in a loop. If the timeout expires the job keeps running and running comes back true — call again or kill it.

Args: job_id: Id returned by shell_start. timeout: Max seconds to wait. The job is NOT killed on timeout. tail_lines: Return only the last N lines of each stream. 0 means all.

Inputs: job_id (required), timeout, tail_lines.

shell_list_jobsB

List background jobs started this session, running and finished.

Inputs: no named parameters.

shell_startA

Start a long-running command in the background and return a job id.

Output is buffered as it arrives; read it with shell_job_output, block on it with shell_job_wait, stop it with shell_job_kill. Use this for builds, installs, test suites and dev servers that would blow shell_execute's timeout.

Args: command: Shell command line. cwd: Working directory. Defaults to the user's home. env: Extra environment variables.

Returns: job_id, pid, command, cwd.

Inputs: command (required), cwd, env.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool owns a distinct slice of the shell workflow: shell_execute for synchronous commands vs shell_start for background jobs, and the job lifecycle tools (list/output/wait/kill) are clearly separated from each other and from shell_info. Descriptions explicitly cross-reference when to use which (e.g. timeout overflow -> shell_start), leaving no realistic misselection.

    Naming Consistency5/5

    Every tool uses snake_case with a consistent shell_ prefix, and the shell_job_* family groups the background-job operations predictably (start, list, output, wait, kill). No mixed conventions or vague verbs.

    Tool Count5/5

    Seven tools is well-scoped for a shell-execution server: one synchronous path, one background-job lifecycle, plus a configuration probe. No tool feels redundant or padding.

    Completeness4/5

    The surface covers synchronous execution, the full background lifecycle (start, snapshot output, block, list, kill), and environment introspection — a complete operational loop. The only minor gap is no way to write new stdin to an already-running job, which agents can work around by designing the initial command.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Enables secure file system operations (read, write, delete) and simulated command execution with server-enforced permission policies, risk assessment, and human-in-the-loop approval.
      5
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to execute shell commands on a host macOS computer with configurable file access permissions, granting access to credentials and tools while enforcing sandbox restrictions.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables running shell commands on hosts where OS-level sandboxing is unavailable, with policy checks that block obviously destructive operations and protected-path writes, plus an append-only audit trail.
      MIT