
    kKj              ,          d Z ddlZddlZddlZddl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mZ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Zdd	lmZ dd
lmZ ddlmZmZm Z  ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3  e/d      Z4 e       Z5 ejl                  ddejn                   ed            Z8d Z9de:de;e:e:f   fdZ<e
de=e:   dz  fd       Z>e8j~                  d d!d"ee@ ej$                  d#d$%      f   fd&       ZA ejl                  d'd()      ZBeBj~                  	 dddddddddd*dd d+d,e:dz  d-ee=e   dz   ej$                  d.d/%      f   d0ee=e:   dz   ej$                  d1d2%      f   d3ee:dz   ej$                  d4d5%      f   d6eeCdz   ej$                  d7d8%      f   d9eeCdz   ej$                  d:d;%      f   d<ee:dz   ej$                  d=d>%      f   d?eedz   ej$                  d@dA%      f   dBeedz   ej$                  dCdD%      f   dEee@ ej$                  dFdGdHI      f   dJee=e   dz   ej$                  dKdL%      f   dMee@ ej$                  dNdOgdP)      f   ddfdQ       ZDeBj~                  dRdSd*dTd*dUd,e:dVeeC ej$                  dWdX%      f   dYeeC ej$                  dZd[%      f   dEee@ ej$                  dFdHd\]      f   d^ee: ej$                  d_d`%      f   daee@ ej$                  dbdcdd]      f   ddfde       ZEe8j~                  	 ddddddd ddddd d d dd d dfd,e:dz  dge:dheej                  dz   ej$                  didjgdk)      f   d^ee:dz   ej$                  d_dl%      f   dmeeCdz   ej$                  dndogdp)      f   dqee:dz   ej$                  drds%      f   dteedu   dz   ej$                  dvdwgdx)      f   dyee@ ej$                  dzd{%      f   d<ee:dz   ej$                  d=d>%      f   d0ee=e:   dz   ej$                  d1d2%      f   dBeedz   ej$                  dCdD%      f   d?eedz   ej$                  d@dA%      f   d|ee@ ej$                  d}d~%      f   dee@ ej$                  dd%      f   dEee@ ej$                  dFdHd]      f   dJee=e   dz   ej$                  dKdL%      f   dee@ ej$                  dd%      f   dMee@ ej$                  dNdOgdP)      f   ddf&d       Ze8j~                  	 dddddddd dd,e:dz  dee+dz   ej$                  ddgd)      f   deedz   ej$                  ddgd)      f   d<ee:dz   ej$                  d=d>%      f   d0ee=e:   dz   ej$                  d1d2%      f   dBeedz   ej$                  dCdD%      f   d?eedz   ej$                  d@dA%      f   dee@ ej$                  dd%      f   ddfd       ZG ejl                  dBd)      ZHeHj~                  	 	 	 ddee:dz   ej$                  d%      f   dee:dz   ej$                  d%      f   d|ee@ ej$                  d%      f   ddfd       ZIe8j                  eB       e8j                  eH       e8j                  e$       e8j                  e&       e8j                  e d       e8j                  ed       e8j                  ed       e8j                  e"d       e8j                  e       eJdk(  r e8        yy)z!FastMCP CLI tools using Cyclopts.    N)contextmanagerPath)	AnnotatedLiteral)	Parameter)Console)Table)run)auth_app)call_commanddiscover_commandlist_command)generate_cli_command)install_app)	tasks_app)is_already_in_uv_subprocessload_and_merge_config)InspectFormatformat_infoinspect_fastmcp)
get_logger)MCPServerConfig)check_for_newer_versionclifastmcpzBFastMCP - The fast, Pythonic way to build MCP servers and clients. )negative)namehelpversiondefault_parameterc                      t         j                  dk(  r&dD ]   } 	 t        j                  | dgdd       | c S  yy# t        j                  t
        f$ r Y @w xY w)z5Get the correct npx command for the current platform.win32)znpx.cmdznpx.exenpxz	--versionT)checkcapture_outputNr%   )sysplatform
