-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Hi there,
The mcp-registry list command has been broken since mid-August. I finally got some time to triage the issue and found out that the list sub-command now awaits for hard-coded "down-arrow" keys.
In the UNIX philosophy, a tool or command does one thing, and does it good. In this case, pagination is the job of
lessormorecommands, or any other CLI command, that can be part of$LESSPIPEor$EDITORenvironment variables.
The issue here is that whenever I pipe the mcp-registry list, let's say to | grep, it does not show entire output at all. Also outputs "press down arrow for the next page" directly into the stdout (which is reserved for program output) contaminating the resulting data. (It should send this to the stderr, which is used for info/warning/error messages for the applications)
Refs:
smithy-java/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/commands/ListBundles.java
Lines 97 to 100 in c672f6c
System.out.println("Press down arrow for more..."); if (!waitForDownArrow()) { break; } smithy-java/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/commands/ListBundles.java
Lines 146 to 165 in c672f6c
private boolean waitForDownArrow() { try (Terminal terminal = TerminalBuilder.builder() .system(true) .dumb(true) .build()) { terminal.enterRawMode(); int ch = terminal.reader().read(); if (ch == 27) { int bracket = terminal.reader().read(); if (bracket == 91) { int arrow = terminal.reader().read(); return arrow == 66; } } return false; } catch (Exception e) { return false; } }
ThewaitForDownArrow()function also hard-codes some cryptic numbers within the function, seems to be equivalent to$'\x1b[B'escape-sequence. Which could've been more descriptive constant...
This is a critical bug that prevents automation and scripting, which is a primary use-case of CLI tools in the first place.