AnyEvent-MCP
view release on metacpan or search on metacpan
bin/anyevent-mcp view on Meta::CPAN
--help show this help
User definitions inherit from [global] through [program NAME] to
[instance NAME]; narrower scopes override wider ones. Without --program
or --instance, user commands modify [global]. Revoked users remain
disabled until recreated with a new token generation. The implicit
global:default user is enabled initially.
Examples:
anyevent-mcp create-user chatgpt
anyevent-mcp --program mcp-fs create-user backup
anyevent-mcp --instance private revoke-user alice
anyevent-mcp revoke-user chatgpt
mcp-multibroker --print-urls # list all enabled user URLs
mcp-multibroker --print-url=chatgpt # show just chatgpt's URL
Server changes take effect after restart. The selected connect_user
(default: default) authenticates auxiliary browser/Vim/reverse connections.
Rule profiles are stored under $XDG_CONFIG_HOME/anyevent-mcp, falling back
to ~/.config/anyevent-mcp/rules (e.g. manage-rules fs-default).
my $run_patch = sub {
my ($newname, $path, $diff) = @_;
my ($errfh, $errname) = $create_tempfile->("/tmp/mcp-fs~~patch~~");
$errfh
or return undef, $errname;
local $ENV{LC_ALL} = "C";
open my $write, "|-", "sh", "-c",
q{exec "$4" --unified --verbose --binary --batch --forward --get=0 --fuzz=0 --reject-file=- --no-backup-if-mismatch -o "$2" "$1" >"$3" 2>&1},
"--", $path, $newname, $errname, $patch
or return undef, "open patch pipe: $!";
my $write_error;
{
print $write $diff
or $write_error = "write patch: $!";
close $write;
}
lib/AnyEvent/MCP.pm view on Meta::CPAN
reference, or throws on command/application failure. Setup failures throw
synchronously. Failed or partial output is removed. C<$input> is unchanged.
The caller owns committing the successful output and removing it when no
longer needed. Freshness checks, metadata preservation, atomic replacement
and application-specific permissions also belong to the caller.
For your reference, the exact options used are:
--verbose --batch --forward --binary --fuzz=0
--no-backup-if-mismatch
--reject-file=- --output=... -- <inputfile>
=item $parsed = AnyEvent::MCP::parse_patch_output $output
Parses C<LC_ALL=C> GNU patch C<--verbose> output without judging whether
the application is acceptable. C<$parsed> has two fields:
=over
=item hunks => [$hunk...]
lib/AnyEvent/MCP.pm view on Meta::CPAN
sysopen my $fh, $output, Fcntl::O_WRONLY () | Fcntl::O_CREAT () | Fcntl::O_EXCL (), 0600
or die "$output: $!\n";
close $fh or do { my $error = $!; unlink $output; die "$output: $error\n" };
my $cv = AE::cv ();
my $log;
my $process = eval {
AnyEvent::Util::run_cmd ([
"patch", "--verbose", "--batch", "--forward", "--binary", "--fuzz=0",
"--no-backup-if-mismatch", "--reject-file=-", "--output=$output", "--", $input,
],
"<" => \$normalized,
">" => \$log,
close_all => 1,
on_prepare => sub {
$ENV{LC_ALL} = "C";
chdir $directory or die "$directory: $!\n";
defined POSIX::dup2 (1, 2) or die "dup2: $!\n";
},
);
t/c27_users.t view on Meta::CPAN
sub cli {
run "bin/anyevent-mcp", "--config", $file, @_
}
my ($help_status, $help_text, $help_errors) = cli "--help";
is $help_status, 0, "user management help succeeds: $help_errors";
like $help_text, qr/--program NAME.*select \[program NAME\]/,
"help explains program scope";
like $help_text, qr/--instance NAME.*select \[instance NAME\]/,
"help explains instance scope";
like $help_text, qr/anyevent-mcp --program mcp-fs create-user backup/,
"help includes scoped user creation example";
($help_status, $help_text, $help_errors) = run "bin/mcp-multibroker", "--help";
is $help_status, 0, "multibroker help succeeds: $help_errors";
like $help_text, qr/--print-urls.*list URLs for all enabled users/,
"multibroker help advertises plural URL printing";
like $help_text, qr/--print-url=chatgpt/, "multibroker help shows exact user selection";
my $users = $config->users ("test", "mcp-test");
is_deeply $users, { default => { scope => "global", generation => 1 } },
"implicit default is an ordinary global generation-1 user";
vim/plugin/mcp-vim.vim view on Meta::CPAN
try
" Patch complete logical lines, independently of the buffer's &endofline.
" writefile(..., 'b') needs a final empty list item to write the last NL.
if writefile (old_lines + [''], oldfile, 'b')
throw 'rpc/patch_write_failed'
endif
" patch does all unified-diff parsing/matching. It never modifies the
" Vim buffer. Keep rejects out of the filesystem.
let cmd = 'LC_ALL=C patch --unified --batch --forward --get=0 --fuzz=0'
\ . ' --reject-file=- --no-backup-if-mismatch'
\ . ' -o ' . shellescape (newfile)
\ . ' ' . shellescape (oldfile)
\ . ' 2>&1'
let output = system (cmd, a:patch)
let status = v:shell_error
if status
throw printf (
\ 'rpc/patch_failed: exit=%d %s',
( run in 2.406 seconds using v1.01-cache-2.11-cpan-99fa8243a42 )