subprocessr   CalledProcessErrorFileNotFoundError)cmds    `/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/fastmcp/cli/cli.py_get_npx_commandr/   1   s_    
||w0C[1dS
 1  113DE s   ;AAenv_varreturnc                 <   d| vr*t         j                  d       t        j                  d       | j	                  dd      \  }}|j                         s*t         j                  d       t        j                  d       |j                         |j                         fS )z6Parse environment variable string in format KEY=VALUE.=z6Invalid environment variable format. Must be KEY=VALUE   z8Invalid environment variable format. KEY cannot be empty)loggererrorr(   exitsplitstrip)r0   keyvalues      r.   _parse_env_varr<   ?   sn    
'MNsA&JC99;OP99;%%    argsc              #      K   | Ct         j                  dd }	 t         j                  d   g| t         _        d |t         _        yd y# |t         _        w xY ww)a:  Temporarily replace sys.argv if args provided.

    This context manager is used at the CLI boundary to inject
    server arguments when needed, without mutating sys.argv deep
    in the source loading logic.

    Args are provided without the script name, so we preserve sys.argv[0]
    and replace the rest.
    Nr   )r(   argv)r>   originals     r.   	with_argvrB   K   sN      88A;	 +d+CHCH  CHs   A#A AAAF)copyrC   z--copyz%Copy version information to clipboard)r    c                    t         j                  t        j                  j	                  d      t        j                         t        j
                         t        t         j                  xs d      j                         j                  d   d}t        j                  d      }|j                  dd	       |j                  d
d	       |j                         D ]3  \  }}|j                  |dz   t!        |      j#                  dd             5 | rqt%        ddd      }|j'                         5 }|j)                  |       ddd       t+        j,                  j/                                t0        j)                  d       yt0        j)                  |       t3               x}rCt0        j)                          t0        j)                  d| d       t0        j)                  d       yy# 1 sw Y   xY w)z1Display version information and platform details.mcp.r4   )zFastMCP versionzMCP versionzPython versionPlatformzFastMCP root path)r   r4   )paddingboldleft)stylejustifycyanright:
 NF)fileforce_terminallegacy_windowsu:   [green]✓[/green] Version information copied to clipboardu3   [bold]🎉 FastMCP update available:[/bold] [green]z[/green]z-[dim]Run: pip install --upgrade fastmcp[/dim])r   __version__	importlibmetadatar!   r)   python_versionr   __file__resolveparentsr
   grid
add_columnitemsadd_rowstrreplacer	   captureprint	pypercliprC   getconsoler   )rC   infogkvplain_consolerb   newer_versions           r.   r!   r!   b   s{    #.. ))11%8"113%%'!'"2"2"9c:BBDLLQOD 	

6"ALLvvL.LLvwL/

1			!c'3q6>>$45  T%PUV""$" %w{{}%RSa 455=5MMOMMEm_T\] MMIJ 6 %$s   0G((G1devz!Development tools for MCP servers)r   r    T)with_editablewith_packagesinspector_versionui_portserver_portpythonwith_requirementsprojectreload
reload_dirmoduleserver_specrn   z--with-editablez\Directory containing pyproject.toml to install in editable mode (can be used multiple times)ro   z--withz;Additional packages to install (can be used multiple times)rp   z--inspector-versionz#Version of the MCP Inspector to userq   z	--ui-portzPort for the MCP Inspector UIrr   z--server-portz'Port for the MCP Inspector Proxy serverrs   z--pythonz(Python version to use (e.g., 3.10, 3.11)rt   z--with-requirementsz.Requirements file to install dependencies fromru   z	--projectz2Run the command within the given project directoryrv   --reloadz7Enable auto-reload on file changes (enabled by default)--no-reload)r    r   rw   --reload-dirz=Directories to watch for changes (default: current directory)rx   --modulez-mzMRun a Python module (python -m <module>) instead of importing a server objectc                  K   	 t        | ||xs g |||r|D cg c]  }t        |       c}nd|      \  }} |s|j                  j                  }t        j                  d| j                  j                  |j                  j                  ||d       	 |s*t        j                  d       t        j                  d       |J |s"|j                  j                          d{    i }|rt        |      |d<   |rt        |      |d	<   t               }|s*t        j                  d
       t        j                  d       d}|r|d| z  }dd| dg}|r|j!                  d       |	r6|j!                  d       |
r#|
D ]  }|j#                  dt        |      g         |j                  j%                  |      }t'        t(        j*                  j-                               |z  ddiz  }t/        j0                  ||g|d|      }t        j                  |j2                         yc c}w # t        $ r t        j                  d       Y w xY w7 j# t.        j4                  $ r`}t        j                  dt        |       t        |      |j2                  d       t        j                  |j2                         Y d}~yd}~wt        $ r: t        j                  ddt        |       i       t        j                  d       Y yw xY ww)zRun an MCP server with the MCP Inspector for development.

    Args:
        server_spec: Python file to run, optionally with :object suffix, or None to auto-detect fastmcp.json
    N)rs   ro   rt   ru   editableportr4   zStarting dev server)ry   rn   ro   rq   rr   extraNo configuration availableCLIENT_PORTSERVER_PORTzbnpx not found. Please ensure Node.js and npm are properly installed and added to your system PATH.z@modelcontextprotocol/inspector@r   r   --no-bannerr}   rz   r|   FASTMCP_UV_SPAWNED1Tr&   envzDev server failed)rR   r6   
