Problem 1: format shadows builtin
text_to_audio() and music_generation() use format as a parameter name, which shadows the Python builtin format() function.
Exact location
minimax_mcp/server.py, functions text_to_audio() and music_generation()
def text_to_audio(
...
format: str = DEFAULT_FORMAT, # shadows builtin
):
Proposed fix
Rename to audio_format or output_format:
def text_to_audio(
...
audio_format: str = DEFAULT_FORMAT,
):
Problem 2: Manual CLI argument parser
The CLI argument parsing at module level uses a manual loop instead of argparse:
cli_args = {}
args = sys.argv[1:]
for i in range(len(args)):
if args[i].startswith("--"):
key_value = args[i][2:].split("=", 1)
...
Issues with manual parser
- No
--help support
- No validation of argument names
- No error messages for malformed arguments
- Inconsistent with
__main__.py which already uses argparse
Proposed fix
import argparse
def _parse_cli_args():
parser = argparse.ArgumentParser(description="MiniMax MCP Server")
parser.add_argument("--api-key", help="MiniMax API key")
parser.add_argument("--base-path", help="Output base path")
parser.add_argument("--api-host", help="API host URL")
parser.add_argument("--resource-mode", choices=["url", "local"], help="Resource mode")
parser.add_argument("--log-level", default="WARNING", help="Log level")
args, _ = parser.parse_known_args()
return vars(args)
Acceptance criteria
- No parameter names that shadow Python builtins
- CLI arguments parsed with
argparse with --help support
- Consistent argument handling between
server.py and __main__.py
Problem 1:
formatshadows builtintext_to_audio()andmusic_generation()useformatas a parameter name, which shadows the Python builtinformat()function.Exact location
minimax_mcp/server.py, functionstext_to_audio()andmusic_generation()Proposed fix
Rename to
audio_formatoroutput_format:Problem 2: Manual CLI argument parser
The CLI argument parsing at module level uses a manual loop instead of
argparse:Issues with manual parser
--helpsupport__main__.pywhich already usesargparseProposed fix
Acceptance criteria
argparsewith--helpsupportserver.pyand__main__.py