o
    
j                     @   sh  d dl Z d dlZd dlmZ d dlZd dlmZ d dlZe  dedB fddZdd Z	d d	e
dB fd
dZedkre Zejdddd ejddd ejdedd e ZeejZejrleejedd dS ejrrejne Zedu red ed ejddd eded  eed dZejeedd W d   dS 1 sw   Y  dS dS )!    N)Path)load_dotenvreturnc                  C   sz   t jdkrtt ddd} n&t jdkrtt ddd} nt jdr3ttjd	t d
 d} ndS |  r;| S dS )z2Get the Claude config directory based on platform.win32AppDataRoamingClaudedarwinLibraryzApplication SupportlinuxXDG_CONFIG_HOMEz.configN)	sysplatformr   home
startswithosenvirongetexists)path r   G/home/kuhnn/.local/lib/python3.10/site-packages/minimax_mcp/__main__.pyget_claude_config_path   s   

r   c                   C   s   t jS N)r   
executabler   r   r   r   get_python_path   s   r   api_keyc                 C   s   t t j}|d }t }| ptjd}|s1td td td td td t	
d d	d
ddg|dddii}|S )Nz	server.pyMINIMAX_API_KEYz#Error: Minimax API key is required.zPlease either:z2  1. Pass the API key using --api-key argument, orz5  2. Set the MINIMAX_API_KEY environment variable, orz*  3. Add MINIMAX_API_KEY to your .env file   
mcpServersMinimaxuvxzminimax-coding-plan-mcpzhttps://api.minimax.chat)r   MINIMAX_API_HOST)commandargsenv)r   __file__resolveparentr   r   r   r   printr   exit)r   
module_dirserver_pathpython_pathfinal_api_keyconfigr   r   r   generate_config!   s.   
r0   __main__z--print
store_truez1Print config to screen instead of writing to file)actionhelpz	--api-keyzIMinimax API key (alternatively, set MINIMAX_API_KEY environment variable))r4   z--config-pathz&Custom path to Claude config directory)typer4      )indentzCould not find Claude config path automatically. Please specify it using --config-path argument. The argument should be an absolute path of the claude_desktop_config.json file.r   T)parentsexist_okzWriting config tozclaude_desktop_config.jsonwr   )r   jsonpathlibr   r   dotenvr   argparser   r   strr0   __name__ArgumentParserparseradd_argument
parse_argsr$   r   r/   r)   dumpsconfig_pathclaude_pathr*   mkdiropenfdumpr   r   r   r   <module>   sT    !

"