returncodeznpx not found. Please ensure Node.js and npm are properly installed and added to your system PATH. You may need to restart your terminal after installation.rR   )r   r`   
deploymentr   r,   r(   r7   r5   debugenvironmentr   dependenciesr6   sourceload_serverr/   appendextendbuild_commanddictosenvironr^   r*   r   r   r+   )ry   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   pconfigenv_varsnpx_cmdinspector_cmdfastmcp_cmddir_pathuv_cmdr   processes                          r.   	inspectorr      s    p3'-2/8Em4mc!fm44
  ++00K
 LL&#//88#//<<&
  	JLL56HHQK!!! --++---&)'lH]#&)+&6H]# #$LL1 HHQK9q!2 344M !%mD z* z* *H&&H'FG !+ ##11+> 2::##%&15I34OO ..m-f-

 	##$] 5  . .` (( 	K(Qll 	 	
 	 " 3{+,	 	 	
 	s   L	H* H%&H* AL	AI %I&D>I $L	%H* *IL	IL	I L%AK ;L	 ALL	LL	i@  i  z	127.0.0.1mcp_portdev_portrv   host	log_panelr   z
--mcp-portzPort for the user's MCP serverr   z
--dev-portzPort for the FastMCP dev UIz*Auto-reload the MCP server on file changes)r   r    r   --hostzHost to bind tor   z--log-panelz--no-log-panelz#Log panel feature in FastMCP dev UIc                   K   	 ddl }ddlm}  || |||||       d{    y# t        $ r- t        j                  d       t	        j
                  d       Y Rw xY w7 >w)a  Preview a FastMCPApp UI in the browser.

    Starts the MCP server from SERVER_SPEC on --mcp-port, launches a local
    dev UI on --dev-port with a tool picker and AppBridge host, then opens
    the browser automatically.

    Requires fastmcp[apps] to be installed (prefab-ui).
    r   NzNfastmcp dev apps requires prefab-ui. Install with: pip install 'fastmcp[apps]'r4   )run_dev_appsr   )	prefab_uiImportErrorr5   r6   r(   r7   fastmcp.cli.apps_devr   )ry   r   r   rv   r   r   r   r   s           r.   appsr   S  sj     d 2
    \	
 		s/   A % A AA 3AA AA )	transportr   r   path	log_level	no_bannerrs   ro   ru   rt   skip_sourceskip_envrv   rw   	statelessrx   server_argsr   --transportz-tzTransport protocol to usez>Host to bind to when using http transport (default: 127.0.0.1)r   --portz-pz9Port to bind to when using http transport (default: 8000)r   --pathzZThe route path for the server (default: /mcp/ for http transport, /sse/ for sse transport)r   )DEBUGINFOWARNINGERRORCRITICAL--log-levelz-lz	Log levelr   r   zDon't show the server bannerr   z--skip-sourcezBSkip source preparation step (use when source is already prepared)r   
