ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MCP/lib/AnyEvent/MCP/Intro.pod
Revision: 1.25
Committed: Wed Oct 28 10:39:53 2026 UTC (35 hours, 39 minutes ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.24: +4 -4 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3 root 1.5 AnyEvent::MCP::Intro - using MCP servers, clients and permissions
4 root 1.1
5     =head1 DESCRIPTION
6    
7 root 1.5 You can use the servers in this distribution without writing any Perl.
8     This walkthrough starts with one filesystem server, connects it to an MCP
9     client, and makes a useful request. Once that works, it explains persistent
10     configuration, permissions and combining several servers.
11 root 1.1
12 root 1.5 If you want to write a small server yourself, continue with
13     L<AnyEvent::MCP::Server::Simple/TUTORIAL>. Applications needing their own
14     connection management or dispatch can use the modules described in
15     L<AnyEvent::MCP/MODULES>.
16 root 1.1
17 root 1.5 The examples use C</home/alice/src/project> as an existing project directory.
18     Replace it with your own absolute path. Commands shown here are commands
19     for you to run; requests addressed to the LLM are shown separately.
20    
21     =head1 INSTALLATION
22    
23     Install the Perl distribution and the external programs used by the
24     servers. Installing one does not install the other.
25    
26     For mcp-fs, install Linux bubblewrap and the filesystem utilities. On
27     Debian or Ubuntu, for example:
28    
29     sudo apt install bubblewrap findutils grep patch sed perl yad
30    
31     C<yad> is optional: it supplies graphical permission dialogs.
32     Without a usable YAD dialog, the helper tries C</dev/tty>; if neither is
33     available, it denies the request. Bubblewrap's executable is C<bwrap>.
34     The machine must allow the unprivileged user namespaces it needs.
35    
36     mcp-fs detects its utilities at startup and omits tools whose utilities
37     are unavailable or unsuitable. It requires bubblewrap by default.
38     See L<mcp-fs/TRUSTED CONFIGURATION> for explicit utility paths and
39     L<mcp-fs/LIMITATIONS> for the sandbox's limits.
40    
41     If you have an unpacked distribution or source checkout, run these commands
42     in its top-level directory:
43    
44     perl Makefile.PL
45     make
46     make test
47     make install
48    
49     C<perl Makefile.PL> reports missing Perl dependencies. Install those with
50     your usual package manager or CPAN client before continuing. For example,
51     the main non-core dependencies can be installed with:
52    
53 root 1.24 cpan AnyEvent AnyEvent::HTTP common::sense JSON::XS
54    
55     C<mcp-webbrowser> requires C<AnyEvent::WebSocket::Server> and
56     C<AnyEvent::WebSocket::Message>. C<mcp-vim> needs them only for browser
57     connections, not for ordinary Vim clients. Both modules are recommended
58     rather than required by the distribution.
59 root 1.5
60     Use the same Perl installation for dependency installation, building and
61     running the servers. A module installed for the system Perl might not be
62     available to a Perl installed under C</opt>. C<make install> needs write
63     access to the selected Perl's installation directories; use an appropriate
64     local Perl installation or run that final step with the required privileges.
65    
66 root 1.15 Installation puts C<mcp-fs>, C<mcp-multibroker>, C<mcp-vim>, C<mcp-webbrowser>,
67 root 1.5 C<mcp-ask-user>, C<anyevent-mcp> and C<anyevent-mcp-askpermission> in the
68     selected executable directory. Make that directory available in the
69     environment of your MCP client, or configure absolute executable paths.
70     A desktop application need not have the same C<PATH> as your shell.
71    
72     To try an uninstalled source tree after installing its dependencies, you
73     can run a program with the source library path:
74    
75     perl -Ilib bin/mcp-fs --stdio --name code /home/alice/src/project
76    
77     Do this from the distribution directory. When configuring a client to
78     start such a command, account for the client's working directory or use
79     absolute paths to Perl, C<lib> and the script. An installed executable
80     avoids that extra setup.
81    
82 root 1.19 =head1 PICK A SERVER
83 root 1.15
84 root 1.19 For a local MCP client, configure it to launch the server that provides
85     the tools you want:
86 root 1.15
87 root 1.19 mcp-fs --stdio /home/alice/src/project
88     mcp-vim --stdio
89 root 1.15 mcp-webbrowser --stdio
90 root 1.19 mcp-ask-user --stdio
91    
92     C<--stdio> means the MCP client launches the process. Do not start a
93     separate copy in a terminal. For HTTP clients, use a running server and
94     its C<--print-url> instead, as explained below.
95    
96     C<mcp-fs> reads, searches and changes files and runs commands in a sandbox.
97     The first walkthrough below uses this server.
98    
99     C<mcp-vim> reads and edits live Vim buffers. Install the companion Vim plugin
100     and connect the editor to its listener; see L</Add a live Vim editor> and
101     L<mcp-vim/VIM PLUGIN INSTALLATION>.
102 root 1.15
103 root 1.19 C<mcp-webbrowser> works with explicitly approved browser tabs. Install
104     its companion userscript and connect each tab you want to expose; see
105     L</CONNECTED BROWSER PAGES>.
106 root 1.16
107 root 1.19 C<mcp-ask-user> lets the assistant ask you questions through a local
108     YAD or terminal dialog, or through the client's native form UI; see
109     L</Ask the client's human a question>.
110 root 1.15
111 root 1.20 To offer several servers over one MCP connection, use C<mcp-multibroker>.
112     It combines these servers with each other or with third-party MCP servers,
113     whether started locally over stdio or reached over HTTP. Their tools
114     appear under separate name prefixes; see L</COMBINING SERVERS> and
115     L<mcp-multibroker> for the full command syntax.
116 root 1.15
117 root 1.5 =head1 YOUR FIRST FILESYSTEM SERVER
118    
119     Start with one project and one connection. You do not need a multibroker,
120     a hand-written configuration file or saved permission rules yet.
121    
122     =head2 Choose stdio or HTTP
123    
124     Use B<stdio> when your MCP client runs on the same machine and can launch
125     a server process. Configure the client to start the following command:
126    
127     mcp-fs --stdio --name code /home/alice/src/project
128    
129     The client starts this process and uses its stdin/stdout for MCP.
130     You do not start a second copy in a terminal, and there is no listener
131     URL or HTTP token to configure. Diagnostics go to stderr.
132    
133     Clients that take a command and an argument array need these values:
134    
135     command: mcp-fs
136     arguments: --stdio, --name, code, /home/alice/src/project
137    
138     These describe separate arguments, not one shell command string.
139     Use an absolute executable path if the client cannot find C<mcp-fs>.
140     See L</CLIENT EXAMPLES> for examples of particular clients.
141    
142     Use B<HTTP> when the client connects to an already-running server, or when
143     it cannot launch a local process. Start this in a terminal on the server
144     machine and leave it running:
145    
146     mcp-fs --name code --bind :31741 /home/alice/src/project
147    
148     In another terminal, obtain the matching connection URL:
149    
150     mcp-fs --name code --bind :31741 --print-url
151    
152     The second command prints a credential-bearing URL and exits without
153     opening a listener. Configure that URL in the client. The default address
154     is IPv4 loopback, so this example is reachable from the same machine only.
155     A hosted client needs a suitable tunnel or reachable endpoint; its own
156     C<localhost> is not your computer.
157    
158     Repeat the same name and listener overrides when printing the URL.
159     Both commands must use the same user and configuration directory.
160     Port zero chooses an ephemeral port, which C<--print-url> cannot predict;
161     use an explicit port for this walkthrough.
162    
163     The HTTP server generates and saves its private master secret when needed.
164     You can initialize it explicitly with C<anyevent-mcp init>, but that
165     command is unnecessary when configuration already exists and will refuse
166     to replace it. Keep the printed URL private: possession of its token
167     authenticates a client.
168    
169     =head2 Make a useful request
170    
171     Once your client reports that the server is connected, ask the LLM:
172    
173     Show me the configured workdirs. List the top-level files in the
174 root 1.19 project, then read its README if it has one. Do not modify files
175     or run commands.
176 root 1.5
177     C<workdirs> returns the configured paths, sandbox grants, trusted mounts
178     and runtime paths. Listing names requests C<inspect> permission; reading
179     contents requests C<read> permission. Expect a permission prompt when
180     there is no saved rule allowing the operation.
181    
182     Choose C<Allow once> for the first operation. The worker then runs with
183     the requested sandbox grants. A denial is a tool failure that the LLM
184     should report, rather than an empty file or a disconnected server.
185    
186     For a slightly larger task, ask:
187    
188     Find TODO comments in this project and explain the three that look
189     most useful to address next. Do not modify files or run commands.
190    
191     This can use C<find>, C<grep> and C<read-lines>. You need not write MCP
192     requests yourself. If a client offers its own tool-approval prompt, that
193     is an additional client policy; it does not replace mcp-fs's permissions.
194    
195 root 1.19 =head2 Give the server a purpose
196    
197     To explain why an instance exists, provide a short purpose:
198    
199     mcp-fs --stdio --name memory \
200     --custom-instructions 'Use this server to retrieve and store persistent memory.' \
201     /home/alice/memory
202    
203     For persistent configuration, use C<custom_instructions> in the global
204     configuration's C<[program mcp-fs]> or C<[instance memory]> section. Instance
205     settings override program settings; the command line overrides both.
206     This purpose appears first in the advertised MCP instructions so a model can
207     decide whether to discover the server's tools.
208    
209     Servers using C<AnyEvent::MCP::Server::Simple> also expose the instance
210     purpose and complete operating instructions as a C<meta-instructions> tool
211     description. Calling that tool returns the complete text when a client
212     truncates descriptions. Clients that understand MCP server instructions
213     still receive a short purpose or routing hint at discovery time, followed
214     by an automatic pointer to the full instructions in the tool description.
215    
216 root 1.5 =head2 Understand the workdir
217    
218     The directory passed at startup tells mcp-fs which workdir to expose.
219     It does not grant permission for every operation in that directory.
220     Each operation still requests its action and sandbox grants.
221    
222     With one workdir, tools can omit the C<workdir> argument. With several:
223    
224     mcp-fs --stdio --name code /home/alice/src/project /home/alice/notes
225    
226 root 1.14 tools select one using a persistent positive integer ID, a numeric string
227     or an exact configured/resolved path returned by C<workdirs>. The
228     C<workdirs> and C<resolved_workdirs> objects use these IDs as keys.
229     Relative tool paths are relative to that selection. Permission rules
230     continue to use the configured path, not its numeric ID.
231    
232     IDs are shared across filesystem servers in
233     C<$XDG_CONFIG_HOME/anyevent-mcp/fs-workdir-ids.json>, or under
234     C<$HOME/.config> by default. They identify resolved absolute paths and
235 root 1.15 survive restarts and argument reordering. Startup resolves IDs once and
236     reserves new allocations under the lock. A timer runs immediately and every
237     5.25 days to reread the registry and refresh the server's fixed assignments.
238     Other entries expire after seven days and their IDs may be reused. Restart
239     servers after manually changing the registry.
240 root 1.5
241     C<workdir-read> exposes the selected workdir read-only.
242     C<workdir-write> makes it writable and implies read access.
243     A path in another configured workdir requires all-workdirs authority;
244     a path elsewhere requires suitable home/world or shared-tmp authority.
245     A symlink cannot make an unmounted target appear inside the sandbox.
246    
247     Prefer separate, non-overlapping workdirs. Overlapping mounts have
248     unspecified access effects. See L<mcp-fs/SANDBOX GRANTS> before granting
249     access beyond the selected workdir.
250    
251 root 1.6 =head2 Inspect version-control changes
252    
253     For a Git, SVN, CVS or Mercurial working copy, ask the LLM to use
254     C<vcs-diff> and C<vcs-status>, with C<backend> set to C<git>, C<svn>, C<cvs>
255     or C<hg>. C<workdirs> reports the available clients. These tools accept
256     filenames and construct the command themselves; no shell pipeline or arbitrary
257     VCS options need to be approved.
258    
259     For example:
260    
261     Show the CVS diff for this project, limited to 200 lines.
262     Then show its status, keeping stdout lines matching "File:|Status:".
263    
264     These operations have their own permission actions. They request read access
265 root 1.19 to the selected workdir. CVS additionally requests the C<ssh-agent> grant,
266     which includes network access, the agent socket and C<known_hosts>, but not
267     general home-directory access. Read permission for ordinary file tools does
268     not automatically authorize a VCS operation.
269 root 1.6
270     For arbitrary C<exec> commands, the same output options are available:
271     C<grep> filters stdout using PCRE, C<max_lines> limits matching stdout lines,
272     and C<max_bytes> bounds returned bytes per stream. Prefer these options to a
273     shell wrapper that mixes execution and output processing. Stderr is unfiltered,
274     and exit status still describes the original command.
275    
276     Defaults return at most 2000 stdout lines and 64 KiB per stream. Raw capture
277     has a separate 1 MiB limit per stream. A true C<capture_truncated> means
278     output was omitted before filtering or collection ended on timeout, so absent
279     matches do not prove the omitted output had none. See L<mcp-fs/Command output>
280     for all result flags and limits.
281    
282 root 1.5 =head1 CONFIGURING YOUR SETUP
283    
284     There are three different things to configure: how the client connects,
285     how the server runs, and which operations the user allows. Changing one
286     does not necessarily change the other two.
287    
288     =head2 Where each setting belongs
289 root 1.1
290     =over
291    
292 root 1.5 =item Directories to expose
293    
294     Pass workdirs on the mcp-fs startup command. For a stdio server, that
295     command belongs in the client's server configuration. For an HTTP server,
296     it belongs in the command used to run the service.
297 root 1.1
298 root 1.5 =item Connection transport
299 root 1.1
300 root 1.5 The client launches a command for stdio or connects to a URL for HTTP.
301     C<--stdio> selects the former for mcp-fs and the multibroker.
302 root 1.1
303 root 1.5 =item Listener address, port and tokens
304 root 1.1
305 root 1.5 Use C<[instance NAME]> in the global configuration or command-line
306     C<--bind> and C<--token> overrides.
307 root 1.1
308 root 1.5 =item Trusted mounts and utility paths
309    
310     For mcp-fs, use C<[program NAME]> defaults and C<[instance NAME]>
311     overrides in the global configuration.
312    
313     =item Allowed operations and sandbox grants
314    
315     Use the permission rules file, normally created through approval dialogs.
316     This file is separate from the global configuration.
317    
318     =item Location of permission prompts
319    
320 root 1.12 Use C<--ask helper>, C<--ask tty>, C<--ask yad>, C<--ask auto> or C<--ask mcp>, or set
321 root 1.5 C<PERL_ANYEVENT_MCP_PERMISSION_ASK> in the server's environment.
322    
323     =item Combined server connections
324    
325     Put prefix/server pairs on the multibroker startup command. HTTP child
326     credentials can also use C<[client PREFIX]> in the global configuration.
327 root 1.1
328     =back
329    
330 root 1.5 =head2 One complete named configuration
331    
332     The global file is C<$XDG_CONFIG_HOME/anyevent-mcp/global.ini>, falling
333     back to C<$HOME/.config/anyevent-mcp/global.ini>. Settings are UTF-8
334     C<key = value> lines; values are unquoted. Whole-line C<#> and C<;>
335     comments are allowed. See L<AnyEvent::MCP/GLOBAL CONFIGURATION> for the
336     complete format.
337    
338     Start with the existing file, preserving its C<[global]> secret.
339     If you have no file yet, C<anyevent-mcp init> creates it privately.
340 root 1.19 Add this section:
341 root 1.5
342     [instance code]
343     bind = 127.0.0.1:31741
344    
345     Now start:
346    
347     mcp-fs --name code /home/alice/src/project
348    
349     and retrieve its URL with:
350    
351     mcp-fs --name code --print-url
352    
353     Both use C<[instance code]>. No explicit token is needed: the server
354     derives one from its name and the existing master secret.
355    
356     For this setup:
357    
358     instance settings: [instance code]
359     selected workdir: /home/alice/src/project
360 root 1.8 permission file: ~/.config/anyevent-mcp/rules/fs-code.ini
361 root 1.5 rule-manager profile: fs-code
362    
363     The permission pathname above assumes the default configuration directory.
364     C<anyevent-mcp manage-rules fs-code> opens the graphical rule manager;
365     C<anyevent-mcp edit-rules fs-code> opens the file in your editor.
366    
367 root 1.19 Settings shared by all mcp-fs instances go in C<[program mcp-fs]>.
368     Instance settings override program settings.
369    
370 root 1.22 File ownership and permissions are under the user's control. The global
371     configuration contains a master authentication secret, so take care when
372     sharing it. C<--config FILE> on C<anyevent-mcp init>
373 root 1.5 selects that command's output file; it does not make the servers use an
374     arbitrary alternate file. Use the same C<HOME>/C<XDG_CONFIG_HOME>
375     environment when running the server and its management commands.
376    
377     =head2 Names, prefixes and profiles
378    
379     C<--name code> selects instance settings, derived HTTP credentials and
380 root 1.8 mcp-fs's C<rules/fs-code.ini>. Without C<--name>, mcp-fs uses C<default>,
381     giving profile C<fs-default>. Two processes with the same program, name and
382 root 1.5 configuration share credentials and rules, even if their workdirs differ.
383    
384     A multibroker prefix, such as C<files>, only routes tools: C<grep> becomes
385     C<files.grep>. It does not rename the child server or select its rules.
386     For example:
387    
388     mcp-multibroker files \
389     'stdio:mcp-fs --name code /home/alice/src/project'
390    
391     The tools are C<files.*>, but the child still uses instance C<code>
392     and rule-manager profile C<fs-code>. The multibroker's own C<--name>
393     selects its upstream listener settings.
394 root 1.1
395 root 1.5 =head2 Configuration changes and restarts
396 root 1.1
397 root 1.5 Command-line listener options override the named global settings.
398     For mcp-fs trusted settings, an instance entry overrides the corresponding
399     program entry; an empty instance mount value suppresses the inherited mount.
400 root 1.1
401 root 1.5 Workdirs, mounts, utility paths, listener settings and tokens are read at
402     startup. Change the file or startup command, then restart the affected
403     server. The multibroker also needs restarting to change its prefix/server
404     pairs; refreshing discovery does not change those pairs.
405    
406     Permission rules are reread on permission checks, so editing them does
407     not require a restart. A client's displayed tool list can still be cached.
408     After restarting a child, refresh tool discovery or reconnect the client
409     as described in L</COMBINING SERVERS>.
410    
411     =head1 PERMISSIONS IN PRACTICE
412    
413     HTTP authentication establishes that the client may connect.
414     Permission checks decide whether a tool may perform an operation.
415     A correct token therefore does not prevent permission prompts.
416    
417     =head2 What the prompt means
418    
419     The prompt describes an action, paths or command, a reason and sandbox
420     grants. For filesystem tools, the actions are:
421    
422 root 1.6 inspect stat, list, find
423     read file-read, read-lines, grep
424     write file-write, file-patch
425     manage path-op
426     exec arbitrary command execution
427     vcs-diff working-copy differences
428     vcs-status working-copy status
429 root 1.5
430     The action and grants are independent. Allowing C<read> does not allow
431     C<write>, even if a worker grant permits both kinds of filesystem access.
432     C<exec> runs arbitrary commands; it is not a classification of supposedly
433     safe command prefixes.
434    
435     Choose allow/deny once, or always. Closing the dialog denies once.
436     An optional denial reason is returned with the error; it is not added to
437 root 1.13 successful tool results. An always choice opens a rule editor. Choose an
438     indefinite lifetime (the default), 900 seconds or 16 hours. Finite lifetimes
439     are stored as C<expires> Unix timestamps. Expired rules disappear on every
440     read; the next ordinary save removes them from disk. Expiry affects future
441     permission checks, not operations already authorized.
442 root 1.5 Filesystem allow rules can select grants and the selected workdir when
443     the authority depends on it. Deny rules can also select an exact affected
444     path. Exec offers persistent command/argv subjects.
445    
446     For exec, C<View stdin...> lets you inspect supplied input without closing
447 root 1.9 the approval dialog. Filesystem and Vim patch tools similarly offer
448     C<View patch...>, including the target file or editor and buffer. Longer
449     text is shown as an explicitly incomplete preview. These are YAD button
450     labels; other interfaces can show the details inline.
451     That input is display-only: an exec allow rule does
452 root 1.5 not constrain future stdin. Allowing an interpreter command can therefore
453     allow a different script on its next invocation.
454    
455     A worker accessing several paths requests their combined sandbox authority
456     once. If the chosen grants are insufficient, it fails before starting.
457    
458     =head2 Save a useful read-only policy
459    
460     After trying individual operations, you might want the LLM to inspect and
461     read the project without asking each time, while keeping changes subject
462 root 1.8 to approval. Put these rules in C<rules/fs-code.ini>, or create equivalent
463 root 1.5 allow rules through the prompt:
464    
465     [rule]
466     decision=allow
467     action=inspect
468 root 1.25 match.workdir=/home/alice/src/project
469 root 1.5 sandbox-grants=workdir-read
470    
471     [rule]
472     decision=allow
473     action=read
474 root 1.25 match.workdir=/home/alice/src/project
475 root 1.5 sandbox-grants=workdir-read
476    
477     [rule]
478     decision=deny
479     action=exec
480 root 1.1
481 root 1.5 Use the exact workdir spelling passed at server startup. Absolute startup
482 root 1.22 paths make this easier. Rule-file permissions follow the usual Unix filesystem
483     rules; any user who can edit the file can change the server's approval policy.
484    
485     Without matching rules, write and manage operations still ask. The final rule
486     denies command execution outright; omit it if you want execution to ask instead.
487 root 1.1
488 root 1.5 Rules run in order, stopping at the first match. An allow rule matches only
489     when its grants cover the request, including implications.
490     C<workdir-write> implies C<workdir-read>; C<network> remains independent.
491 root 1.25 Action and C<match.NAME> match exactly unless beginning with C<^>, which
492     selects a Perl regular expression; workdir scopes use the same mechanism.
493 root 1.5 An explicit C<ask> rule can override later allow rules.
494    
495     These allow rules authorize sandbox access to the selected workdir.
496     They cannot confine authority to one file or a subtree inside it.
497     Filesystem operations do not offer persistent path subjects.
498     An exact C<path> matcher is available for deny rules only.
499     Trusted runtime and configured mounts remain baseline access independently
500     of these grants. See L<mcp-fs/TRUSTED CONFIGURATION>.
501    
502     =head2 Change or remove saved rules
503    
504     Use:
505    
506     anyevent-mcp manage-rules fs-code
507     anyevent-mcp edit-rules fs-code
508    
509     The first command lets you delete and reorder rules in YAD.
510     The second uses C<$VISUAL>, C<$EDITOR>, C<sensible-editor> or C<vi>.
511     An earlier deny or ask rule can explain why adding a later allow rule
512     does not change the result.
513    
514     For a custom application with another rule pathname, use:
515    
516     anyevent-mcp manage-rules-file /path/to/rules.ini
517     anyevent-mcp edit-rules-file /path/to/rules.ini
518    
519     A failed attempt to save a permanent rule is an error, not a successful
520 root 1.22 permanent approval. The file mode is preserved when saved through these
521     commands. For full syntax and programming interfaces, see
522 root 1.5 L<AnyEvent::MCP::Server::Permissions>.
523    
524     =head2 Choose where to ask
525    
526     The default C<helper> mode runs C<anyevent-mcp-askpermission> on the server
527     machine. It tries YAD, then C</dev/tty>, then denies if neither can be used.
528     The helper inherits the server's display environment.
529 root 1.12 C<--ask tty> and C<--ask yad> instead force the built-in terminal or YAD
530     interface. They ignore custom helper settings and never try another
531     interface. These modes work for permission prompts and ordinary forms,
532     including forms handled by a multibroker.
533 root 1.5 C<PERL_ANYEVENT_MCP_PERMISSION_HELPER> selects a different executable.
534    
535     For a modern client supporting MCP form elicitation, you can instead use:
536    
537     mcp-fs --stdio --name code --ask auto /home/alice/src/project
538    
539     C<auto> uses the client's form support when advertised for that request,
540     otherwise the local helper. C<mcp> requires that support and fails when
541     unavailable. It does not silently fall back. Use client-side permission
542     approval only when that client is a trusted authority to grant access.
543    
544     To set the default for servers using the shared permission engine:
545    
546     PERL_ANYEVENT_MCP_PERMISSION_ASK=auto \
547     mcp-fs --stdio --name code /home/alice/src/project
548    
549     An explicit application C<ask> setting or C<--ask> overrides the environment.
550     For spawned stdio children, C<mcp-multibroker --ask auto> passes this
551     default to them. It cannot change the environment of an independently
552     running HTTP server.
553    
554 root 1.7 The multibroker can handle form elicitation locally for both stdio and HTTP
555     children. C<--ask helper> selects local dialogs even if the upstream client
556     advertises native forms; C<--ask mcp> forwards forms upstream, and C<auto>
557     uses native forms when advertised. If a client claims support but silently
558     declines questions, use C<helper>. A decline never causes a fallback prompt.
559    
560     Standalone C<mcp-ask-user> also supports these modes and defaults to the
561     local helper. A question is different from an approval: answering it does
562     not grant a filesystem worker any authority.
563 root 1.5
564     =head1 COMBINING SERVERS
565    
566 root 1.20 Once the first connection works, C<mcp-multibroker> lets you give the
567     client one connection for several MCP servers. It works with the servers
568     in this distribution and with third-party MCP servers, including ones
569     written in other languages. Each downstream server can be a local
570     subprocess communicating over stdio or an existing HTTP endpoint; you
571     can mix both in one broker. The broker discovers their tools and
572     forwards calls to the appropriate server without changing how that
573     server implements its tools.
574    
575     For example, combine two filesystem instances:
576 root 1.5
577     mcp-multibroker --name tools --bind :31740 \
578     code 'stdio:mcp-fs --name code /home/alice/src/project' \
579     notes 'stdio:mcp-fs --name notes /home/alice/notes'
580    
581     Quote each C<stdio:> shell command as one argument.
582     The broker supplies the child's stdio environment and starts ordinary
583     children lazily, on first use. The explicit child names give them separate
584     permission profiles C<fs-code> and C<fs-notes>.
585    
586     Obtain the upstream HTTP URL with:
587    
588     mcp-multibroker --name tools --bind :31740 --print-url
589    
590     Configure this URL in place of the client's old direct connection.
591     The client can now see C<code.grep>, C<code.read-lines>, C<notes.find>
592     and other prefixed tools. It does not need a separate connection to each
593     child.
594    
595     For a client launching the multibroker locally, configure:
596    
597     mcp-multibroker --stdio --name tools \
598     code 'stdio:mcp-fs --name code /home/alice/src/project' \
599     notes 'stdio:mcp-fs --name notes /home/alice/notes'
600    
601     C<--stdio> selects the upstream connection. The child commands still use
602     C<stdio:>; that selects each downstream connection independently.
603     No upstream HTTP URL is needed in this case.
604    
605 root 1.20 The same setup can include Vim, browser pages, a third-party stdio
606     server or a remote HTTP service. See L</Add an HTTP child> for an
607     example mixing local and remote servers, and L<mcp-multibroker/DOWNSTREAM
608     SERVERS> for the complete syntax, including direct argv execution,
609     credentials and per-child options.
610    
611 root 1.5 =head2 Discover and refresh tools
612    
613     Ask the LLM:
614    
615     Call discover-brokers and list-tools, then show me which servers
616     are available and what each is for.
617    
618 root 1.17 C<discover-brokers> returns advertised instructions (which may be short),
619     no instructions, or an error for each configured server.
620     C<list-tools> requests current tool definitions, including any prefixed
621     C<meta-instructions> tools and their full instruction descriptions;
622 root 1.5 unreachable servers are omitted. A reachable server can still fail later.
623    
624     If the client still has an old direct tool list, C<call-tool> can invoke
625     an exact prefixed name found by C<list-tools>. Refresh the client's MCP
626     connection if it continues to hide newly available tools.
627    
628 root 1.15 Discovery queries configured servers and currently registered reverse
629     connections. Changing the static downstream command still requires a restart.
630    
631     =head2 Let a server connect to the multibroker
632    
633     To add independently started servers without editing the multibroker command,
634     keep its HTTP/extension listener active alongside stdio:
635    
636     mcp-multibroker --stdio --listen --bind 127.0.0.1:31740
637     mcp-multibroker --bind 127.0.0.1:31740 --print-url
638    
639     Append an alias to the returned credential-bearing URL:
640    
641     mcp-fs --connect http://127.0.0.1:31740/TOKEN/files /home/alice/project
642    
643     The filesystem server initiates the TCP connection but remains the MCP server.
644     The multibroker authenticates the same token used for HTTP, registers the
645     alias and discovers the tools. A configured or connected alias cannot be
646     replaced. After disconnecting, the server retries once per second for sixty
647     attempts. Pending calls fail and are never replayed. Remote registration does
648     not grant the multibroker spawned-child shutdown authority.
649    
650     The hello is a raw JSON line, followed by ordinary MCP JSONL on the same socket;
651     the HTTP-shaped URL is an address and credential, not an HTTP request.
652     The bundled connector supports plain C<http://> endpoints. An HTTP listener is
653     already active by default when the upstream connection is HTTP.
654 root 1.5
655     =head2 Add an HTTP child
656    
657 root 1.20 A broker can mix spawned stdio servers and existing HTTP endpoints,
658     including independently implemented third-party servers:
659 root 1.5
660     mcp-multibroker --stdio \
661     code 'stdio:mcp-fs --name code /home/alice/src/project' \
662     remote https://example.org/mcp/ --bearer TOKEN
663    
664     C<--bearer> immediately after the HTTP pair belongs to that child.
665     C<--token> before all pairs configures the multibroker's own HTTP listener.
666     They authenticate different connections.
667    
668     To avoid putting a child's bearer token in the startup command, add:
669    
670     [client remote]
671     bearer = TOKEN
672     timeout = 300
673    
674     to the private global configuration, and omit C<--bearer> from the command.
675     The prefix C<remote> selects these client defaults. The command-line URL
676     still chooses the endpoint. Use the actual credential accepted by that
677     server, not the literal placeholder C<TOKEN>.
678    
679     A token already present in a child's URL needs no separate bearer option.
680     The bundled servers use static URL-safe tokens; they do not validate
681     OAuth access tokens or implement HTTP Basic authentication.
682     Use TLS or an appropriate tunnel when credentials cross untrusted networks.
683    
684     The multibroker does not put every child inside the mcp-fs sandbox.
685     Each process or remote service has its own authority and enforcement.
686    
687     =head2 Add a live Vim editor
688    
689     Install the Vim plugin using L<mcp-vim/VIM PLUGIN INSTALLATION>. It is
690     included in the source distribution but is not installed by Perl's
691     C<make install>.
692    
693 root 1.19 Without a multibroker, configure the MCP client to launch:
694    
695     mcp-vim --stdio --name editor
696    
697     Even in stdio mode, mcp-vim listens separately for editor connections.
698     If using a multibroker, start its child eagerly so Vim can connect
699     before the first MCP tool call:
700 root 1.5
701     mcp-multibroker --stdio \
702     code 'stdio:mcp-fs --name code /home/alice/src/project' \
703     vim 'stdio:mcp-vim --name editor' --eager
704    
705 root 1.19 In another terminal, obtain the editor broker's URL prefix:
706 root 1.5
707     mcp-vim --name editor --print-url
708    
709     Append the desired target name in Vim:
710    
711     :Mcp http://HOST:PORT/TOKEN/my-editor
712    
713     Use the actual printed prefix in place of C<http://HOST:PORT/TOKEN/>.
714 root 1.19 Ask the LLM to call C<targets>, then C<state> before reading or editing
715     buffers (C<vim.targets> and C<vim.state> through the multibroker).
716     These tools see live, possibly unsaved buffers. Edits require a current
717     changedtick and do not save files to disk.
718 root 1.5
719 root 1.13 To pass arguments directly, use C<PREFIX --- PROGRAM ARG... --->:
720    
721     mcp-multibroker --stdio \
722     vim --- mcp-vim --name editor --bind :: --- --eager \
723     code --- mcp-fs --name code '/home/alice/project with spaces' ---
724    
725     Only the invoking shell processes quoting. The broker passes all arguments
726     between the delimiters unchanged, including empty arguments and child options.
727     Use C<stdio:COMMAND> for shell syntax or a literal C<---> child argument.
728     An empty command or missing closing delimiter is an error.
729    
730     C<--eager> belongs immediately after its stdio URL or closing C<--->.
731 root 1.5 An eager connection failure is logged; the broker does not continuously
732     restart the child. Later tool use can try connecting again.
733    
734     =head2 Ask the client's human a question
735    
736 root 1.19 To let the assistant ask you questions, configure its MCP client to launch:
737    
738     mcp-ask-user --stdio
739    
740     Or add the question server to a multibroker:
741 root 1.5
742     mcp-multibroker --stdio \
743     code 'stdio:mcp-fs --name code /home/alice/src/project' \
744     questions 'stdio:mcp-ask-user'
745    
746 root 1.19 The LLM can call C<ask-user> (C<questions.ask-user> through the multibroker)
747     with a question, up to three suggested answers and room for free text.
748     For example, tell it to use that tool if choosing among several possible
749     tasks needs your input. For several fields or other value types,
750     C<ask-form> (C<questions.ask-form> through the multibroker) accepts
751 root 1.10 C<message> and C<requestedSchema> directly and returns the standard
752     elicitation response. Both tools use the same configured presentation mode.
753 root 1.5 Decline and cancel are distinct results; neither supplies an answer.
754    
755 root 1.7 By default the multibroker displays questions locally, using YAD or a terminal.
756     Add C<--ask mcp> before the broker entries to use the client's native forms,
757     or C<--ask auto> to select by advertised capability. This also works with
758     C<mcp-ask-user> started separately: give that server C<--ask mcp> so it
759     delegates presentation to its connecting multibroker.
760    
761     C<anyevent-mcp-form-elicitation> is the standalone form renderer. It reads standard MCP
762     form parameters as UTF-8 JSON on stdin and writes an accept/decline/cancel
763     response as JSON on stdout. C<PERL_ANYEVENT_MCP_ELICITATION_HELPER> selects
764     a replacement executable. See L<anyevent-mcp-form-elicitation> for supported fields
765     and L<mcp-ask-user> for question arguments and result fields.
766 root 1.5
767 root 1.19 =head1 CONNECTED BROWSER PAGES
768    
769     C<mcp-webbrowser> is the browser-page counterpart to C<mcp-vim>. It exposes
770     only tabs explicitly allowed by the browser user. Configure your MCP client
771     to launch:
772    
773     mcp-webbrowser --stdio
774    
775     The broker keeps its own HTTP/WebSocket listener active even in stdio mode;
776     the userscript connects to that listener, not to MCP's stdio stream.
777     In a separate terminal, obtain its URL:
778    
779     mcp-webbrowser --print-url
780    
781     Use the same instance name and configuration as the broker. Keep this
782     credential-bearing URL private.
783     Install the companion userscript from
784     C<webbrowser/mcp-webbrowser.user.js> in the source distribution or from
785     L<https://dist.schmorp.de/mcp-webbrowser/1/mcp-webbrowser.user.js>.
786     Chromium with ScriptCat has been tested. On a tab you want to expose,
787     choose B<Allow MCP access to this tab> from the userscript menu and enter
788     the printed URL when prompted. Other tabs remain unexposed.
789    
790 root 1.21 The broker supplies C<tabs>, C<execute> and C<add-element> tools, permission
791 root 1.19 prompts, cancellation and execution timeouts. See
792     L<mcp-webbrowser/USERSCRIPT INSTALLATION AND USE> for setup, compatibility
793     and the current ScriptCat discarded-tab limitation.
794    
795     If the multibroker launches the browser broker, keep that child running
796     from startup so browser tabs can connect:
797    
798     mcp-multibroker --stdio browser --- mcp-webbrowser --- --eager
799    
800 root 1.5 =head1 HTTP TOKENS AND SERVER IDENTITY
801    
802     For the ordinary bundled HTTP endpoints, a client can present an accepted
803     token in either of these ways:
804    
805     POST /TOKEN/
806     POST / Authorization: Bearer TOKEN
807    
808     URL tokens are path components, not browser cookies.
809     For another configured endpoint, C</TOKEN> prefixes that endpoint path.
810 root 1.23 The HTTP server also accepts C</TOKEN> and the corresponding bare path
811     without the final slash when the endpoint is configured with one. This
812     works around clients (observed with Claude) that drop the final slash
813     from a configured URL.
814 root 1.5 All accepted tokens authenticate the same operations; they are not separate
815     users or permission levels. Permissions still govern the tool operation.
816    
817     By default, the master secret and server name determine one stable token
818     and a port in 16384..32767. Changing a server's name changes its derived
819     credentials and default port. Changing or losing the master secret changes
820     all derived credentials. Keep an existing C<[global]> secret when editing
821     other configuration.
822    
823     To configure explicit tokens:
824    
825     [instance code]
826     tokens = first-secret,second-secret
827 root 1.1
828 root 1.5 Replace those placeholders with actual unguessable URL-safe tokens.
829     Repeated C<--token> options replace the whole configured list and the
830     derived default. The first token appears in C<--print-url>; all are accepted.
831     mcp-vim also accepts its token set for Vim and browser WebSocket connections.
832    
833     If C<--print-url> disagrees with the client's URL, compare the name,
834     command-line overrides, user and configuration environment with the running
835     process. The command resolves configuration; it does not ask the running
836     server which URL it uses. A changed file needs a server restart.
837    
838     An Origin allowlist restricts browser origins; it does not authenticate
839     clients. A CORS preflight can succeed without a token, while the MCP POST
840     still requires one. See L<AnyEvent::MCP::Server::HTTP/AUTHENTICATION> for
841     the low-level server interface.
842    
843     =head1 CLIENT EXAMPLES
844    
845     Client settings and command syntax evolve independently of this distribution.
846     These examples show the connection choices; consult the linked client
847     documentation if its interface differs. Replace illustrative paths and
848     credentials with your own.
849 root 1.1
850 root 1.5 =head2 OpenAI Codex CLI
851 root 1.1
852 root 1.5 For the first direct filesystem connection:
853 root 1.1
854 root 1.5 codex mcp add code -- \
855     mcp-fs --stdio --name code /home/alice/src/project
856 root 1.1 codex mcp list
857    
858 root 1.5 For a multibroker connection:
859    
860     codex mcp add mytools -- \
861     mcp-multibroker --stdio \
862     code 'stdio:mcp-fs --name code /home/alice/src/project'
863    
864 root 1.1 Use C</mcp> within Codex to inspect connections.
865     See L<Codex MCP documentation|https://learn.chatgpt.com/docs/extend/mcp>.
866    
867 root 1.5 =head2 Anthropic Claude Code
868 root 1.1
869 root 1.5 For the direct connection:
870 root 1.1
871 root 1.5 claude mcp add --transport stdio --scope user code -- \
872     mcp-fs --stdio --name code /home/alice/src/project
873 root 1.1 claude mcp list
874    
875 root 1.5 Replace the launched command with the multibroker command above when you
876     want several servers. Use C</mcp> for connection status. See
877 root 1.1 L<Claude Code MCP documentation|https://code.claude.com/docs/en/mcp>.
878    
879 root 1.5 =head2 Google Gemini CLI
880 root 1.1
881 root 1.5 Merge a direct server entry into C<~/.gemini/settings.json>:
882 root 1.1
883     {
884     "mcpServers": {
885 root 1.5 "code": {
886     "command": "mcp-fs",
887 root 1.1 "args": [
888 root 1.5 "--stdio", "--name", "code", "/home/alice/src/project"
889     ]
890 root 1.1 }
891     }
892     }
893    
894 root 1.5 For a combined connection, use C<mcp-multibroker> as the command and its
895     C<--stdio> and prefix/server pairs as the argument array.
896     Use C</mcp> to inspect the connection. See
897     L<Gemini CLI MCP documentation|https://geminicli.com/docs/tools/mcp-server/>.
898    
899     =head2 Hosted clients, including ChatGPT web
900    
901     A hosted client cannot spawn your local stdio command or reach your
902 root 1.21 machine's loopback address directly. A Secure MCP Tunnel runs locally,
903     connects out to OpenAI, and forwards MCP requests to a local stdio command
904     or HTTP URL. No public listener or inbound firewall port is needed.
905    
906     First create a tunnel in OpenAI Platform tunnel settings and obtain its
907     C<tunnel_...> ID and a runtime API key. Arrange for
908     C<CONTROL_PLANE_API_KEY> to be set securely in the tunnel client's
909     environment; do not put a real key in a script, command line or example.
910     Associate the tunnel with the ChatGPT workspace where you want to use it.
911    
912     For B<stdio>, put the server startup command in a small executable wrapper,
913     for example C</home/alice/bin/my-mcp>:
914    
915     #!/bin/sh
916     exec mcp-multibroker --stdio \
917     code --- mcp-fs --name code /home/alice/src/project --- \
918     questions --- mcp-ask-user ---
919    
920     With a tunnel installation providing C<tunnel-client-runtime>, run:
921    
922     tunnel-client-runtime run \
923     --log.format=struct-text \
924     --log.level=warn \
925     --control-plane.tunnel-id=tunnel_... \
926     --mcp.connection-max-ttl=120s \
927     --mcp.command=/home/alice/bin/my-mcp
928    
929     The tunnel starts the wrapper as its stdio MCP server. Do not start a
930     separate copy yourself. Make the wrapper executable and ensure its
931     programs and Perl modules are on the tunnel process's C<PATH>.
932 root 1.5
933 root 1.21 For B<HTTP>, instead start the server or multibroker separately:
934    
935     mcp-multibroker --name tools --bind 127.0.0.1:16586 \
936     code 'stdio:mcp-fs --name code /home/alice/src/project'
937    
938     Obtain the matching credential-bearing URL:
939    
940     mcp-multibroker --name tools --bind 127.0.0.1:16586 --print-url
941    
942     Then point the tunnel runtime at that URL, rather than a command:
943    
944     tunnel-client-runtime run \
945     --log.format=struct-text \
946     --log.level=warn \
947     --control-plane.tunnel-id=tunnel_... \
948     --mcp.connection-max-ttl=120s \
949     --mcp.server-url=http://127.0.0.1:16586/TOKEN/
950    
951     Replace C<TOKEN> with the actual URL path printed above, and keep it
952     private. In this mode, the multibroker must remain running separately;
953     the tunnel only connects to it. Both modes require the tunnel runtime
954     to remain active while the hosted client uses the server. Use B<one>
955     of C<--mcp.command> and C<--mcp.server-url>, not both.
956    
957     In ChatGPT, add a custom MCP server using a Tunnel connection and select
958     the tunnel ID. Creation and visibility depend on the Platform and ChatGPT
959     workspace permissions. The tunnel client's CLI and supported configuration
960     forms can vary between releases; the examples above use the direct runtime
961     CLI rather than its optional profile setup. See
962     L<Secure MCP Tunnel|https://developers.openai.com/api/docs/guides/secure-mcp-tunnels>
963     for obtaining a tunnel, runtime, credentials and connecting it to ChatGPT.
964 root 1.5
965     =head1 TROUBLESHOOTING
966    
967     =head2 The server does not start
968    
969     Read stderr or the client's server log. Missing Perl modules, a missing
970     workdir, unsuitable utilities or an unavailable bubblewrap executable can
971     fail startup. Confirm that the client launches the same executable and
972     arguments you intended, with the expected C<PATH> and Perl installation.
973    
974     For a local sandbox check, run from the project directory:
975    
976     mcp-fs --exec-cmd workdir-read -- ls
977 root 1.1
978 root 1.5 This runs C<ls> with the named grants and trusted baseline mounts, without
979     MCP or saved permission rules. A failure here can identify a bubblewrap
980     or runtime problem. It does not test the client connection or approval UI.
981     C<--sandbox none> disables isolation and changes worker authority; it is
982     not a fix that preserves the same permission boundary.
983 root 1.1
984 root 1.5 =head2 The client cannot connect
985    
986     For stdio, configure a command the client launches, rather than a URL.
987     A separately running stdio process is not the client's connection.
988     Do not put banners or diagnostics on stdout.
989    
990     For HTTP, leave the server running and check its address and port.
991     C<--print-url> exits without starting it. Loopback binds accept local
992     connections only; hosted or remote clients need the appropriate route or
993     tunnel. An occupied port causes a listener error, so check the server log.
994    
995     =head2 Authentication fails
996    
997     Obtain the URL with the same name, bind/token overrides and configuration
998 root 1.23 environment as the running process. Use the complete path; the final
999     slash is optional for endpoints whose configured path ends in one.
1000     A clean URL needs an accepted bearer token.
1001 root 1.5
1002     A multibroker child credential is not necessarily the upstream listener's
1003     credential. C<--bearer> after a child pair and C<--token> before the pairs
1004     configure different sides of the connection.
1005    
1006     If the server warns that it cannot save the master secret, another process
1007 root 1.22 may derive a different token. Check write access to the global configuration.
1008     Do not replace an existing secret simply to add a setting.
1009 root 1.5
1010     =head2 Connected, but there are no tools
1011    
1012     Inspect the server's stderr for omitted utilities. mcp-fs's C<workdirs>
1013     tool reports configuration even when a utility-dependent tool is absent.
1014     For a multibroker, call C<discover-brokers> to see individual connection
1015     errors, then C<list-tools> to refresh definitions.
1016    
1017     A third-party child might require initialization or features this client
1018     implementation does not support. See L<AnyEvent::MCP::Client> and its
1019     transport documentation for limitations.
1020    
1021     =head2 There is no approval dialog
1022    
1023     First check whether the tool was denied by a saved rule or is waiting for
1024     the client's own approval. An allowed operation needs no server prompt.
1025    
1026     The default helper runs on the server machine. A background service may
1027     have neither a usable display nor C</dev/tty>, even though your interactive
1028     shell has both. Supply the appropriate display environment, a usable helper,
1029     or C<--ask auto> with a modern client supporting form elicitation.
1030     C<--ask mcp> reports an error if that support is absent.
1031    
1032     Setting an asking mode cannot make an unsupported client display a form.
1033     Check stderr and the tool error instead of assuming a missing dialog is
1034     an approval.
1035    
1036     =head2 It asks again after I chose allow
1037 root 1.1
1038 root 1.5 Allow-once covers one tool invocation, including its permission retries.
1039     The next invocation asks again. Use allow-always to save a rule.
1040 root 1.1
1041 root 1.5 Inspect the saved rule's action, workdir and grants. Listing names and
1042     reading contents are different actions. A rule for one exact workdir
1043     spelling will not match a differently spelled startup argument.
1044     A request for extra authority, such as networking, does not match a
1045     workdir-read-only allow rule. Earlier ask or deny rules take precedence.
1046 root 1.1
1047 root 1.5 Confirm that the prompt's permanent rule was successfully saved and that
1048     you are editing the rules for the actual child name, not merely its
1049     multibroker prefix.
1050 root 1.1
1051 root 1.5 =head2 The worker cannot see a directory or executable
1052 root 1.1
1053 root 1.5 The worker sees granted mounts and trusted baseline mounts, not everything
1054     the server process can see. Check C<workdirs> for the selected path, mounts
1055     and runtime paths. A symlink target outside those mounts is unavailable.
1056 root 1.1
1057 root 1.19 The ordinary sandbox runtime includes C</usr>, C</bin> and system libraries,
1058     but not C</opt>. For tools or libraries under C</opt>, add this to
1059     C<[program mcp-fs]> in the private global configuration:
1060    
1061     mount.opt = ro:/opt
1062    
1063     This assumes C</opt> exists. Restart mcp-fs after changing trusted mounts.
1064     If your worker Perl is C</opt/bin/perl>, you can also set
1065     C<executable.perl = /opt/bin/perl> in that program section. Supply the
1066     actual executable path: selecting it does not itself mount the
1067     executable or its dependencies inside the worker.
1068    
1069 root 1.5 A trusted mount supplies baseline access to every worker using it; a
1070     writable mount likewise supplies baseline write authority.
1071 root 1.1
1072 root 1.5 An arbitrary command might also need its user's configuration or repository
1073     credentials under HOME, or network access. Request the corresponding grants
1074     when needed; do not assume C<workdir-read> includes them.
1075 root 1.7 For example, CVS over SSH can use C<workdir-read> and C<ssh-agent>.
1076     The latter includes network access, the agent socket and C<~/.ssh/known_hosts>,
1077     without exposing private key files or the rest of HOME. The broker must
1078     inherit C<SSH_AUTH_SOCK> from your environment. User-configured helpers
1079     outside the runtime mounts need an explicit trusted mount.
1080     An explicit exec grant array replaces the default rather than adding to it.
1081 root 1.1
1082 root 1.5 =head2 My configuration change seems to be ignored
1083 root 1.1
1084 root 1.5 Check which file and section the process actually selects. Global settings
1085     use the server user's C<HOME>/C<XDG_CONFIG_HOME>. Instance names, program
1086     basenames and multibroker prefixes serve different purposes.
1087 root 1.1
1088 root 1.5 Restart after changing startup settings, mounts or utilities. Permission
1089     rules need no restart, but their order still matters. Refresh discovery
1090     after a child restart; reconnect a client that retains an old tool list.
1091     C<--print-url> reads the current configuration, which can differ from an
1092     older running process.
1093 root 1.1
1094 root 1.5 =head2 The command failed, but the MCP request succeeded
1095 root 1.1
1096 root 1.5 C<exec> reports exit status, signal or timeout as a normal tool result.
1097     A successful MCP exchange is not a successful Unix command.
1098     Conversely, a transport failure does not prove a command did nothing:
1099     it may have completed before the connection was lost. Calls are not
1100     automatically replayed after a transport failure.
1101 root 1.1
1102 root 1.11 =head1 TESTING
1103    
1104     The default test level is 0. It checks protocol behaviour, permissions,
1105     validation and ordinary process operation, including worker cancellation
1106     and reaping. Watchdogs allow slow machines time to finish; they do not
1107     make successful tests wait for the whole timeout.
1108    
1109     prove -Ilib t
1110    
1111     Set C<PERL_ANYEVENT_MCP_TESTS> to 1 to include the extended tests:
1112    
1113     PERL_ANYEVENT_MCP_TESTS=1 prove -Ilib t
1114    
1115     Level 1 adds GNU find/grep/sed/patch operations, real Vim scripting, browser
1116     transfer integration, short idle-lifetime tests, a helper descendant holding
1117     a pipe open, and tests which deliberately wait for a command timeout or
1118     cancel a form helper across several processes. Run this level before releases.
1119     Values greater than 1 currently select the same tests as level 1.
1120    
1121     Missing GNU utilities or required Vim functions cause explicit skips even
1122     at level 1. The permission and form UI tests use a YAD stand-in: neither
1123     level requires YAD, X11 or an interactive display. The filesystem tests
1124     use a bubblewrap stand-in and check arguments and worker behaviour; they
1125     do not test kernel isolation. The browser tests use simulated peers.
1126    
1127 root 1.5 =head1 WHERE TO GO NEXT
1128 root 1.1
1129 root 1.5 For available tools and server-specific options:
1130 root 1.1
1131     perldoc mcp-fs
1132     perldoc mcp-multibroker
1133 root 1.5 perldoc mcp-vim
1134     perldoc mcp-ask-user
1135 root 1.1 perldoc anyevent-mcp
1136    
1137 root 1.5 For a complete first Perl server, options, replies, permission checks and
1138     asynchronous work, see L<AnyEvent::MCP::Server::Simple/TUTORIAL>.
1139     For the module map and shared configuration reference, see L<AnyEvent::MCP>.
1140     For permission rule details, see L<AnyEvent::MCP::Server::Permissions>.
1141 root 1.1
1142     =head1 SEE ALSO
1143    
1144     L<AnyEvent::MCP>, L<AnyEvent::MCP::Server::Simple>,
1145 root 1.5 L<mcp-fs>, L<mcp-multibroker>, L<mcp-vim>, L<mcp-ask-user>,
1146     L<AnyEvent::MCP::Server::Permissions>
1147 root 1.1
1148     =cut