AnyEvent-MCP

 view release on metacpan or  search on metacpan

bin/mcp-fs  view on Meta::CPAN


=item --exec-cmd SANDBOX-GRANT,...

Run command with specified sandbox grants, using current directory as
workdir; no MCP listener or permission rules. Supply command and arguments
after optional C<--> delimiter. Without command, run C<$SHELL> or C</bin/sh>.
C<--sandbox none> runs with normal host-user privileges.
Example: C<mcp-fs --exec-cmd workdir-read -- ls>.
C<--exec-cmd> is local-only; it cannot be combined with C<--host>.

=item --ask MODE

Permission prompts: C<helper> (default), C<tty>, C<yad>, C<mcp>, C<auto>,
or C<none>.
Local helper keeps decisions local; tty/yad force interface without fallback.
C<mcp> asks client; C<auto> prefers client elicitation when advertised,
otherwise local helper. C<none> denies unmatched permission requests without
prompting. Overrides C<PERL_ANYEVENT_MCP_PERMISSION_ASK>.

=item -h, --host HOST

Run filesystem operations on HOST instead of the local machine. Empty or
omitted HOST selects local operation. All workdirs belong to this one host.
Remote workdir paths must be absolute. Host identity qualifies permission
scopes, not workdir IDs, which use logical pathnames without following symlinks.

=item -e, --rsh COMMAND

Remote shell command, default C<ssh>. Like rsync's C<-e>, COMMAND may include
arguments. Only used with C<--host>; C<rsh> is also supported.
The command is split into arguments locally without a local shell. The
remote shell invokes a short Perl loader. The launcher source is transferred
over stdin, followed by length-prefixed binary startup frames; subsequent
worker input remains on the same stream.
The loader writes a magic PID line before replacing itself with the worker;
this line is consumed before the worker's ordinary stdout.

=item --sandbox MODE

Worker sandbox mode: C<bwrap> (default), C<auto>, C<none>.
C<bwrap> requires working bubblewrap. C<auto> uses bubblewrap if installed,
otherwise runs unsandboxed; failing bubblewrap does not silently fall back.
C<none> runs with full host-user privileges. Unsandboxed workers require
approval for maximum authority (world-write, host-network, shared-tmp, host-proc)
even for reads; narrower grants cannot authorize them. Startup warns.

=item --exec-prefix COMMAND

Run workers and their executable probe through COMMAND, split into argv with
shell-style quoting. No additional shell is used locally. For example,
C<--exec-prefix 'doas -n'> can read protected files on a machine using doas
instead of sudo. Remote execution uses the existing SSH command shell and
places the prefix before the remote Perl launcher. A failed prefix never
falls back to the original credentials.

=item --sudo[=USER]

Shortcut for C<--exec-prefix 'sudo -n'>, optionally adding C<-u USER>.
Overrides C<--exec-prefix>. For example, C<--sudo> with
C<--host user@host> works when SSH must log in as an unprivileged account
but passwordless sudo is permitted. C<--sudo=mail> runs as the mail user.
Sudo must work noninteractively; no password or terminal is supplied.

=item --host-dac

Keep the host user namespace and retain C<CAP_DAC_OVERRIDE> inside
bubblewrap. For example, a root worker can inspect a 0700 directory owned
by another user within a granted workdir. Other capabilities are dropped;
the existing mount and MCP permission restrictions still apply. Requires
root when bubblewrap is in use; ignored when running unsandboxed, where
the worker already has its host privileges.

=item --bwrap PATH

Use specified bubblewrap executable. Default: C<bwrap> found in C<PATH>.
Relevant with C<--sandbox bwrap> or C<--sandbox auto>.

=back

=head2 Shared-option behavior

=over

=item --name NAME

Also selects permission profile C<fs-NAME> and its rule file,
C<rules/fs-NAME.ini>. Default instance name: C<default>.

=item --print-url[=USER]

Does not require a WORKDIR argument.

=item --tool-help

Requires normal WORKDIR arguments, since available tools depend on the
selected workdirs and installed utilities.

=item --auto-allow TOOL[,ACTION[,CAPABILITY]]

For example, combining C<--auto-allow '*,inspect,workdir-read'> with
C<--auto-allow '*,read,workdir-read'> approves only those two actions
within read-only workdir authority. C<--auto-allow '*,*,workdir-write'>
approves any action requiring at most workdir-write authority,
including reads. C<--auto-allow '*,*,workdir-write+shared-tmp'>
additionally covers requests combining workdir access and host temporary
directory access, but not unrelated grants such as host-network.

=back

Rules reside in C<$XDG_CONFIG_HOME/anyevent-mcp/rules/fs-NAME.ini>,
or the corresponding C<$HOME/.config> path. The rules filename shares the
service-instance name but has an C<fs> namespace. The default instance uses
C<rules/fs-default.ini>. The rules path is printed on stderr when starting
HTTP; normal startup leaves stdout untouched.
Local and remote instances with the same C<--name> intentionally share
the same rule profile. Permission requests include a host dimension: C<local>
for local execution, or C<remote HOST> using C<--host> independently of
C<--rsh>. New persistent rules default to this host, but may match all hosts.
The workdir matcher is simply the logical path, independent of host. Existing
rules lacking C<match.host> continue to apply across local and remote hosts;
only newly saved host-specific rules restrict this.
Use different instance names or C<match.host> to separate approvals for



( run in 2.139 seconds using v1.01-cache-2.11-cpan-f5f21f1076c )