--skip-envzRSkip environment configuration (for internal use when already in a uv environment)z5Enable auto-reload on file changes (development mode)r   --statelessz>Run in stateless mode (no session, used internally for reload)c                  K   |r| *t         j                  d       t        j                  d       g }||j	                  d       ||j	                  d       ||j	                  d       ||j	                  d       |r(t         j                  dd	j                  |       d
       d}|sCt               s9ddlm	}  |||xs d|
|	      }dg}|j                  |      |k7  r|j                  }|rdd| ddg}|r|j                  d|g       |r|j	                  d       ||j	                  d       |r"|j	                  d       |j                  |       | ||      }t        j                  ||d       d{    yt        j                  | ||rt        |             yd       y|s
t               rd}	 t!        | ||xs g |
|	||||||rt        |      nd      \  }} ||nj$                  j&                  }||nj$                  j(                  }||nj$                  j*                  }||nj$                  j,                  }||nj$                  j.                  }|xs j$                  j0                  }|r|nt2        j4                  j6                   }t         j9                  d| ||||||rt        |      ng d       |rl|dk(  rt         j                  d       nPdd| g}|r|j                  d|g       |d k7  rH||j                  d|g       ||j                  dt;        |      g       ||j                  d|g       |r|j                  d|g       |r|j	                  d       |j	                  d       |j	                  d!       dg}j<                  j                  |      |k7  xr | } | r|j	                  d       |r"|j	                  d       |j                  |       | r|j<                  j                  |      }|d"v }!t        j                  |||!       d{    ydg}j<                  j                  |      |k7  xr | } | rgdd| g}"|r|"j                  d|g       |d k7  rH||"j                  d|g       ||"j                  dt;        |      g       ||"j                  d|g       |r|"j                  d|g       |r|"j	                  d       |r|"j	                  d!       |"j	                  d       |r"|"j	                  d       |"j                  |       |j<                  j                  |"      }#t>        j@                  d#d$iz  }t         j9                  d%d&j                  |#              	 tC        jD                  |#d|'      }$t        j                  |$jF                         y	 t        jL                  | ||||||rt        |      ng | ||*
       d{    y7 # t"        $ r t        j                  d       Y Aw xY w7 # tB        jH                  $ rZ}%t         jK                  d(|% | t;        |%      |%jF                  d)       t        j                  |%jF                         Y d}%~%yd}%~%ww xY w7 # tN        $ rE}%t         jK                  d(|% | t;        |%      d+       t        j                  d       Y d}%~%yd}%~%ww xY ww),a  Run an MCP server or connect to a remote one.

    The server can be specified in several ways:
    1. Module approach: "server.py" - runs the module directly, looking for an object named 'mcp', 'server', or 'app'
    2. Import approach: "server.py:app" - imports and runs the specified server object
    3. URL approach: "http://server-url" - connects to a remote server and creates a proxy
    4. MCPConfig file: "mcp.json" - runs as a proxy server for the MCP Servers in the MCPConfig file
    5. FastMCP config: "fastmcp.json" - runs server using FastMCP configuration
    6. No argument: looks for fastmcp.json in current directory
    7. Module mode: "-m my_module" - runs the module directly via python -m

    Server arguments can be passed after -- :
    fastmcp run server.py -- --config config.json --debug

    Args:
        server_spec: Python file, object specification (file:obj), config file, URL, or None to auto-detect
    Nz2A module name is required when using --module / -mr4   r   r   r   r   zOptions z, zL are ignored in module mode (-m). The module manages its own server startup.r   )UVEnvironment)rs   r   requirementsru   testr   r   r}   r{   r   r   r   z--T)reload_dirsis_stdio)env_command_builder
