+
    Q(i\              
           R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	t	^ RI
Ht ^ RIHt ^RIHtHt ]! ]4      tR R	 ltR
R/R R lltRRRR/R R lltRRRR/R R lltRRRRRRRRRR/R R lltR# )z5Goose integration for FastMCP install using Cyclopts.N)Path)	Annotated)quote)print)
get_logger)open_deeplinkprocess_common_argsc                0    V ^8  d   QhR\         R\         /# )   namereturn)str)formats   "_/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/fastmcp/cli/install/goose.py__annotate__r      s     $ $3 $3 $    c                    \         P                  ! RRV P                  4       4      P                  R4      pT;'       g    R# )zConvert a display name to a URL-safe identifier.

Lowercases, replaces non-alphanumeric runs with hyphens,
and strips leading/trailing hyphens.
z
[^a-z0-9]+-zfastmcp-server)resublowerstrip)r   slugs   & r   _slugifyr      s6     66-djjl399#>D####r   descriptionz MCP server installed via FastMCPc          
      j    V ^8  d   QhR\         R\         R\        \         ,          R\         R\         /# )r
   r   commandargsr   r   r   list)r   s   "r   r   r      s>     3 3
33 s)3
 3 	3r   c          	     l   \        V 4      pR\        VRR7       2.pV F"  pVP                  R\        VRR7       24       K$  	  VP                  R\        VRR7       24       VP                  R\        V RR7       24       VP                  R\        VRR7       24       RR	P                  V4       2# )
a7  Generate a Goose deeplink for installing an MCP extension.

Args:
    name: Human-readable display name for the extension.
    command: The executable command (e.g. "uv").
    args: Arguments to the command.
    description: Short description shown in Goose.

Returns:
    A goose://extension?... deeplink URL.
zcmd= )safezarg=zid=zname=zdescription=zgoose://extension?&)r   r   appendjoin)r   r   r   r   extension_idparamsargs   &&&$   r   generate_goose_deeplinkr)      s    $ D>LgB 789:FU3R0123 
MMCl4567
MME%2./01
MML{!< =>? 0122r   python_versionwith_packagesc          	          V ^8  d   QhR\         R\         R,          R\        \         ,          R,          R\        \         ,          /# )r
   server_specr*   Nr+   r   r   )r   s   "r   r   r   ;   sC       $J 9t#	
 
#Yr   c                   R.pV'       d   VP                  RV.4       \        \        T;'       g    . 4      4       F  pVR8w  g   K  VP                  RV.4       K!  	  VP                  RRV .4       V# )a  Build a uvx command for running a FastMCP server.

Goose requires uvx (not uv run) as the command. The uvx format is:
    uvx [--with pkg] [--python X] fastmcp run <spec>

uvx automatically infers that the `fastmcp` command comes from the
`fastmcp` package, so --from is not needed.
uvx--pythonfastmcp--withrun)extendsortedset)r-   r*   r+   r   pkgs   &$$  r   _build_uvx_commandr8   ;   sm     gDZ01c---2./)KK3( 0 	KKE;/0Kr   c                    V ^8  d   QhR\         R\        R,          R\        R\        \        ,          R,          R\        R,          R\        /# )r
   fileserver_objectNr   r+   r*   r   )r   r   r   bool)r   s   "r   r   r   V   sU     / /
/:/ /
 9t#/ $J/ 
/r   c               D   V'       d   V P                  4        RV 2pM\        V P                  4       4      p\        VVVR7      p\        VV^ ,          VR,          R7      p\	        RV R24       \        VRR7      '       d   \	        R	4       R
# \	        RV R24       R# )a  Install FastMCP server in Goose via deeplink.

Args:
    file: Path to the server file.
    server_object: Optional server object name (for :object suffix).
    name: Name for the extension in Goose.
    with_packages: Optional list of additional packages to install.
    python_version: Optional Python version to use.

Returns:
    True if installation was successful, False otherwise.
:)r*   r+   :   NN)r   r   r   z [blue]Opening Goose to install 'z'[/blue]goose)expected_schemezA[green]Goose should now open with the installation dialog[/green]Tza[red]Could not open Goose automatically.[/red]
[blue]Please copy this link and open it in Goose: z[/blue]F)resolver   r8   r)   r   r   )r:   r;   r   r+   r*   r-   full_commanddeeplinks   &&&$$   r   install_gooserE   V   s    ( (-9$,,.)%%#L 'Q"H 
,TF(
;<Xw77QRAAI
'S	
 r   server_nameenv_varsenv_filepythonc                8   V ^8  d   QhR\         R\        \         R,          \        P                  ! RR.RR7      3,          R\        \        \         ,          R,          \        P                  ! R	R
R7      3,          R\        \        \         ,          R,          \        P                  ! RRR7      3,          R\        \
        R,          \        P                  ! RRR7      3,          R\        \         R,          \        P                  ! RRR7      3,          RR/# )r
   r-   rF   Nz--namez-nz&Custom name for the extension in Goose)r   helpr+   r2   z;Additional packages to install (can be used multiple times))rK   rG   z--envzFEnvironment variables in KEY=VALUE format (can be used multiple times)rH   z
--env-filez)Load environment variables from .env filerI   r0   z(Python version to use (e.g., 3.10, 3.11)r   )r   r   cyclopts	Parameterr   r   )r   s   "r   r   r      s#    I II d
D!9	
	I S	DN	
	I" S	DY	
	#I0 t<	
	1I> d
;	
	?IL 
MIr   c               6  "   T;'       g    . pT;'       g    . pV'       g	   V'       d"   \        R4       \        P                  ! ^4       \        WW#V4      G Rj  xL
 w  rgrp	\	        VVVVVR7      p
V
'       g   \        P                  ! ^4       R# R#  L:5i)a  Install an MCP server in Goose.

Uses uvx to run the server. Environment variables are not included
in the deeplink; use `fastmcp install mcp-json` to generate a full
config for manual installation.

Args:
    server_spec: Python file to install, optionally with :object suffix
a  [red]Goose deeplinks cannot include environment variables.[/red]
[yellow]Use `fastmcp install mcp-json` to generate a config, then add it to your Goose config file with env vars: https://block.github.io/goose/docs/getting-started/using-extensions/#config-entry[/yellow]N)r:   r;   r   r+   r*   )r   sysexitr   rE   )r-   rF   r+   rG   rH   rI   r:   r;   r   	_env_dictsuccesss   &$$$$$     r   goose_commandrS      s     ` "''RM~~2H8i	
 	@S-8A ;7Di ##G  ;s    B
BB1BB;B)__doc__r   rO   pathlibr   typingr   urllib.parser   rL   richr   fastmcp.utilities.loggingr   sharedr   r   __name__loggerr   r)   r8   rE   rS    r   r   <module>r^      s    ; 	 
      0 6	H	$3
 :3< "& '+	6/
 '+/ "&/dI 	I  	!I. 	/I< 	=IJ 	KI Ir   