WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
### Claude Desktop
Go to `Claude > Settings > Developer > Edit Config > claude_desktop_config.json` to include the following:

```
**Option 1: Using environment variables (traditional)**
```json
{
"mcpServers": {
"MiniMax": {
Expand All @@ -71,8 +72,34 @@ Go to `Claude > Settings > Developer > Edit Config > claude_desktop_config.json`
}
}
}
```

**Option 2: Using CLI arguments (recommended for GitHub Copilot CLI)**
```json
{
"mcpServers": {
"MiniMax": {
"command": "uvx",
"args": [
"minimax-mcp",
"-y",
"--api-key=insert-your-api-key-here",
"--base-path=/User/xxx/Desktop",
"--api-host=https://api.minimax.io",
"--resource-mode=url"
]
}
}
}
```

**CLI Arguments:**
- `--api-key`: MiniMax API key (overrides MINIMAX_API_KEY)
- `--base-path`: Local output directory path (overrides MINIMAX_MCP_BASE_PATH)
- `--api-host`: API host URL (overrides MINIMAX_API_HOST)
- `--resource-mode`: Resource mode [url|local] (overrides MINIMAX_API_RESOURCE_MODE)

CLI arguments take precedence over environment variables.
⚠️ Warning: The API key needs to match the host. If an error "API Error: invalid api key" occurs, please check your api host:
- Global Host:`https://api.minimax.io`
- Mainland Host:`https://api.minimaxi.com`
Expand Down
26 changes: 21 additions & 5 deletions minimax_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""

import os
import sys
import base64
import requests
import time
Expand All @@ -30,12 +31,27 @@
from minimax_mcp.exceptions import MinimaxAPIError, MinimaxRequestError
from minimax_mcp.client import MinimaxAPIClient

# Parse CLI arguments
cli_args = {}
args = sys.argv[1:]
for i in range(len(args)):
if args[i].startswith('--'):
key_value = args[i][2:].split('=', 1)
if len(key_value) == 2:
cli_args[key_value[0]] = key_value[1]
elif i + 1 < len(args) and not args[i + 1].startswith('--'):
cli_args[key_value[0]] = args[i + 1]

def get_config(cli_key: str, env_key: str, default: str = None) -> str:
"""Get config value with CLI args taking precedence over env vars."""
return cli_args.get(cli_key) or os.getenv(env_key) or default

load_dotenv()
api_key = os.getenv(ENV_MINIMAX_API_KEY)
base_path = os.getenv(ENV_MINIMAX_MCP_BASE_PATH) or "~/Desktop"
api_host = os.getenv(ENV_MINIMAX_API_HOST)
resource_mode = os.getenv(ENV_RESOURCE_MODE) or RESOURCE_MODE_URL
fastmcp_log_level = os.getenv(ENV_FASTMCP_LOG_LEVEL) or "WARNING"
api_key = get_config('api-key', ENV_MINIMAX_API_KEY)
base_path = get_config('base-path', ENV_MINIMAX_MCP_BASE_PATH, '~/Desktop')
api_host = get_config('api-host', ENV_MINIMAX_API_HOST)
resource_mode = get_config('resource-mode', ENV_RESOURCE_MODE, RESOURCE_MODE_URL)
fastmcp_log_level = get_config('log-level', ENV_FASTMCP_LOG_LEVEL, 'WARNING')

if not api_key:
raise ValueError("MINIMAX_API_KEY environment variable is required")
Expand Down