extra_args)
rs   ro   rt   ru   r   r   r   r   r   r   zRunning server or client)ry   r   r   r   r   r   r   r   ssez--reload is not supported with SSE transport (sessions are lost on restart). Use streamable-http transport instead, or use --no-reload. Running without reload.stdior   )r   Nr   r   zRunning command: rQ   r   zFailed to run: )ry   r6   r   )
ry   r   r   r   r   r   r   show_bannerr   r   ry   r6   )(r5   r6   r(   r7   r   warningjoinr   6fastmcp.utilities.mcp_server_config.v1.environments.uvr   r   r   
run_modulerun_with_reloadrun_module_commandlistr   r,   r   r   r   r   r   r   r>   r   settingsshow_server_bannerr   r`   r   r   r   r*   r   r   r+   	exceptionrun_command	Exception)&ry   r   r   r   r   r   r   rs   ro   ru   rt   r   r   rv   rw   r   rx   r   ignored_optionsenv_builderr   r   test_cmd
reload_cmdr   final_transport
final_host
final_port
final_pathfinal_log_levelfinal_server_argsfinal_no_bannerneeds_uvr   	inner_cmdr-   r   r   s&                                         r.   r   r     sK    J LLMNHHQK &( ""=1""8,""8,""8,NN499_56 7C D  ; =  *2d.	C xH  *h6!//#UK]SJ!!=)"<=!!-0&!!,/!!$'!!+.&(4
,,
T   %% +,7tK(	

 	 >B	

 	 .03'-2/-8[)d
$ *	0A0A0K0K  )v/@/@/E/EJ)v/@/@/E/EJ)v/@/@/E/EJ*	0A0A0K0K  $=v'8'8'='= 	(8(8(K(K$K  LL"&((6G4 12R
   e#NN* $UK8J!!=/"BC'))%%x&<=)%%xZ&AB)%%x&<=!!=/"BC!!-0m,m, xH""00:hFWx<  !!,/ !!$'!!"34#//==jI
&/9H,,
X    xH!!//9XEVh,H{3	 m_=>g%%  (J!78%  (C
O!<=%  (J!78m_=>]+]+& T"./   ..y9 jj0#66 	(#89	# nnS#>GHHW''(	(('))7HD!23b //'#  [>  ^d ,, 		#!!%#. V"#,,   HHQ\\""		#  	!!%#. V   HHQKK	s   E<[4>X??[4?*X	 )I[49X.:E[47X1 [40Z#  Z!Z# [4	X+'[4*X++[41ZAZ[4Z[4!Z# #	[1,;[,'[4,[11[4)formatoutputrs   ro   ru   rt   r   r   --formatz-fzXOutput format: fastmcp (FastMCP-specific) or mcp (MCP protocol). Required when using -o.r   --outputz-ozbOutput file path for the JSON report. If not specified, outputs to stdout when format is provided.c                X  K   |s
t               rd}	 t        | ||xs g ||      \  }} | j                  d      rc|a	 t        t	        |             5 }	t        j                  |	      }
ddd       d
v r*t        j                  d       t        j                  d       dg}j                  j                  |      |k7  xr | }|rd	d
| dg}|r|j                  d|j                   g       |r|j                  dt#        |      g       ddl}|j                  j                  |      }t&        j(                  ddiz  } |j*                  |d|      }t        j                  |j,                         t        j/                  d| ||rt#        |      ndd       	 |s*t        j                  d       t        j                  d       |J |j0                  j3                          d{   }t5        |       d{   }|rA|s?t6        j9                  d       t6        j9                  d       t        j                  d       |t6        j9                          t6        j9                  d       t6        j9                  d|j:                          |j<                  r"t6        j9                  d|j<                          |j>                  r"t6        j9                  d|j>                          |j@                  r+t6        j9                  dtC        |j@                                t6        j9                  d|jD                          |jF                  r"t6        j9                  d|jF                          t6        j9                          t6        j9                  d       t6        j9                  d tC        |jH                                t6        j9                  d!tC        |jJ                                t6        j9                  d"tC        |jL                                t6        j9                  d#tC        |jN                                t6        j9                          t6        j9                  d$       t6        j9                  d%|jP                          t6        j9                  d&|jR                          t6        j9                          t6        j9                  d'       ytU        |||       d{   }|r|jV                  jY                  dd(       |j                  d)      5 }	|	j[                  |       ddd       t        j]                  d*|        t6        j9                  d+| d,       t6        j9                  d-|j:                   d.       t6        j9                  d/|j                           yt6        j9                  |j_                  d0             y# 1 sw Y   txY w# t
        j                  t        f$ r Y ew xY w# t        $ r t        j                  d       Y w xY w7 E7 57 C# 1 sw Y   xY w# t`        $ r]}t        jc                  d1| | t#        |      d2       t6        j9                  d3|        t        j                  d       Y d}~yd}~ww xY ww)4a  Inspect an MCP server and display information or generate a JSON report.

    This command analyzes an MCP server. Without flags, it displays a text summary.
    Use --format to output complete JSON data.

    Examples:
        # Show text summary
        fastmcp inspect server.py

        # Output FastMCP format JSON to stdout
        fastmcp inspect server.py --format fastmcp

        # Save MCP protocol format to file (format required with -o)
        fastmcp inspect server.py --format mcp -o manifest.json

        # Inspect from fastmcp.json configuration
        fastmcp inspect fastmcp.json
        fastmcp inspect  # auto-detect fastmcp.json

    Args:
        server_spec: Python file to inspect, optionally with :object suffix, or fastmcp.json
    T)rs   ro   rt   ru   z.jsonN
