Skip to content

[Bug]: CLI help text rendering issues #259

@dwreeves

Description

@dwreeves

Overview

Hello, I'm the co-maintainer of rich-click, the CLI framework you use.

First, thanks for using us! We really appreciate it.

We are currently underway to release 1.9.0. mcpm is one of the more popular repos that uses rich-click and so your CLI is one of our integration test cases.

What happened?

To be clear, there are no bugs integrating mcpm with rich-click==1.9.0! I'm here to report an issue that predates rich-click 1.9.0.

Specifically, some of your help text does not render the way you probably want it to:

mcpm run --help

How this currently renders:

Image

How you probably want it to render:

Image

What you can do

Option 1.: Use markdown + fix help text

First, these are mutually incompatible options in rich_click_config.py:

click.rich_click.USE_RICH_MARKUP = True
click.rich_click.USE_MARKDOWN = True

Only one or the other is applied at a time.

If you want to use markdown, then you probably want to change the help text to contain bullet points

    """Execute a server from global configuration over stdio, HTTP, or SSE.

    Runs an installed MCP server from the global configuration. By default
    runs over stdio for client communication, but can run over HTTP with --http
    or over SSE with --sse.

    Examples:
    - mcpm run mcp-server-browse                    # Run over stdio (default)
    - mcpm run --http mcp-server-browse             # Run over HTTP on 127.0.0.1:6276
    - mcpm run --sse mcp-server-browse              # Run over SSE on 127.0.0.1:6276
    - mcpm run --http --port 9000 filesystem       # Run over HTTP on 127.0.0.1:9000
    - mcpm run --sse --port 9000 filesystem        # Run over SSE on 127.0.0.1:9000
    - mcpm run --http --host 0.0.0.0 filesystem    # Run over HTTP on 0.0.0.0:6276

    Note: stdio mode is typically used in MCP client configurations:
        {"command": ["mcpm", "run", "mcp-server-browse"]}
    """

So it renders like this:

Image

Option 2.: Use rich markup + rich-click>=1.9.0

rich-click 1.9.0 is implementing smarter (but basic) newline handling for non-markdown handling. Basically we use crude heuristics to guess when a single newline is a line continuation, or something that is a genuine newline (e.g. bullet point or code sample).

As long as the following two things are true...

  • rich_click.rich_click.TEXT_MARKUP = "rich" (or USE_RICH_MARKUP = True, but this is deprecated)
  • rich-click 1.9.0 is installed.

...Then without any additional changes to your help text, the help text is rendered like this:

Image

MCPM Version

v2.7.1

OS

macOS

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions