
    kKj                        d Z ddlZddlZddlZddlmZ ddlmZ ddlZddl	Z	ddl
mZ ddlmZ ddlmZ dd	lmZ  ee      Zddd
dddddededz  dee   dz  dee   dz  dededz  dedz  dedz  defdZdddd
dddddedeedz   ej2                  ddgd      f   deee   dz   ej2                  dd      f   deee   dz   ej2                  d d!      f   dee ej2                  d"d#      f   d$eedz   ej2                  d%d&      f   deedz   ej2                  d'd(      f   deedz   ej2                  d)d*      f   ddfd+Zy),z<Stdio command generation for FastMCP install using Cyclopts.    N)Path)	Annotated)print)
get_logger)UVEnvironment   )process_common_argsF)with_editablewith_packagescopypython_versionwith_requirementsprojectfileserver_objectr
   r   r   r   r   r   returnc                   	 t        ||xs g dgz   |||      }|r| j                          d| }	nt        | j                               }	|j                  dd|	g      }
t	        j
                  |
      }|r!t        j                  |       t        d       yt        j                  |       y# t        t        t        j                  f$ r}t        d| d       Y d	}~y
d	}~ww xY w)a  Generate the stdio command for running a FastMCP server.

    Args:
        file: Path to the server file
        server_object: Optional server object name (for :object suffix)
        with_editable: Optional list of directories to install in editable mode
        with_packages: Optional list of additional packages to install
        copy: If True, copy to clipboard instead of printing to stdout
        python_version: Optional Python version to use
        with_requirements: Optional requirements file to install from
        project: Optional project directory to run within

    Returns:
        True if generation was successful, False otherwise
    fastmcp)pythondependenciesrequirementsr   editable:runu.   [green]✓ Command copied to clipboard[/green]Tz'[red]Failed to generate stdio command: z[/red]NF)r   resolvestrbuild_commandshlexjoin	pyperclipr   
rich_printbuiltinsr   OSError
ValueErrorPyperclipException)r   r   r
   r   r   r   r   r   
env_configserver_specfull_commandcommand_stres                j/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/fastmcp/cli/install/stdio.pyinstall_stdior,      s    4"!'-2)<*"

 !\\^,Am_=Kdlln-K "//E;0OPjj.NN;'GH  NN;'Z!=!=> <QCvFGs   BB- B- -C$CC$)server_namer
   r   r   r   r   r   r'   r-   z--namez-nz;Custom name for the server (used for dependency resolution))namehelpz--with-editablezVDirectory with pyproject.toml to install in editable mode (can be used multiple times))r/   z--withz;Additional packages to install (can be used multiple times)z--copyz7Copy command to clipboard instead of printing to stdoutr   z--pythonz(Python version to use (e.g., 3.10, 3.11)z--with-requirementsz.Requirements file to install dependencies fromz	--projectz2Run the command within the given project directoryc          
         K   |xs g }|xs g }t        | ||g d       d{   \  }}	}
}}t        ||	||||||      }|st        j                  d       yy7 6w)a'  Generate the stdio command for running a FastMCP server.

    Outputs the shell command that an MCP host would use to start this server
    over stdio transport. Useful for manual configuration or debugging.

    Args:
        server_spec: Python file to run, optionally with :object suffix
    N)r   r   r
   r   r   r   r   r   r   )r	   r,   sysexit)r'   r-   r
   r   r   r   r   r   r   r   _namepackages	_env_dictsuccesss                 r+   stdio_commandr7   N   s     x "'RM!'RM<O[-T= 73D-) ##+	G  7s   AA7A)__doc__r"   r   r1   pathlibr   typingr   cycloptsr    richr   r!   fastmcp.utilities.loggingr   6fastmcp.utilities.mcp_server_config.v1.environments.uvr   sharedr	   __name__loggerr   listboolr,   	Parameterr7        r+   <module>rG      sr   B   
     $ 0 P '	H	 (,&*!%%)6
6:6 :$	6
 9t#6 6 $J6 d{6 D[6 
6D 	 	 	 	 	 	 	eNN d
D!N	
	N T
Ti	
	N" S	DX	
	#N. J	
	/N< d
;	
	=NJ !t!A	
	KNX tE	
	YNf 
gNrF   