mcpServersz4MCPConfig files are not supported by inspect commandr4   r   r   inspectr   r   r   r   r   r   r   zInspecting server)ry   r   r   r   r   zG[bold red]Error:[/bold red] --format is required when using -o/--outputzL[dim]Use --format fastmcp or --format mcp to specify the output format[/dim]z[bold]Server[/bold]z  Name:         z  Version:      z  Website:      z  Icons:        z  Generation:   z  Instructions: z[bold]Components[/bold]z  Tools:        z  Prompts:      z  Resources:    z  Templates:    z[bold]Environment[/bold]z  FastMCP:      z  MCP:          z?[dim]Use --format \[fastmcp|mcp] for complete JSON output[/dim])r[   exist_okwbz,Server inspection complete. Report saved to u?   [bold green]✓[/bold green] Server inspection saved to: [cyan][/cyan]z  Server: [bold]z[/bold]z
  Format: zutf-8zFailed to inspect server: r   u3   [bold red]✗[/bold red] Failed to inspect server: )2r   r   endswithopenr   jsonloadr5   r6   r(   r7   JSONDecodeErrorr,   r   r   r   r;   r`   r*   r   r   r   r   r   r   r   r   rf   rc   r   r!   website_urliconslenserver_generationinstructionstoolsprompts	resources	templatesfastmcp_versionmcp_versionr   parentmkdirwriterg   decoder   r   )ry   r   r   rs   ro   ru   rt   r   r   fdatar   r   inspect_commandr*   r-   r   r   serverrg   formatted_jsonr   s                         r.   r   r     s}    Z .03'-2/
 (V^${+,99Q<D -4'LL!WXHHQK xH!!//9XEVh,H 	
 ""J#=>""JF#<= 	  ..?jj0#66 *..Dc:##$
LL&%+c&k
  \LL56HHQK!!!}}0022 %V,, &MMY MM^ HHQK >MMO MM/0MM,TYYK89|| 0?@ 01A1A0BCDzz 0TZZ0ABCMM,T-C-C,DEF   01B1B0CDEMMO MM34MM,S_,=>?MM,S->,?@AMM,S-@,ABCMM,S-@,ABCMMO MM45MM,T-A-A,BCDMM,T-=-=,>?@MMOMMR   +664@@ MMt< T"a' # KKFvhOP MMQRXQYY`a MM,TYYKw?@MMJv||n56 MM.//89E -,
 ((*;<   ^ 3 -f A #"  	(,*Q 	 	
 	KA3OP	s   Z**X W& W'6W& C;Z*AY &X+'Y 9X.:K#Y Z*Y .X1/4Y #X45A>Y 3Z*4$Y Z*W#W& &X?X XX X($Z*'X((Z*+Y .Y 1Y 4X>9Y 	Z'
AZ"Z*"Z''Z*zManage FastMCP projectsconfig_pathz'Path to fastmcp.json configuration file
output_dirz1Directory to create the persistent environment inz)Skip source preparation (e.g., git clone)c           	      @  K   ddl m} |*t        j                  d       t	        j
                  d       | dt        j                         }|r$t        |      } t        j                  d|         n*t        j                  d       t	        j
                  d       | J  ||       }|j                         s-t        j                  d|         t	        j
                  d       |J  ||      }	 t        j                  |      }|j                  ||	       d{    t        j                  d
| d|  d| d       y7 $# t        $ rO}t        j                  d|        t        j                  d|        t	        j
                  d       Y d}~yd}~ww xY ww)a  Prepare a FastMCP project by creating a persistent uv environment.

    This command creates a persistent uv project with all dependencies installed:
    - Creates a pyproject.toml with dependencies from the config
    - Installs all Python packages into a .venv
    - Prepares the source (git clone, download, etc.) unless --skip-source

    After running this command, you can use:
    fastmcp run <config> --project <output-dir>

    This is useful for:
    - CI/CD pipelines with separate build and run stages
    - Docker images where you prepare during build
    - Production deployments where you want fast startup times

    Example:
        fastmcp project prepare myserver.json --output-dir ./prepared-env
        fastmcp run myserver.json --project ./prepared-env
    r   r   NzbThe --output-dir parameter is required.
