### Install and Configure minimax-coding-plan-mcp Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Install the package using pip or uvx. Set up required environment variables for API key and host. Example shows setting up a .env file. ```bash # Install with pip pip install minimax-coding-plan-mcp # Or run directly with uvx (no install needed) uvx minimax-coding-plan-mcp # Set up environment variables cp .env.example .env # Edit .env: # MINIMAX_API_KEY=your_api_key_here # MINIMAX_API_HOST=https://api.minimax.io # Global region # MINIMAX_API_HOST=https://api.minimaxi.com # Mainland China region ``` -------------------------------- ### Run MiniMax MCP Server as a Python Module Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Start the MiniMax MCP server by running it as a Python module. This requires setting the MINIMAX_API_KEY and MINIMAX_API_HOST environment variables. ```bash # Run as a Python module MINIMAX_API_KEY=your_key MINIMAX_API_HOST=https://api.minimax.io python -m minimax_mcp.server ``` -------------------------------- ### MinimaxAPIClient GET and Multipart Upload Requests Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Demonstrates making GET requests and performing multipart file uploads using the `MinimaxAPIClient`. The client automatically handles content types for file uploads. ```python # GET request example response = client.get("/v1/some/endpoint", params={"key": "value"}) ``` ```python # Multipart file upload (Content-Type set automatically) with open("image.jpg", "rb") as f: response = client.post( "/v1/some/upload/endpoint", files={"file": ("image.jpg", f, "image/jpeg")}, data={"param": "value"} ) ``` -------------------------------- ### Run MiniMax MCP Server via Entry Point Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Execute the MiniMax MCP server directly using the command-line entry point. This method is typically used by MCP clients and supports stdio transport. Environment variables like MINIMAX_API_KEY and MINIMAX_API_HOST are required. ```bash # Run via entry point (stdio transport, used by MCP clients) MINIMAX_API_KEY=your_key MINIMAX_API_HOST=https://api.minimax.io minimax-coding-plan-mcp ``` -------------------------------- ### Generate MCP Client Configuration with CLI Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Use the CLI utility to auto-generate `claude_desktop_config.json`. Options include specifying API key, printing to stdout, or setting a custom config path. ```bash # Auto-generate claude_desktop_config.json for the current OS python -m minimax_mcp --api-key your_api_key_here # Print config to stdout instead of writing to file python -m minimax_mcp --api-key your_api_key_here --print # Specify a custom config path python -m minimax_mcp --api-key your_api_key_here --config-path /path/to/Claude/ # Expected output (macOS example): # Writing config to /Users/username/Library/Application Support/Claude/claude_desktop_config.json ``` -------------------------------- ### Programmatic Web Search with MinimaxAPIClient Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Perform a web search directly using the `MinimaxAPIClient`. Requires setting environment variables for API key and host. The response includes organic results and related searches. ```python # Direct server usage (programmatic, without MCP client) import os from minimax_mcp.client import MinimaxAPIClient import json client = MinimaxAPIClient( api_key=os.environ["MINIMAX_API_KEY"], api_host=os.environ["MINIMAX_API_HOST"] # e.g. "https://api.minimax.io" ) response = client.post("/v1/coding_plan/search", json={"q": "Python asyncio best practices 2025"}) print(json.dumps(response, indent=2, ensure_ascii=False)) # Expected response structure: # { # "organic": [ # { # "title": "Asyncio in Python: A Complete Walkthrough", # "link": "https://realpython.com/async-io-python/", # "snippet": "Learn how to use asyncio for concurrent code ...", # "date": "2025-01-15" # }, # ... # ], # "related_searches": [ # { "query": "Python asyncio vs threading" }, # { "query": "asyncio event loop Python 3.11" } # ], # "base_resp": { # "status_code": 0, # "status_msg": "success" # } # } ``` -------------------------------- ### Configure MCP Server for Claude Desktop Source: https://github.com/minimax-ai/minimax-coding-plan-mcp/blob/main/README.md Add this configuration to your claude_desktop_config.json file to enable the MCP client. Ensure your API key and host are correctly set for your region to avoid 'Invalid API key' errors. ```json { "mcpServers": { "MiniMax": { "command": "uvx", "args": [ "minimax-coding-plan-mcp", "-y" ], "env": { "MINIMAX_API_KEY": "insert-your-api-key-here", "MINIMAX_API_HOST": "api host, https://api.minimax.io | https://api.minimaxi.com" } } } } ``` -------------------------------- ### Run MiniMax MCP Server Using a .env File Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Configure the MiniMax MCP server by utilizing a .env file for environment variables, which are automatically loaded by python-dotenv. This simplifies configuration management for API keys and host settings. ```bash # Using a .env file (python-dotenv loads it automatically on import) cat > .env <;base64,` string suitable for the MiniMax VLM API. This function is used internally by `understand_image` but can be used standalone. ### Usage ```python from minimax_mcp.utils import process_image_url from minimax_mcp.exceptions import MinimaxRequestError # From HTTPS URL (downloads and base64-encodes) data_url = process_image_url("https://example.com/photo.jpg") # From local PNG file data_url = process_image_url("./assets/diagram.png") # From local WebP file data_url = process_image_url("/home/user/images/photo.webp") # Pass-through for existing base64 data URL existing = "data:image/png;base64,iVBORw0KGgo..." result = process_image_url(existing) # Strip @ prefix (MCP client convention) data_url = process_image_url("@Documents/screenshot.jpg") # Error cases try: process_image_url("https://broken.url/missing.jpg") except MinimaxRequestError as e: print(e) try: process_image_url("/nonexistent/image.png") except MinimaxRequestError as e: print(e) ``` ### Parameters - **image_source** (str) - Required - The source of the image (URL, local path, or base64 data URL). ### Response - **str** - A base64 encoded data URL string of the image. ``` -------------------------------- ### MinimaxAPIClient Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt A reusable HTTP client for the MiniMax API, featuring Bearer token authentication, custom headers, automatic content-type switching, and structured error handling. ```APIDOC ## `MinimaxAPIClient` ### Description A reusable HTTP client wrapping `requests.Session` with Bearer token authentication, a custom `MM-API-Source` header, automatic JSON/multipart content-type switching, and structured error handling for MiniMax API status codes. ### Initialization ```python from minimax_mcp.client import MinimaxAPIClient client = MinimaxAPIClient( api_key="your_api_key_here", api_host="https://api.minimax.io" ) ``` ### Methods #### `post(endpoint, **kwargs)` Sends a POST request to the specified endpoint. - **endpoint** (str) - Required - The API endpoint path. - **kwargs** - Optional - Additional arguments passed to `requests.post`, such as `json`, `files`, or `data`. #### `get(endpoint, **kwargs)` Sends a GET request to the specified endpoint. - **endpoint** (str) - Required - The API endpoint path. - **kwargs** - Optional - Additional arguments passed to `requests.get`, such as `params`. ### Usage Examples ```python from minimax_mcp.exceptions import MinimaxAuthError, MinimaxRequestError # POST request with JSON body try: data = client.post("/v1/coding_plan/search", json={"q": "MCP protocol spec"}) print(data["organic"][0]["title"]) except MinimaxAuthError as e: # status_code 1004: API key / host region mismatch print(f"Auth error: {e}") except MinimaxRequestError as e: # status_code 2038: real-name verification required # or other API / network errors print(f"Request error: {e}") # GET request example response = client.get("/v1/some/endpoint", params={"key": "value"}) # Multipart file upload (Content-Type set automatically) with open("image.jpg", "rb") as f: response = client.post( "/v1/some/upload/endpoint", files={"file": ("image.jpg", f, "image/jpeg")}, data={"param": "value"} ) ``` ### Error Handling - **MinimaxAuthError**: Raised for authentication errors (e.g., invalid API key, host mismatch). - **MinimaxRequestError**: Raised for general API or network errors (e.g., verification required, invalid request). ``` -------------------------------- ### MinimaxAPIClient POST Request with JSON Body Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Use the `MinimaxAPIClient` to make POST requests with a JSON body. Handles authentication, headers, and error handling for MiniMax API status codes. ```python from minimax_mcp.client import MinimaxAPIClient from minimax_mcp.exceptions import MinimaxAuthError, MinimaxRequestError client = MinimaxAPIClient( api_key="your_api_key_here", api_host="https://api.minimax.io" ) # POST request with JSON body try: data = client.post("/v1/coding_plan/search", json={"q": "MCP protocol spec"}) print(data["organic"][0]["title"]) except MinimaxAuthError as e: # status_code 1004: API key / host region mismatch print(f"Auth error: {e}") except MinimaxRequestError as e: # status_code 2038: real-name verification required # or other API / network errors print(f"Request error: {e}") ``` -------------------------------- ### Handle MiniMax API Errors Broadly and Specifically Source: https://context7.com/minimax-ai/minimax-coding-plan-mcp/llms.txt Catch all MiniMax errors using the base MinimaxAPIError class or handle specific error types like MinimaxAuthError and MinimaxRequestError for more granular control. Specific error handling can provide tailored user feedback. ```python from minimax_mcp.exceptions import ( MinimaxAPIError, MinimaxAuthError, MinimaxRequestError, MinimaxTimeoutError, MinimaxValidationError, MinimaxMcpError, ) # Catch all MiniMax errors broadly try: result = client.post("/v1/coding_plan/vlm", json={"prompt": "describe", "image_url": "..."}) except MinimaxAPIError as e: print(f"MiniMax error: {e}") # Or handle specific error types try: result = client.post("/v1/coding_plan/search", json={"q": "test"}) except MinimaxAuthError: print("Check your API key and ensure it matches the selected API host region.") except MinimaxRequestError as e: if "real-name verification" in str(e): print("Complete verification at https://platform.minimaxi.com/user-center/basic-information") else: print(f"Request failed: {e}") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.