Use the MiniMax MCP server for web search.
Execution flow (installation is required the first time; subsequently, directly call it in step 4)
Step 1: Check and install dependencies
1.1 Check whether uvx is available
which uvx
If it does not exist, install uv:
Method 1: Use the official installation script (recommended)
curl -LsSf https://astral.sh/uv/install.sh | sh
Method 2: Use a domestic mirror for acceleration (if the official script download fails)
Temporarily use the Tsinghua mirror source for installation:
export UV_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"
curl -LsSf https://astral.sh/uv/install.sh | sh
Or temporarily use the Alibaba Cloud mirror source:
export UV_INDEX_URL="https://mirrors.aliyun.com/pypi/simple/"
curl -LsSf https://astral.sh/uv/install.sh | sh
1.2 Check whether the MCP server is already installed
uvx minimax-coding-plan-mcp --help
Run the command to determine whether the MCP server is already installed. If it is installed, skip to step 2.
1.3 Install the MCP server (if not installed)
Method 1: Install using the default source
uvx install minimax-coding-plan-mcp
Method 2: Use a domestic mirror for acceleration (if the default source download fails)
Temporarily use the Tsinghua mirror source:
export UV_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"
uvx install minimax-coding-plan-mcp
Or temporarily use the Alibaba Cloud mirror source:
export UV_INDEX_URL="https://mirrors.aliyun.com/pypi/simple/"
uvx install minimax-coding-plan-mcp
Step 2: Check the API Key configuration
cat ~/.openclaw/config/minimax.json 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('api_key', ''))"
If a non-empty API Key is returned, skip to step 4.
Step 3: Configure the API Key (if not configured)
3.1 Obtain the API Key from environment variables
echo $MINIMAX_API_KEY
If a non-empty API Key is returned, skip to step 3.3.
3.2 If no Key is found, ask the user for it
Directly ask the user to provide the MiniMax API Key. If MiniMax has not been purchased, the purchase address is: https://platform.minimaxi.com/subscribe/coding-plan?code=GjuAjhGKqQ&source=link
3.3 Save the API Key
mkdir -p ~/.openclaw/config
cat > ~/.openclaw/config/minimax.json << EOF
{
"api_key": "API密钥",
"output_path": "~/.openclaw/workspace/minimax-output"
}
EOF
Step 4: Use MCP for web search
4.1 Call web_search
Use the script to call the MCP service:
python3 {curDir}/scripts/web_search.py "<搜索查询>"
Example:
# 搜索今日新闻
python3 {curDir}/scripts/web_search.py "今天的热点新闻"
4.2 API parameter description
| Parameter | Description | Type |
|---|---|---|
| query | Search query string | string (required) |
Script description
Script location:{curDir}/scripts/web_search.py
Function:
- First read the API Key from the environment variable
MINIMAX_API_KEY, and if there is none, read it from~/.openclaw/config/minimax.jsonRead - Start the MCP server in stdio mode
- Send a JSON-RPC request to call the
web_searchtool - Return the formatted JSON result
Error handling:
- Prompt an error when the API Key is not configured
- Prompt the installation command when uvx is not installed
- Display stderr output when there is an MCP server error