Please specify where to create the persistent environment.r4   zUsing configuration from zxNo configuration file specified and no fastmcp.json found.
Please specify a configuration file or create a fastmcp.json.zConfiguration file not found: )r   r  u>   [bold green]✓[/bold green] Project prepared successfully in z7!
You can now run the server with:
  [cyan]fastmcp run z --project r   zFailed to prepare project: u4   [bold red]✗[/bold red] Failed to prepare project: )pathlibr   r5   r6   r(   r7   r   find_configr`   rg   exists	from_filepreparerf   rc   r   )	r  r  r   r   found_configconfig_fileoutput_pathr   r   s	            r.   r  r    s    D  I	
 	 &224l+KKK3K=ABLLP HHQK"""{#K5k]CD!!!z"K **;7 nn#"  
 	
 	

 	L[M Z##.-{:,gO	
	
  21#67LQCPQsC   C.F1+E E#E  FE 	FAFFFFr   )r   calldiscoverzgenerate-cli__main__)N)NNF)K__doc__importlib.metadatarV   importlib.utilr   r   r)   r*   r(   
contextlibr   r  r   typingr   r   cycloptsrd   r   rich.consoler	   
rich.tabler
   r   fastmcp.clir   r   fastmcp.cli.authr   fastmcp.cli.clientr   r   r   fastmcp.cli.generater   fastmcp.cli.installr   fastmcp.cli.tasksr   fastmcp.utilities.clir   r   fastmcp.utilities.inspectr   r   r   fastmcp.utilities.loggingr   #fastmcp.utilities.mcp_server_configr   fastmcp.utilities.version_checkr   r5   rf   ApprU   appr/   r`   tupler<   r   rB   commandboolr!   dev_appintr   r   TransportTyper   project_appr  __name__r   r=   r.   <module>r6     sQ   '    	   
 %  %        ) % K K 5 + ' T 
 1 ? C	E	
)hll		M,	&C 	&E#s(O 	& DI$  ,  	&K
8*QR	T&K &KT (,,E(K
L 	" 	 	 	 	 	 	 	 	 	 	 	_t T
To	
	 S	DX	
	  !d
!6	
	!. d
0	
	/< d
:	
	=J d
;	
	KX !t!A	
	Yf tE	
	gt J"	
	uD T
TP	
	ER d#`	
	S` 
a D 	 	 	 	 	 	OBB 1	
	B .	
	B" "=	
	#B2 "	
	3B@ %6	
	ABP 
QB BJ "y 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	_ytyy   4'&,	
	y d
Q	
	y" d
D!L	
	#y0 d
m	
	1y> ?@4G&	
	?yL =/MN	PMyT d
;	
	Uyb S	DX	
	cyn tE	
	oy| !t!A	
	}yJ U	
	KyX e	
	Yyf "H	
	gyv T
TP	
	wyD Q	
	EyR d#`	
	Sy` 
ay yx "j 	 	 	 	 	 	 	ejtj d#k	
	j td#u	
	j" d
;	
	#j0 S	DX	
	1j< tE	
	=jJ !t!A	
	KjX e	
	Yjf 
gj j\ hll	0IJ 
 	 	 	Td
 IJ	LT
 d
 ST	VT  KL	NT 
T Tp G  K  K  I  Lv & Lv & : .  ~ 6 H  zE r=   