Skip to content

available_servers

CLI command for viewing available MCP servers.

This module defines the AvailableServersCmd class, which implements a command-line interface (CLI) command for viewing the available MCP servers. The output will include both built-in servers and plugin servers.

AvailableServersCmd

Bases: BaseCmd

CLI command for viewing available MCP servers.

This class adds the "available-servers" command to the main argument parser, allowing users to view available built-in and plugin MCP servers for MADA.

Methods:

Name Description
add_parser

Adds the "available-servers" subcommand and its arguments to the CLI parser.

process_command

Executes the logic for retrieving available servers using the parsed CLI arguments.

Source code in src/mada_tools/cli/commands/available_servers.py
class AvailableServersCmd(BaseCmd):
    """
    CLI command for viewing available MCP servers.

    This class adds the "available-servers" command to the main argument
    parser, allowing users to view available built-in and plugin MCP servers
    for MADA.

    Methods:
        add_parser:
            Adds the "available-servers" subcommand and its arguments to the
            CLI parser.
        process_command:
            Executes the logic for retrieving available servers using the
            parsed CLI arguments.
    """

    def add_parser(self, subparsers: ArgumentParser):
        """
        Add the parser for this command to the main `ArgumentParser`.

        Args:
            subparsers (ArgumentParser): A subparser object to add this command to.
        """
        available_servers: ArgumentParser = subparsers.add_parser(
            "available-servers",
            help="View available servers.",
            formatter_class=ArgumentDefaultsHelpFormatter,
        )
        available_servers.set_defaults(func=self.process_command)

    def process_command(self, args: Namespace):
        """
        Execute the logic for this CLI command.

        Args:
            args (Namespace): Parsed CLI arguments from the user.
        """
        # Create ServerManager (only needs state for stopping)
        manager = ServerManager()

        # Retrieve the available servers and print them out
        manager.print_available_servers()

add_parser(subparsers)

Add the parser for this command to the main ArgumentParser.

Parameters:

Name Type Description Default
subparsers ArgumentParser

A subparser object to add this command to.

required
Source code in src/mada_tools/cli/commands/available_servers.py
def add_parser(self, subparsers: ArgumentParser):
    """
    Add the parser for this command to the main `ArgumentParser`.

    Args:
        subparsers (ArgumentParser): A subparser object to add this command to.
    """
    available_servers: ArgumentParser = subparsers.add_parser(
        "available-servers",
        help="View available servers.",
        formatter_class=ArgumentDefaultsHelpFormatter,
    )
    available_servers.set_defaults(func=self.process_command)

process_command(args)

Execute the logic for this CLI command.

Parameters:

Name Type Description Default
args Namespace

Parsed CLI arguments from the user.

required
Source code in src/mada_tools/cli/commands/available_servers.py
def process_command(self, args: Namespace):
    """
    Execute the logic for this CLI command.

    Args:
        args (Namespace): Parsed CLI arguments from the user.
    """
    # Create ServerManager (only needs state for stopping)
    manager = ServerManager()

    # Retrieve the available servers and print them out
    manager.print_available_servers()