+
    lHàjR�  ã                   ó¨  € R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
HtHtHtHtHtHt ^ RIHtHtHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
I H!t!H"t"H#t#H$t$H%t% ^ RI&H't'H(t(H)t)H*t* ^ RI+H,t,H-t-H.t.H/t/ ]
'       d   ^ RI0H1t1 ]Pd                  ! R4      t3]4;QJ d    . R ]5! ^4       4       F  NK  	  5M! R ]5! ^4       4       4      t6Rt7R]$R]%R]#R]"R]Pp                  R]Pr                  R]Pt                  /t;R R lt<R R lt=R R lt>R[R R llt?R  R! lt@R" R# ltAR$ R% ltBR& R' ltCR( R) ltDR* R+ ltER, R- ltFR. R/ ltGR0 R1 ltHR2 R3 ltIR4 R5 ltJR6 R7 ltK] ! R8 R94      4       tLR: R; ltMR< R= ltNR> R? ltOR@RRAR/RB RC lltPRD RE ltQRF RG ltRRH RI ltSRJ RK ltTRL RM ltURN RO ltVRPRQRRR/RS RT lltWRU RV ltXRW RX ltYRY RZ ltZR# )\av  Registering a connected (or schema-cached) MCP server's tools into the tool registry:
include/exclude filtering, trust-tier metadata capture, utility-tool selection, name-collision
resolution and the schema-cache write-through. Both entry points (``_register_server_tools``
live, ``_register_from_cache_sync`` lazy) build ``_Candidate`` records for ``_register_candidates``.N)Ú	dataclass)ÚSimpleNamespace)ÚTYPE_CHECKINGÚAnyÚCallableÚDictÚIterableÚListÚOptional)Ú_parse_boolishÚ_coreÚ_resolve_tool_timeoutÚ	mcp_fieldÚmcp_server_enabled)Úmcp_tool_config)Úmcp_tool_events)Úmcp_tool_handlers)Úmcp_tool_schema)Ú_make_check_fnÚ_make_get_prompt_handlerÚ_make_list_prompts_handlerÚ_make_list_resources_handlerÚ_make_read_resource_handler)Ú_UTILITY_CAPABILITY_ATTRSÚ_build_utility_schemasÚ_normalize_name_filterÚmatches_name_filter)Ú	_key_nameÚ
_key_scopeÚ_resolve_server_keyÚ_server_key)ÚMCPServerTaskztools.mcp_toolc              #   óL   "  € T F  p\         P                  ! 4       x € K  	  R # 5i©N)Ú	threadingÚRLock)Ú.0Ú_s   & Ú@/home/ubuntu/.hermes/hermes-agent/tools/mcp_tool_registration.pyÚ	<genexpr>r)      s   é € ÐB¹	°1œYŸ_š_×.Ð.»	ùs   ‚"$zgenerated utility Úlist_resourcesÚread_resourceÚlist_promptsÚ
get_promptÚlist_event_typesÚsubscribe_eventÚunsubscribe_eventc                ó0   € V ^8„  d   QhR\         R\        /# )é   ÚvalueÚreturn)r   Ústr)Úformats   "r(   Ú__annotate__r7   (   s   € ÷ 	"ñ 	"¤3ð 	"¬3ñ 	"ó    c                ó  € V f   \         P                  # \        V 4      P                  4       P	                  4       pV\         P                  \         P
                  39   d   V# \        P                  RV 4       \         P
                  # )ziConfig ``trust`` -> tier. None -> ``full`` (compat default); unrecognized -> ``untrusted`` (fail closed).ub   MCP trust: unrecognized trust value %r â€” treating as 'untrusted' (valid values: full, untrusted))r   Ú_TRUST_FULLr5   ÚstripÚlowerÚ_TRUST_UNTRUSTEDÚloggerÚwarning)r3   Útexts   & r(   Ú_normalize_server_trustrA   (   sj   € à‚}Ü× Ñ Ð Üˆu‹:×ÑÓ×#Ñ#Ó%€DØ”×!Ñ!¤5×#9Ñ#9Ð:Ô:ØˆÜ
‡N�NÐwØôä×!Ñ!Ð!r8   c                ó0   € V ^8„  d   QhR\         R\        /# )r2   Úmcp_toolr4   )r   Úbool)r6   s   "r(   r7   r7   4   s   € ÷ 	ñ 	¬ð 	´ñ 	r8   c                ó´   € \        V RR4      p\        V\        4      '       d&   VP                  RVP                  R4      4      pVRJ # \	        VRR4      pVRJ # )a  True only when annotations (SDK object or cache dict) carry an exact ``True`` read-only hint;
unknown = write-capable. mcp 2.x exposes the attribute as ``read_only_hint`` (camelCase is only a
serialization alias), so reading camelCase alone gated every read on an untrusted server.ÚannotationsNÚreadOnlyHintÚread_only_hintT)ÚgetattrÚ
isinstanceÚdictÚgetr   )rC   rF   Úhints   &  r(   Ú_annotation_read_only_hintrN   4   s`   € ô ˜( M°4Ó8€KÜ�+œt×$Ò$Ø�‰˜~¨{¯©Ð?OÓ/PÓQˆð �4ˆ<Ðô ˜Ð&6¸ÓGˆØ�4ˆ<Ðr8   c                ó4   € V ^8„  d   QhR\         R\        RR/# ©r2   Úserver_nameÚconfigr4   N©r5   rK   )r6   s   "r(   r7   r7   @   s!   € ÷ 	2ñ 	2¤Sð 	2´$ð 	2Àñ 	2r8   c                ó”   € ^ RI Hp V! W4      pVf#   \        P                  P	                  VR4       R# V\        P                  V&   R# )zÝDeclared ``tool_costs``/``spend_limit`` for *key*. Load-time validation already dropped malformed
entries (``_filter_suspicious_mcp_servers``); a direct caller's bad table still fails loudly. Caller holds
``_core._lock``.)Úconfig_cost_policyN)Útools.mcp_tool_costsrU   r   Ú_server_cost_policiesÚpop)rQ   rR   ÚkeyrU   Úpolicys   &&&  r(   Ú_record_cost_policyr[   @   s<   € õ 8Ù Ó4€FØ‚~Ü×#Ñ#×'Ñ'¨¨TÖ2à+1Œ×#Ñ# CÓ(r8   c                óV   € V ^8„  d   QhR\         R\        R\        \        ,          RR/# )r2   rQ   rR   Útoolsr4   N)r5   rK   Úlistr   )r6   s   "r(   r7   r7   L   s3   € ÷ iñ i¬Sð i¼$ð iÄtÌCÅyð iÐ_cñ ir8   c                óî  € \         P                  ;_uu_ 4        Vf   \        V 4      p\        T;'       g    / P	                  R4      4      \         P
                  V&   \        WV4       \         P                  P                  V/ 4      pTP                  V Uu/ uF.  p\        VRR4      '       g   K  VP                  \        V4      bK0  	  up4       RRR4       R# u upi   + '       g   i     R# ; i)u‡  Capture per-server trust and per-tool readOnlyHint at discovery â€” the security boundary: the call-time gate
classifies from data we control, never re-read server-supplied state. *key* is the connection (default: the
registering profile's own); the ``trust`` policy is recorded under it for the profile that owns it â€” an
adopting profile records its own policy in ``_record_scope_trust``.NÚtrustÚname)r   Ú_lockr    rA   rL   Ú_server_trust_levelsr[   Ú_tool_read_only_hintsÚ
setdefaultÚupdaterI   ra   rN   )rQ   rR   r]   rY   ÚhintsÚts   &&&&  r(   Ú_record_tool_trust_metadatari   L   s·   € ô
 
��‹ØŠ;Ü˜kÓ*ˆCÜ*AÀ6Ç<À<ÈR×BTÑBTÐU\ÓB]Ó*^Œ×"Ñ" 3Ñ'Ü˜K°Ô5Ü×+Ñ+×6Ñ6°s¸BÓ?ˆØ�‰ÁUÓgÁUÀÌgÐVWÐY_Ðae×NfÔ;�a—f‘fÔ8¸Ó;Ò;ÁUÑgÔh÷ 
‰ùò h÷ 
�ˆús)   ™C#·A"C#ÂCÂ3CÃC#ÃC#Ã#C4	c                óJ   € V ^8„  d   QhR\         R\        \         ,          RR/# )r2   rQ   Ú
tool_namesr4   N)r5   r^   )r6   s   "r(   r7   r7   Z   s*   € ÷ Pñ P¬ð P¼tÄC½yð PÈTñ Pr8   c                ó    € ^ RI Hp V! \        P                  P	                  V4      V4      ;p'       d   \
        P                  RWV 4       R# R# )z�Live discovery only: the schema cache omits tools the user's include/exclude filter dropped, so a valid
cost for a filtered tool would read as unknown there.)Úunknown_cost_keysz»MCP server '%s': tool_costs names %s, which the server does not offer, so those calls carry no cost and no spend limit. Use the server's own tool names (without Hermes' 'mcp_%s_' prefix).N)rV   rm   r   rW   rL   r>   r?   )rQ   rY   rk   rm   Úunknowns   &&&  r(   Ú_warn_unknown_cost_keysro   Z   sG   € õ 7Ù#¤E×$?Ñ$?×$CÑ$CÀCÓ$HÈ*ÓUÐU€wÖUÜ�‰ð ,à-8À;ö	Pñ Vr8   c                ó@   € V ^8„  d   QhR\         R\        R\         RR/# )r2   rQ   rR   Úscoper4   NrS   )r6   s   "r(   r7   r7   d   s(   € ÷ 6ñ 6¤Sð 6´$ð 6¼sð 6Àtñ 6r8   c                ó  € \         P                  ;_uu_ 4        \        WRR7      p\        T;'       g    / P	                  R4      4      \         P
                  V&   \        WV4       RRR4       R#   + '       g   i     R# ; i)zÙ``trust`` (and the cost policy) is the CONSUMING profile's policy, never the connection's: an
``untrusted`` profile that adopts a ``full`` profile's live connection must still be asked before every
write-capable call.F©Úcurrentr`   N)r   rb   r    rA   rL   rc   r[   )rQ   rR   rq   rY   s   &&& r(   Ú_record_scope_trustru   d   sV   € ô 
��‹Ü˜+°eÔ<ˆÜ*AÀ6Ç<À<ÈR×BTÑBTÐU\ÓB]Ó*^Œ×"Ñ" 3Ñ'Ü˜K°Ô5÷ 
��Šús   ™AA2Á2B	c                ó4   € V ^8„  d   QhR\         R\         RR/# )r2   Ú	tool_namerQ   r4   N©r5   )r6   s   "r(   r7   r7   n   s!   € ÷ >ñ >¤cð >¼ð >Àñ >r8   c                ó–   € \         P                  ;_uu_ 4        V\         P                  V &   RRR4       R#   + '       g   i     R# ; i)z>Remember the exact raw MCP server that registered *tool_name*.N)r   rb   Ú_mcp_tool_server_names)rw   rQ   s   &&r(   Ú_track_mcp_tool_serverr{   n   s'   € ä	��‹Ø2=Œ×$Ñ$ YÑ/÷ 
��Šús	   ™7·A	c                ó(   € V ^8„  d   QhR\         RR/# ©r2   rw   r4   Nrx   )r6   s   "r(   r7   r7   t   s   € ÷ :ñ :¤sð :¨tñ :r8   c                ó°   € \         P                  ;_uu_ 4        \         P                  P                  V R4       RRR4       R#   + '       g   i     R# ; i)z5Forget MCP server provenance for a deregistered tool.N)r   rb   rz   rX   )rw   s   &r(   Ú_forget_mcp_tool_serverr   t   s-   € ä	��‹Ü×$Ñ$×(Ñ(¨°DÔ9÷ 
��Šús   ™!AÁA	c                ó$   € V ^8„  d   QhR\         /# ©r2   r4   )Úobject)r6   s   "r(   r7   r7   z   s   € ÷ $ñ $¤Fñ $r8   c                ó  € \         P                  ;_uu_ 4        \         P                  P                  4        F  w  rW J g   K  Vu uuRRR4       # 	  RRR4       \	        V P
                  4      #   + '       g   i     L%; i)z¨Connection key of a live ``MCPServerTask`` (teardown runs on the MCP loop without the
discovering profile's context, so the key is found by identity, never re-derived).N)r   rb   Ú_serversÚitemsr    ra   )ÚserverrY   Úlives   &  r(   Ú_server_key_for_taskrˆ   z   sS   € ô 
��‹ÜŸ™×-Ñ-Ö/‰IˆCØ�~Ø‘
÷ 
ŠÙ/÷ 
ô �v—{‘{Ó#Ð#÷	 
�ús   ™&A1ÁA1ÁA1Á1B	c                ó(   € V ^8„  d   QhR\         RR/# r}   rx   )r6   s   "r(   r7   r7   „   s   € ÷ 'ñ '´sð '¸tñ 'r8   c                ó¾  € ^ RI Hp \        V \        \        34      '       d   T M
\        V 4      p\        P                  ;_uu_ 4        \        \        P                  P                  VR4      4      pV'       g   \        P                  ! V4      0pRRR4       X F  pVP                  WR7       K  	  \        V4       \        V4       R#   + '       g   i     LC; i)zrDeregister one server tool from every profile overlay that owns it. *server* is the
live task or a connection key.©ÚregistryN©rq   © )Útools.registryrŒ   rJ   r5   Útuplerˆ   r   rb   ÚsetÚ_server_tool_scopesrL   Ú_server_registry_scopeÚ
deregisterr   Ú_restore_server_toolset_alias)r†   rw   rŒ   rY   Úscopesrq   s   &&    r(   Ú_deregister_mcp_tool_all_scopesr—   „   sš   € õ (ä˜v¬¬U |×4Ò4‰&Ô:NÈvÓ:V€CÜ	��‹Ü”U×.Ñ.×2Ñ2°3¸Ó;Ó<ˆßÜ×2Ò2°3Ó7Ð8ˆF÷ 
ó ˆØ×Ñ˜IÐÖ3ñ ä˜IÔ&Ü! #Ö&÷ 
�ús   ÁA	CÃC	c                ó   € V ^8„  d   QhRR/# )r2   r4   NrŽ   )r6   s   "r(   r7   r7   ”   s   € ÷ Kñ K¨$ñ Kr8   c                ó$  a€ ^ RI Ho \        V 4      p\        P                  ;_uu_ 4        \        P
                  P                  4        UUu. uFB  w  r#\        V4      V8X  g   K  V\        \        P                  P                  VR4      4      3NKD  	  pppRRR4       \        ;QJ d    V3R lX 4       F  '       g   K   RM	  RM! V3R lX 4       4      '       d   SP                  VRV 24       R# R# u uppi   + '       g   i     Lo; i)uì   Keep the process-global alias while any profile still owns tools of a server with this
name â€” including another profile's same-named connection (the alias is per NAME; the
registry deregister dropped it after checking only one scope).r‹   Nc              3   óŠ   <"  € T F8  w  rV F-  p\        VR R4       F  pSP                  WCR7      RJx € K  	  K/  	  K:  	  R# 5i)Ú_registered_tool_namesr�   NrŽ   )rI   Úsnapshot_registration)r&   r†   r–   rq   rw   rŒ   s   &    €r(   r)   Ú0_restore_server_toolset_alias.<locals>.<genexpr>ž   sR   øé € ð á#‰NˆF³¨Ü  Ð)AÀ2ÖFˆIð 	×&Ñ& yÐ&Ó>ÀdÕJáFñ 	KÙ17ñ 	KÛ#ùs   ƒA ATFúmcp-rŽ   )r�   rŒ   r   r   rb   r„   r…   r‘   r’   rL   ÚanyÚregister_toolset_alias)rY   rQ   Úkr†   ÚownedrŒ   s   &    @r(   r•   r•   ”   sØ   ø€ õ (ä˜C“.€KÜ	��‹ä"'§.¡.×"6Ñ"6Ô"8ôYÙ"8‘Y�Q¼IÀa»LÈKÑ<Wô E�&œ#œe×7Ñ7×;Ñ;¸A¸rÓBÓCÓDÙ"8ð 	ñ Y÷ 
÷ ƒsô á#ó‡s‡s‚sô á#ó÷ ò ð
 	×'Ñ'¨°t¸K¸=Ð5IÖJñùóY÷ 
�ús#   «"C?ÁC9
Á&/C9
ÂC?Ã9C?Ã?D	c                ó(   € V ^8„  d   QhR\         RR/# )r2   rq   r4   Nrx   )r6   s   "r(   r7   r7   ¦   s   € ÷ 'ñ '¤Sð '¨Tñ 'r8   c           
     ó˜  € ^ RI Hp \        V 4      pVP                  RV 24       F  pVP	                  WAR7       K  	  \
        P                  ;_uu_ 4        \        \
        P                  P                  V R4      4      pVP                  V4       V'       d   V\
        P                  V &   M \
        P                  P                  V R4       \
        P                  P                  \        W1RR7      R4       \
        P                  P                  \        W1RR7      R4       RRR4       \        V 4       R#   + '       g   i     L; i)z>Remove one profile's MCP overlay for a shared live connection.r‹   rž   r�   NFrs   rŽ   )r�   rŒ   r   Úget_tool_names_for_toolsetr”   r   rb   r‘   r’   rL   ÚdiscardrX   rc   r    rW   r•   )rY   rq   rŒ   rQ   rw   r–   s   &&    r(   Ú_remove_server_scoper§   ¦   së   € å'ä˜C“.€KØ×8Ñ8¸4À¸}Ð9MÖNˆ	Ø×Ñ˜IÐÖ3ñ Oä	��‹Ü”U×.Ñ.×2Ñ2°3¸Ó;Ó<ˆØ�‰�uÔßØ-3ŒE×%Ñ% cÒ*ä×%Ñ%×)Ñ)¨#¨tÔ4Ü×"Ñ"×&Ñ&¤{°;ÈuÔ'UÐW[Ô\Ü×#Ñ#×'Ñ'¬°KÐPUÔ(VÐX\Ô]÷ 
ô " #Ö&÷ 
�ús   ÁCD9Ä9E		c          	      óV   € V ^8„  d   QhR\         RRR\        R\        \        ,          /# )r2   rQ   r†   r!   rR   r4   ©r5   rK   r^   )r6   s   "r(   r7   r7   ¹   s/   € ÷ ñ ¬ð °oð Ìtð ÔX\Ô]aÕXbñ r8   c           	     ó¦  aaa	a
€ SP                  R4      ;'       g    / pR Uu/ uF  qD\        VP                  V4      RR7      bK!  	  upo
\        \        SRR4      RR4      o	R V	VV
V3R llp. p\        V 4       FK  pV! VR	,          4      pV'       d!   \        P                  R
WR	,          V4       K:  VP                  V4       KM  	  V# u upi )aJ  Utility schemas allowed by config (``tools.resources``/``tools.prompts``) and advertised
capabilities. ``initialize_result.capabilities`` is the truth (sub-object non-None iff the
family is served); without it fall back to the legacy session-method check, which never
filters anything since ClientSession defines all four methods.r]   T)ÚdefaultÚinitialize_resultNÚcapabilitiesc                óF   € V ^8„  d   QhR\         R\        \         ,          /# )r2   Úhandler_keyr4   )r5   r
   )r6   s   "r(   r7   Ú-_select_utility_schemas.<locals>.__annotate__Â   s"   € ÷ `ñ `¤#ð `¬(´3­-ñ `r8   c                 ó  <€ \         V ,          pVR 8X  d!   \        P                  ! S4      '       d   R# R# SV,          '       g   V R2# Se   \        SVR4      f   RV R2# R# \	        SP
                  V 4      '       d   R# RV  2# )ÚeventsNzevents not enabledz	 disabledzserver does not advertise 'z' capabilityzsession lacks )r   Ú_eventsÚevents_enabledrI   ÚhasattrÚsession)r¯   ÚfamilyÚ
advertisedrR   Úenabledr†   s   & €€€€r(   Ú_skip_reasonÚ-_select_utility_schemas.<locals>._skip_reasonÂ   s’   ø€ Ü*¨;Õ7ˆØ�XÔÜ"×1Ò1°&×9Ò9�4ÐSÐ?SÐSØ�v�ŒØ�X˜YÐ'Ð'ØÒ!Ü�z 6¨4Ó0Ò8Ø4°V°H¸LÐIÐIÙä˜vŸ~™~¨{×;Ò;ˆtÐ_À>ÐR]ÐQ^ÐA_Ð_r8   r¯   z+MCP server '%s': skipping utility '%s' (%s))Ú	resourcesÚprompts)rL   r   rI   r   r>   ÚdebugÚappend)rQ   r†   rR   Útools_filterÚfrº   ÚselectedÚentryÚreasonr¸   r¹   s   &ff      @@r(   Ú_select_utility_schemasrÅ   ¹   sÄ   û€ ð
 —:‘:˜gÓ&×,Ð,¨"€LÙMeÓfÑMeÈ”. ×!1Ñ!1°!Ó!4¸dÔCÒCÑMeÑf€GÜœ Ð)<¸dÓCÀ^ÐUYÓZ€J÷`ó `ð €HÜ'¨Ö4ˆÙ˜e MÕ2Ó3ˆßÜ�L‰LÐFÈÐ[hÕUiÐkqÖrà�O‰O˜EÖ"ñ 5ð €Oùò- gs   ¤%Cc                ó:   € V ^8„  d   QhR\         \        ,          /# r�   ©r^   r5   )r6   s   "r(   r7   r7   Ø   s   € ÷ ñ œd¤3�iñ r8   c            
     ó¾  aa€ \         P                  ! 4       oSeÐ   ^ RIHp  \         P                  ;_uu_ 4        \         P
                   Uu. uF-  p\         P                  ! VS4      '       g   K"  \        V4      NK/  	  ppVP                  V3R l\         P                   4       4       RRR4       \        X UUu0 uF   pV P                  RV 24       F  pVkK  	  K"  	  upp4      # . p\         P
                  P                  4        FF  oTP                  \        SR4      '       d   SP                  MV3R lSP                   4       4       KH  	  \         P                  ;_uu_ 4        VP                  R \         P                  P!                  4        4       4       RRR4       V# u upi   + '       g   i     EL; iu uppi   + '       g   i     T# ; i)zqTool names for all connected servers plus lazy (cache-registered) servers, whose tools live only in the registry.Nr‹   c              3   ó¦   <"  € T FF  pV\         P                  9  g   K  \         P                  ! VS4      '       g   K9  \        V4      x € KH  	  R # 5ir#   )r   r„   Ú_server_visible_in_scoper   )r&   rY   rq   s   & €r(   r)   Ú'_existing_tool_names.<locals>.<genexpr>ã   sC   øé € ð  Ù*G 3ØœeŸn™nÑ,ô Ü16×1OÒ1OÐPSÐUZ×1[ô ”	˜#—�Ó*Gùs   ƒAŸA¾Arž   r›   c              3   ót   <"  € T F-  p\         P                  ! SP                  V4      R ,          x € K/  	  R# 5i)ra   N)Ú_schemaÚ_convert_mcp_schemara   )r&   rh   r†   s   & €r(   r)   rË   ð   s-   øé € ÐfÑXeÐSTœ7×6Ò6°v·{±{ÀAÓFÀv×NÒNÓXeùs   ƒ58c              3   ój   "  € T F)  w  rV\         P                  9  g   K  V F  pVx € K	  	  K+  	  R # 5ir#   )r   r„   )r&   rY   rk   Úns   &   r(   r)   rË   ò   s8   é € ð GÑ.S™?˜3Ø¤5§>¡>Ñ1ô Û;E°aõ Ù;Eñ Ó.Sùs   ‚3 3)r   Ú_mcp_registry_scoper�   rŒ   rb   r„   rÊ   r   ÚextendÚ_lazy_server_tool_namesÚsortedr¥   Úvaluesrµ   r›   Ú_toolsr…   )rŒ   rY   Úserver_namesrQ   rw   Únamesrq   r†   s         @@r(   Ú_existing_tool_namesrÙ   Ø   s  ù€ ä×%Ò%Ó'€EØÒÝ+ä�[�[‹[ä*/¯.ª.óÙ*8 3Ü×1Ò1°#°u×=ô ”	˜#–©.ð ð ð ×Ñô  Ü*/×*GÒ*Gó ô ÷ ô á+ô
á+�Ø%×@Ñ@À4ÈÀ}ÐAUÖV�	ó áVñ Ù+ò
ó ð 	ð €EÜ—.‘.×'Ñ'Ö)ˆØ�‰´g¸fÐF^×6_Ò6_�V×2Ò2ÜfÐX^×XeÒXeÓfö	hñ *ô 
��‹Ø�‰ñ G¬e×.KÑ.K×.QÑ.QÔ.Só Gô 	G÷ 
ð €Lùò+÷ �[ˆ[üó
÷ 
Žð €Lús5   ºF1ÁF,Á1F,Â +F1Â=&G
Å-5GÆ,F1Æ1G	ÇG	c                ó`   € V ^8„  d   QhR\         R\        R\        \         .\        3,          /# )r2   ra   rR   r4   )r5   rK   r   rD   )r6   s   "r(   r7   r7   ÷   s1   € ÷ _ñ _œCð _¬ð _´(¼C¸5Ä$¸;Õ2Gñ _r8   c                ó   aa€ VP                  R4      ;'       g    / pVP                  R4      p\        VRV  R24      o\        VP                  R4      RV  R24      o\        V\        \        \
        \        34      '       d   V3R l# V3R l# )	zÖInclude/exclude predicate for a server's tool names: ``tools.include`` is a whitelist (``[]`` = register
nothing), ``tools.exclude`` a blacklist; entries are exact names or fnmatch globs; include wins over exclude.r]   Úincludezmcp_servers.z.tools.includeÚexcludez.tools.excludec                 ó   <€ \        V S4      # r#   ©r   )rw   Úinclude_sets   &€r(   Ú<lambda>Ú#_make_tool_filter.<locals>.<lambda>  s   ø€ Ô!4°YÀÔ!Lr8   c                 ó:   <€ S;'       d    \        V S4      '       * # r#   rß   )rw   Úexclude_sets   &€r(   rá   râ     s   ø€  +×"]Ð"]Ô2EÀiÐQ\Ó2]Õ^r8   )rL   r   rJ   r5   r^   r�   r‘   )ra   rR   rÀ   Úinclude_rawrä   rà   s   &&  @@r(   Ú_make_tool_filterræ   ÷   s‡   ù€ ð —:‘:˜gÓ&×,Ð,¨"€Lð ×"Ñ" 9Ó-€KÜ(¨¸ÀTÀFÈ.Ð6YÓZ€KÜ(¨×)9Ñ)9¸)Ó)DÈÐUYÐTZÐZhÐFiÓj€KÜ�+¤¤T¬5´#Ð6×7Ò7ÜLÐLÜ^Ð^r8   c                ó\   € V ^8„  d   QhR\         \        ,          R\        \        ,          /# )r2   Úrawsr4   )r   r   r^   r   )r6   s   "r(   r7   r7   	  s'   € ÷ Jñ Jœ¤�ð J¬$¬Õ*?ñ Jr8   c                ó¤  € V  Uu. uF¿  p\        V\        4      '       g   K  VP                  R4      '       g   K4  \        VR,          VP                  R4      ;'       g    R\        VP                  R4      \        4      '       d
   VR,          M/ \        VP                  R4      \        4      '       d
   VR,          MRR7      NKÁ  	  up# u upi )z¾Schema-cache rows -> stand-ins for MCP Tool objects; rows that are not dicts or lack a name
are dropped. Missing or non-dict ``annotations`` (older cache files) fail closed to write-capable.ra   ÚdescriptionÚ ÚinputSchemarF   N)ra   rê   rì   rF   )rJ   rK   rL   r   )rè   Úraws   & r(   Ú_cached_toolsrî   	  s´   € ñ óJñ �œz¨#¬t×4ôrð :=¿¹À¿ôrŒO  V¥¸#¿'¹'À-Ó:P×:VÐ:VÐTVÜ>HÈÏÉÐQ^ÓI_Ôae×>fÒ>f¨¨MÖ(:ÐlnÜ>HÈÏÉÐQ^ÓI_Ôae×>fÒ>f¨¨MÖ(:Ðlp÷rñ ñJð Jùò Js   …C¢C»$CÁ A*Cc                   óL   a € ] tR tRt o Rt]V 3R lR l4       tV 3R ltRtV t	R# )Ú
_Candidatei  znOne registration attempt (native tool or generated utility); ``origin`` is the provenance text in diagnostics.c                ó    <€ V ^8„  d   QhRS[ /# r�   )rD   )r6   Ú__classdict__s   "€r(   r7   Ú_Candidate.__annotate__  s   ø€ ÷ >ñ >™Dñ >r8   c                ó@   € V P                   P                  \        4      # r#   )ÚoriginÚ
startswithÚ_UTILITY_ORIGIN_PREFIX)Úselfs   &r(   Ú
is_utilityÚ_Candidate.is_utility  s   € à�{‰{×%Ñ%Ô&<Ó=Ð=r8   c                óJ   <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   S[;R&   S[;R&   # )r2   Úregistry_namerõ   ÚschemaÚhandler)r5   rK   r   )r6   rò   s   "€r(   r7   ró     s7   ø‡ ‚ ñ Ññ	 ñ
 �Kñ ñ �Lñ ñ Ñò r8   rŽ   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úpropertyrù   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)rò   s   @r(   rð   rð     s#   ø‡ € áxð ÷>ó ð>÷ ƒ r8   rð   c          	      ó˜   € V ^8„  d   QhR\         R\        \        ,          R\        \         .\        3,          R\
        \        ,          /# )r2   ra   r]   Úshould_registerr4   )r5   r   r   r   rD   r^   rð   )r6   s   "r(   r7   r7      sA   € ÷ ñ œ3ð ¤x´¥}ð ÄxÔQTÐPUÔW[ÐP[ÕG\ð Ü&*¬:Õ&6ñr8   c           	     óÎ  € . pV FÜ  pV! VP                   4      '       g#   \        P                  RWP                   4       K=  \        P                  ! YP                   VP
                  ;'       g    R4       \        P                  ! W4      p\        P                  ! WP                   VRR7      pVP                  \        VR,          RVP                   : 2Wg4      4       KÞ  	  V# )zŽNative tools (live SDK objects or cache stand-ins) -> candidates. The injection scan runs on
BOTH paths: the cache file is user-writable JSON.z8MCP server '%s': skipping tool '%s' (filtered by config)rë   T)Únative_imagesra   ztool )ra   r>   r¾   rÍ   Ú_scan_mcp_descriptionrê   rÎ   Ú	_handlersÚ_make_tool_handlerr¿   rð   )ra   r]   r	  Útool_timeoutÚoutrh   rý   rþ   s   &&&&    r(   Ú_tool_candidatesr     s¯   € ð €CÛˆÙ˜qŸv™v×&Ò&Ü�L‰LÐSÐUY×[aÑ[aÔbÙÜ×%Ò% d¯F©F°A·M±M×4GÐ4GÀRÔHÜ×,Ò,¨TÓ5ˆÜ×.Ò.¨t·V±V¸\ÐY]Ô^ˆØ�
‰
”:˜f V�n°°a·f±f±ZÐ.@À&ÓRÖSñ ð €Jr8   c                óh   € V ^8„  d   QhR\         R\        \        ,          R\        \        ,          /# )r2   ra   Úentriesr4   )r5   r   r   r^   rð   )r6   s   "r(   r7   r7   0  s+   € ÷ ñ œcð ¬H´S­Mð ÌDÔQ[ÕL\ñ r8   c                óŒ  € . pV F»  p\        V\        4      '       d#   VP                  R4      VP                  R4      3MRw  rV\        V\        4      '       g   KW  V\        9   g   Kd  VP                  R4      '       g   K}  VP	                  \        VR,          \         V: 2V\        V,          ! W4      4      4       K½  	  V# )z_``{schema, handler_key}`` rows (live selection or cache) -> candidates; malformed rows dropped.rý   r¯   ra   )NN)rJ   rK   rL   Ú_UTILITY_HANDLER_FACTORIESr¿   rð   r÷   )ra   r  r  r  rí   rý   rY   s   &&&    r(   Ú_utility_candidatesr  0  s£   € à€CÛˆÜEOÐPSÔUY×EZÒEZ�s—w‘w˜xÓ(¨#¯'©'°-Ó*@ÑAÐ`l‰ˆÜ�fœd×#Ô#¨Ô/IÖ(IÈfÏjÉjÐY_×N`ÔN`Ø�J‰J”z &¨¥.Ô5KÐ4LÈSÉGÐ2TÐV\Ü"<¸SÖ"AÀ$Ó"UóWö Xñ ð
 €Jr8   c                óh   € V ^8„  d   QhR\         R\        \        ,          R\        \        ,          /# )r2   ra   Ú
candidatesr4   )r5   r^   rð   )r6   s   "r(   r7   r7   ;  s0   € ÷ (sñ (s¤3ð (s´D¼Õ4Dð (sÌÌjÕIYñ (sr8   c           	     ó
  a
€ . p/ pV F‘  pVP                  VP                  \        4       4      pVP                  V9   d.   \        P                  RWP                  VP                  4       Ke  VP                  VP                  4       VP                  V4       K“  	  / p\        4       pVP                  4        F¶  w  o
p\        V4      ^8:  d   K  \        R V 4       4      p\        V\        V4      ,
          4      p	\        V	4      ^8X  dT   V'       dL   VP                  V
3R lV 4       4       \        P                  RV RP                  V4      V	^ ,          4       K¨  \        V4      VS
&   K¸  	  \        VP                  4       4       F-  w  o
p\        P                  RV S
RP                  V4      4       K/  	  V Uu. uF6  qDP                  V9  g   K  VP                  VP                  3V9  g   K4  VNK8  	  up# u upi )zðPreflight name collisions: exact duplicates dropped silently; a utility normalizing onto
a native tool's name is shadowed (native wins); any other multi-origin collision skips every
colliding entry (fail closed). Returns survivors in order.zJMCP server '%s': duplicate registration candidate %s for '%s'; keeping onec              3   ó^   "  € T F#  qP                  \        4      '       g   K  Vx € K%  	  R # 5ir#   )rö   r÷   )r&   Úos   & r(   r)   Ú+_resolve_name_collisions.<locals>.<genexpr>V  s   é € Ð \©G q·|±|ÔDZ×7[§¢«Gùs   ‚-£
-c              3   ó,   <"  € T F	  pSV3x € K  	  R # 5ir#   rŽ   )r&   r  rü   s   & €r(   r)   r  Y  s   øé € ÐH¹°1˜]¨AÕ.»ùs   ƒuÂ   MCP server '%s': generated utility %s normalizes onto server-native %s â€” keeping the native tool and dropping the utility (the utility only applies when the server has no such tool of its own)z, z‡MCP server '%s': name normalization collision for '%s' from %s; skipping every colliding entry instead of choosing an arbitrary handler)re   rü   r‘   rõ   r>   r¾   Úaddr¿   r…   ÚlenrÔ   rf   ÚinfoÚjoinÚerror)ra   r  ÚuniqueÚorigins_by_nameÚcÚoriginsÚ	ambiguousÚshadowedÚutility_originsÚnative_originsrü   s   &&        @r(   Ú_resolve_name_collisionsr+  ;  s¯  ø€ ð  "€FØ+-€OÛˆØ!×,Ñ,¨Q¯_©_¼c»eÓDˆØ�8‰8�wÔÜ�L‰LÐeØŸx™x¨¯©ô:áØ�‰�A—H‘HÔØ�‰�aÖñ ð ')€IÜ%(£U€Hð #2×"7Ñ"7Ö"9Ñˆ�wÜˆw‹<˜1ÔÙÜ Ñ \©GÓ \Ó\ˆÜ ¬#¨oÓ*>Õ >Ó?ˆÜˆ~Ó !Ô#¯Ø�O‰OÔH¹ÓHÔHÜ�K‰Kðrà�d—i‘i Ó0°.ÀÕ2CöEô
 (.¨g£ˆI�mÓ$ñ #:ô #)¨¯©Ó):Ö";Ñˆ�wÜ�‰ð FØGKÈ]Ð\`×\eÑ\eÐfmÓ\nö	pñ #<ñ Ór‘v�!§¡¸	Ñ!AŒAÀqÇÁÐXY×X`ÑX`ÐFaÐiqÑFq�AˆA‘vÑrÐrùÒrs   ÇH ÇH Ç7H rY   Úexecution_timeoutc                ó¼   € V ^8„  d   QhR\         R\        \        ,          R\        R\        . \        \         ,          3,          R\
        R\        \         ,          /# )r2   ra   r  Úcheck_fnrq   Úlazyr4   )r5   r^   rð   r   r
   rD   )r6   s   "r(   r7   r7   f  sR   € ÷ )ñ )œsð )´´ZÕ0@ð )Ìxð )Ü (¨¬X´c­]Ð):Õ ;ð)ÜCGð)ÜnrÔsvÕnwñ)r8   c               óì  € ^ RI Hp RV  2p. p	V! 4       p
Vf   \        W
RR7      pV EF  pVP                  VP                  4      pV'       dµ   WÈ8w  d¯   V'       d5   VP
                  '       g"   \        P                  RWP                  V4       MpVP                  R4      '       d.   \        P                  RWP                  VP                  V4       M,\        P                  RWP                  VP                  V4       KÛ  TP                  VP                  Y‹P                  VP                  TRVP                  P                  R	4      ;'       g    R
V
VR7	       VP                  VP                  4      V8X  d‘   \        VP                  V 4       V
eY   \         P"                  ;_uu_ 4        \         P$                  P'                  V\)        4       4      P+                  V
4       RRR4       V	P-                  VP                  4       EKå  V'       d   EKð  \        P                  RWP                  VP                  4       EK  	  V	'       d   VP/                  W4       V	#   + '       g   i     L„; i)a\  Register candidates under toolset ``mcp-{name}``; returns the names that landed. The
ownership pre-check is advisory (servers connect in parallel): ``registry.register()`` is
the atomic gate and its verdict is re-read after every call. *key* is the connection whose
``_server_tool_scopes`` records the registering scope (default: this scope's own).r‹   rž   NFrs   uP   MCP server '%s' (lazy): cached tool '%s' collides with toolset '%s' â€” skippinguu   MCP server '%s': %s normalizes to '%s', already owned by MCP toolset '%s' â€” skipping to preserve the existing ownerul   MCP server '%s': %s (â†’ '%s') collides with built-in tool in toolset '%s' â€” skipping to preserve built-inrê   rë   )	ra   Útoolsetrý   rþ   r.  Úis_asyncrê   rq   r,  zkMCP server '%s': registration of %s as '%s' was rejected by the registry; skipping provenance/count updates)r�   rŒ   r    Úget_toolset_for_toolrü   rù   r>   r?   rö   r"  rõ   Úregisterrý   rþ   rL   r{   r   rb   r’   re   r‘   r  r¿   r    )ra   r  r.  rq   r/  rY   r,  rŒ   Útoolset_nameÚ
registeredÚscope_valuer%  Úexisting_toolsets   &&$$$$$      r(   Ú_register_candidatesr9  f  sÙ  € õ (Ø˜$˜�=€LØ€JÙ“'€KØ
‚{Ü˜$°UÔ;ˆÜˆØ#×8Ñ8¸¿¹ÓIÐßÐ 0Ô @ßØ—|—|�|Ü—N‘NÐ#uØ#'¯©Ð:JôLøà!×,Ñ,¨V×4Ò4Ü—‘ð ;Ø<@Ç(Á(ÈAÏOÉOÐ]mõoô —‘ð  3Ø48¿(¹(ÀAÇOÁOÐUeôgáØ×ÑØ—‘¨,¿x¹xÐQR×QZÑQZÐemØ¨¯©¯©°]Ó(C×(IÐ(IÀrÐQ\Ø/ð 	ô 	1ð ×(Ñ(¨¯©Ó9¸\ÔIÜ" 1§?¡?°DÔ9ØÒ&Ü—[—[“[Ü×-Ñ-×8Ñ8¸¼c»eÓD×HÑHÈÔU÷ !à×Ñ˜aŸo™o×.ß’Ü�L‰Lð =Ø>BÇHÁHÈaÏoÉo÷_ñ3 ÷6 Ø×'Ñ'¨Ô;ØÐ÷ !—[ús   Æ/8I#É#I3c                ó8   € V ^8„  d   QhR\         RRR\        RR/# )r2   ra   r†   r!   rR   r4   NrS   )r6   s   "r(   r7   r7   ’  s/   € ÷ Nñ Nœcð N¨?ð NÄDð NÐ^bñ Nr8   c                ó”  €  ^ RI HpHp . pVP                   F„  pV! VP                  4      '       g   K  \        VRR4      pTP                  RVP                  RVP                  ;'       g    RR\        V\        4      '       d   TM/ RR\        V4      //4       K†  	  \        WV4       U	u. uF  p	R	V	R	,          R
V	R
,          /NK  	  p
p	\        VRR4      ;'       g    / pV! W! V4      WjVP                  R4      VP                  R4      R7       R# u up	i   \         d"   p\        P!                  RY4        Rp?R# Rp?ii ; i)znWrite-through: persist the manifest so the next startup registers this server lazily (no spawn). Never raises.)Úconfig_fingerprintÚwrite_cache_entryÚinput_schemarì   ra   rê   rë   rF   rG   rý   r¯   Ú_list_cache_metaNÚttl_msÚcache_scope)r]   Úutility_toolsr@  rA  z*MCP schema cache write failed for '%s': %s)Útools.mcp_schema_cacher<  r=  rÖ   ra   r   r¿   rê   rJ   rK   rN   rÅ   rI   rL   Ú	Exceptionr>   r¾   )ra   r†   rR   r	  r<  r=  Útools_payloadrh   Ú
schema_objÚeÚutility_payloadÚ
cache_metaÚexcs   &&&&         r(   Ú_write_schema_cacherK  ’  s?  € ðN÷ 	QØˆØ—”ˆAÙ" 1§6¡6×*Ò*Ùô # 1 n°mÓDˆJØ× Ñ Ø˜Ÿ™ ¨q¯}©}×/BÐ/BÀØ¬Z¸
ÄD×-IÒ-I™zÈrØ Ô0JÈ1Ó0MÐNð"ö ñ ô %<¸DÈ&Ô$QóSÙ$Q˜qð % a¨¥k°=À!ÀMÕBRÓSÙ$Qð 	ð Sä˜VÐ%7¸Ó>×DÐDÀ"ˆ
Ù˜$Ð 2°6Ó :À-Ø!+§¡°Ó!9ÀzÇ~Á~ÐVcÓGd÷	fùòSøô
 ô NÜ�‰ÐAÀ4×MÒMûðNús7   ‚A*D Á-AD Â.DÃD Ã!3D ÄD ÄEÄ&EÅEc          	      óV   € V ^8„  d   QhR\         RRR\        R\        \         ,          /# )r2   ra   r†   r!   rR   r4   r©   )r6   s   "r(   r7   r7   °  s/   € ÷ ñ ¤ð ¨oð Ätð ÔPTÔUXÕPYñ r8   c                óÂ  a€ \        W4      p\        V4      o\        WVP                  S4       \	        T SVP                   Uu. uF$  p\        VRR4      '       g   K  VP                  NK&  	  up4       \        WP                  W1P                  4      pV\        V \        WV4      VP                  4      ,          p\        P                  ! S4      ;'       g    RP                  R4      '       dd   ^ RIp^ RIHp VP"                  ! V Uu/ uF  qˆP$                  VP&                  bK  	  upRR7      p	\        VRV	4      p
Wš8w  d	   V! R	4      hW¡n        \+        V \-        W4      \/        V 4      V3R
 lRSVP1                  R4      R7      pV'       dB   \        P                  ! S4      ;'       g    RP                  R4      '       g   \3        WW#4       V# u upi u upi )a  Register a connected server's tools plus utilities (initial discovery and list_changed
refresh); returns the names. Toolset aliases derive from the live registry, not
``toolsets.TOOLSETS``; lossy normalization collisions (``read-file``/``read_file``) fail closed.ra   Nrë   zeditor-session:)ÚRuntimeStoreErrorT)Ú	sort_keysÚ_editor_frozen_manifestÚacp_mcp_schema_changedc                  ó0   <€ \         P                  ! S 4      # r#   )r   r“   )rY   s   €r(   rá   Ú(_register_server_tools.<locals>.<lambda>Æ  s   ø€ ´U×5QÒ5QÐRUÔ5Vr8   FÚtimeout©r.  rq   r/  rY   r,  )ræ   rˆ   ri   rÖ   ro   rI   ra   r  r  r  rÅ   r   r“   rö   ÚjsonÚhermes_state_runtimerN  Údumpsrü   rý   rP  r9  r+  r   rL   rK  )ra   r†   rR   r	  rh   r  rV  rN  r%  ÚmanifestÚfrozenr6  rY   s   &&&         @r(   Ú_register_server_toolsr[  °  sŒ  ø€ ô (¨Ó5€OÜ
˜vÓ
&€CÜ ¨f¯m©m¸SÔAÜ˜D #¸¿ºÓ'b¹°1ÌÐQRÐTZÐ\`×Ia¬¨¯¬¹Ñ'bÔcÜ! $¯©°×H[ÑH[Ó\€JØÔ% dÔ,CÀDÐRXÓ,YÐ[a×[nÑ[nÓoÕo€Jô 	×$Ò$ SÓ)×/Ð/¨R×;Ñ;Ð<M×NÒNÛÝ:Ø—:’:Á*ÓMÁ*¸QŸ™°·±Ò8Á*ÑMÐY]Ô^ˆÜ˜Ð!:¸HÓEˆØÔÙ#Ð$<Ó=Ð=Ø)/Ô&Ü%ØÔ& tÓ8Ü Ó%Ô-VÐ]bÐhkØ Ÿ*™* YÓ/ô1€J÷ œ5×7Ò7¸Ó<×BÐBÀ×NÑNÐO`×aÒaÜ˜D¨&ÔBØÐùò' (cùò Ns   ÁGÁGÄGc                ó0   € V ^8„  d   QhR\         R\        /# ©r2   rR   r4   )rK   r�   )r6   s   "r(   r7   r7   Í  s   € ÷ Yñ Y¤ð Y¬%ñ Yr8   c                ó>  € ^ RI Hp R pV! V 4      V! V P                  R4      4      V! V P                  R4      4      \        V 4      V! V P                  R4      4      V! V P                  R4      4      V P                  RR4      \	        V P                  R	4      4      3# )
aë  What makes one live connection reusable for another profile: the route fingerprint PLUS
everything that authenticates or secures it (``config_fingerprint`` deliberately excludes
credentials so the schema cache survives a token rotation). Two profiles pointing at the same URL
with different headers/env/auth/client certificates/TLS policy are two identities; borrowing
across them would call tools as the other user, or under the other profile's ``ssl_verify`` /
``strict_redirect_headers``.)r<  c                 óP   € \         P                  ! T ;'       g    / R \        R7      # )T©rO  r«   )rV  rX  r5   )r3   s   &r(   Ú_frozenÚ%_connection_identity.<locals>._frozenÖ  s   € Ü�zŠz˜%Ÿ+˜+ 2°¼sÔCÐCr8   ÚenvÚheadersÚclient_certÚ
client_keyÚ
ssl_verifyTÚstrict_redirect_headers)rC  r<  rL   Ú
_auth_typerD   )rR   r<  ra  s   &  r(   Ú_connection_identityrj  Í  sŒ   € õ :òDñ ˜vÓ&©°·
±
¸5Ó0AÓ(BÁGÈFÏJÉJÐW`ÓLaÓDbÜ�vÓ¡¨¯
©
°=Ó(AÓ BÁGÈFÏJÉJÐWcÓLdÓDeØ�J‰J�| TÓ*¬D°·±Ð<UÓ1VÓ,WðYð Yr8   c                ó0   € V ^8„  d   QhR\         R\        /# r]  )rK   r5   )r6   s   "r(   r7   r7   Þ  s   € ÷ 6ñ 6”tð 6¤ñ 6r8   c                 óp   € V P                  R 4      ;'       g    RP                  4       P                  4       # )Úauthrë   )rL   r<   r;   )rR   s   &r(   ri  ri  Þ  s+   € Ø�J‰J�vÓ×$Ð$ "×+Ñ+Ó-×3Ñ3Ó5Ð5r8   c                ó0   € V ^8„  d   QhR\         R\        /# )r2   Úresolvedr4   rÇ   )r6   s   "r(   r7   r7   â  s   € ÷ bñ bœtð b¬ñ br8   c                óœ   € \         P                  ! \        P                  ! V R\        R7      P                  4       4      P                  4       # )zLOnly the hash of a connection's resolved inputs is kept: they carry secrets.Tr`  )ÚhashlibÚsha256rV  rX  r5   ÚencodeÚ	hexdigest)ro  s   &r(   Ú_identity_digestru  â  s0   € ä�>Š>œ$Ÿ*š* X¸ÄsÔK×RÑRÓTÓU×_Ñ_ÓaÐar8   c                óJ   € V ^8„  d   QhR\         R\        R\         R,          /# rP   rS   )r6   s   "r(   r7   r7   ç  s%   € ÷ $ñ $¬#ð $´tð $ÄÀdÅ
ñ $r8   c                óî   € ^ RI HpHp RV9  d   VP                  R4      '       g   R#  V! W4      w  rE\        T4      #   T d     R# \         d"   p\
        P                  RY4        Rp?R# Rp?ii ; i)aÐ  Digest of what a connection is opened with that the config does not show, resolved in the
CURRENT profile's scope by the transport's own resolvers: a stdio child's executable (bare
``npx``/``node`` may resolve under the profile's home), env (external secret-source values) and
default cwd; an HTTP connection's URL and headers after a ``server_json`` live endpoint and
``identity_header`` (``value_from: profile``). The transport publishes the digest of the very
inputs each attempt connects with; an adopter recomputes it here. A resolver failure refuses
adoption for this server only, never discovery for the whole scope. None is the one refuse
sentinel: no connectable config, no live endpoint, or a resolver failure.)ÚLiveEndpointUnavailableÚ_connect_inputsÚurlÚcommandNzrMCP server '%s': cannot resolve this profile's connection identity (%s); not adopting another profile's connection)Útools.mcp_tool_transportrx  ry  rL   rD  r>   r?   ru  )rQ   rR   rx  ry  Úinputsr'   rJ  s   &&     r(   Ú_adopter_identity_digestr~  ç  su   € ÷ Rà�FÔ 6§:¡:¨i×#8Ò#8ÙðÙ# KÓ8‰	ˆô ˜FÓ#Ð#øð #ô ÚÜô Ü�‰ð CØDOô	Våûðús!   ª
? ¿A4Á	A4ÁA4ÁA/Á/A4Úcross_profileFÚresolved_identityc          
      ób   € V ^8„  d   QhR\         R\        R\        R\        R,          R\        /# )r2   r†   rR   r  r€  Nr4   )r   rK   rD   r5   )r6   s   "r(   r7   r7   ÿ  s<   € ÷ Qñ Qœsð Q¬Dð QÄDð QÜ*-°­*ðQÜ@DñQr8   c               óô   € \        \        V R/ 4      ;'       g    / 4      \        V4      8w  d   R# V'       g   R# \        V RR4      p\        V4      R8g  ;'       d    VRJ;'       d    VRJ;'       d    WC8H  # )a  Whether *server* matches *config*. Across profiles the static config is not enough: OAuth
tokens live in the owner's token store (never reusable), and secret-source env, the profile
identity header and the default cwd resolve per profile, so the adopter's resolution
(*resolved_identity*, computed by the caller outside the registry lock; None refuses) must hash
to what the owner connected with. Within one profile the connection is the profile's: its
default cwd resolves in the connection task's own context, never per session.Ú_configFTÚ_resolved_identityNÚoauth)rj  rI   ri  )r†   rR   r  r€  Úrecordeds   &&$$ r(   Ú_same_server_router‡  ÿ  s�   € ô œG F¨I°rÓ:×@Ð@¸bÓAÔEYÐZ`ÓEaÔaÙßÙä�vÐ3°TÓ:€HÜ�vÓ 'Ñ)÷ Pð P¨h¸dÐ.B÷ Pð PØ!¨Ð-÷Pð PØ2:Ñ2OðQr8   c                ó0   € V ^8„  d   QhR\         R\        /# ©r2   Úserversr4   ©rK   Úint)r6   s   "r(   r7   r7     s   € ÷ ?ñ ?´4ð ?¼Cñ ?r8   c                óð   € \         P                  ! 4       pVf   ^ # \        \        V4      \	        \        4      ,          ,          ;_uu_ 4        \        V 4      uuRRR4       #   + '       g   i     R# ; i)zNSerialize shared-scope reconciliation and registration for one discovery pass.N)r   rÑ   Ú_SCOPE_REFRESH_LOCKSÚhashr  Ú&_register_connected_into_current_scope)rŠ  rq   s   & r(   Ú%register_connected_into_current_scoper‘    sJ   € ä×%Ò%Ó'€EØ‚}ÙÜ	œd 5›k¬CÔ0DÓ,EÕE×	F×	FÜ5°gÓ>÷ 
G×	F×	FÓ	Fús   ÁA$Á$A5	c                ó0   € V ^8„  d   QhR\         R\        /# r‰  r‹  )r6   s   "r(   r7   r7     s   € ÷ Yñ Y´Dð Y¼Sñ Yr8   c                ón  a€ ^ RI Hp \        P                  ! 4       oSf   ^ # \        P                  ;_uu_ 4        \        P
                  P                  4        UUu0 uF+  w  r#SV9   g   K  \        V4      V 9  g   K   \        V4      kK-  	  ppp\        P                   Uu0 uF   p\        V4      S8w  g   K  \        V4      kK"  	  ppRRR4       ^ RI
Hp V! 4       ;_uu_ 4        X'       d   \        P                  ! 4       M/ p/ V Uu/ uF  qˆVP                  V4      bK  	  upCV Cp	V	P                  4        UU
u/ uF3  w  rŠVX9   g   K  V
f   K  \        V
4      '       g   K'  V\!        WŠ4      bK5  	  ppp
RRR4       \        P                  ;_uu_ 4        . p\        P
                  P                  4        Fµ  w  r#SV9  d   K  \        V4      pVX	9  d   K"  \        P                  P                  V4      pW˜,          p
\        V4      S8g  pV
eJ   \        V
4      '       d9   Ve5   \#        VRR4      e&   \%        WÚVXP                  V4      R7      '       d   K¤  VP'                  V4       K·  	  RRR4       X F  p\)        VS4       K  	  ^ pV P                  4        EFv  w  rŠ\        V
4      '       g   K  \        P                  ;_uu_ 4        \+        VSRR7      \        P                  9   d    RRR4       K^  \        P                  P                  4        UUu. uFS  w  pp\        V4      V8X  g   K  \#        VRR4      f   K)  \%        VV
RXP                  V4      R7      '       g   KO  VV3NKU  	  pppRRR4       X'       g   Kí  V^ ,          w  r-\        P                  ;_uu_ 4        \        P
                  P-                  V\/        4       4      P1                  S4       RRR4       \3        WŠS4       VP5                  R	V 24      '       d   EKy  \7        W�P8                  \;        WŠ4      VP<                  4      pV\?        V\A        W�V
4      VP<                  4      ,          p\C        V\E        VV4      \G        V4      V3R
 lRVV
P                  R4      R7      pV'       g   EK  V^,          p\        P                  ;_uu_ 4        \I        \/        \#        VR. 4      ;'       g    R4      \/        V4      ,          4      Vn%        RRR4       EKy  	  V# u uppi u upi   + '       g   i     ELk; iu upi u up
pi   + '       g   i     ELÙ; i  + '       g   i     ELó; iu uppi   + '       g   i     EL; i  + '       g   i     ELª; i  + '       g   i     EK  ; i)a«  Heal the current profile's MCP overlay from already-connected shared servers.

A shared live connection remains owned by the profile that opened it, but a profile with the
same route must still receive its callable tool entries. The current profile's config is the
allowlist, and route fingerprints prevent borrowing a differently-authenticated connection.
Missing or changed config entries remove only this profile's overlay.
r‹   N)Ú_owner_secret_scoper¶   )r  r€  Frs   Trž   c                  ó   <€ S # r#   rŽ   r�   s   €r(   rá   Ú8_register_connected_into_current_scope.<locals>.<lambda>l  s   ø€ ¹r8   rT  rU  r›   rŽ   )&r�   rŒ   r   rÑ   rb   r’   r…   r   r„   r   Útools.mcp_tool_discoveryr”  rƒ  Ú_load_mcp_configrL   r   r~  rI   r‡  r¿   r§   r    re   r‘   r  ru   r¥   r  rÖ   ræ   r  r  rÅ   r9  r+  r   rÔ   r›   )rŠ  rŒ   rY   r–   ÚomittedÚforeignr”  Úprofile_serversra   ÚjudgedrR   Úresolved_idsÚstaler†   r  Úregistered_serversr‡   Úsharedr  rØ   rq   s   &                   @r(   r�  r�    sœ  ø€ õ (ä×%Ò%Ó'€EØ‚}Ùô
 
��‹Ü5:×5NÑ5N×5TÑ5TÔ5Vô IÑ5V¡k cØ˜v‘oô "Ü*3°C«.ÀÑ*Gô "”9˜S–>Ñ5Vˆñ Iô .3¯^ª^ÓX©^ c¼zÈ#»ÐRWÑ?W”>”9˜S–>©^ˆÐX÷	 
õ =Ù	×	Õ	ß8?œ'×2Ò2Ô4ÀRˆØUÁÓIÁ¸˜?×.Ñ.¨tÓ4Ò4ÁÑIÐUÈWÐUˆà,2¯L©L¬NôbÙ,:™L˜DØ 7™?ô Eà/5ô EäFXÐY_×F`ô E˜Ô6°tÓDÒDÙ,:ð 	ñ b÷ 
ô 
��‹ØˆÜ ×4Ñ4×:Ñ:Ö<‰KˆCØ˜FÔ"ÙÜ˜S“>ˆDØ˜6Ô!ÙÜ—^‘^×'Ñ'¨Ó,ˆFØ•\ˆFÜ& s›O¨uÑ4ˆMØ’Ô&8¸×&@Ò&@ÀFÂNÜ˜v y°$Ó7Ò?Ü-¨fÈMØ@L×@PÑ@PÐQUÓ@V÷Xõ Xà—‘˜SÖ!ñ =÷ 
ó  ˆÜ˜S %Ö(ñ ð ÐØŸ™Ÿ‰ˆÜ! &×)Ò)ÙÜ�[�[‹[Ü˜4 °Ô6¼%¿.¹.ÔHØ÷ ‰[ô 49·>±>×3GÑ3GÔ3Iô XÑ3I¡i c¨4Ü" 3›¨4Ñ/ô "Ü4;¸DÀ)ÈTÓ4Rô "ä,¨T°6ÈØ?K×?OÑ?OÐPTÓ?U÷Wð Wô "�s˜D“kÑ3IˆFñ X÷	 ÷ ÙØ˜Q•i‰ˆä�[�[‹[Ü×%Ñ%×0Ñ0°´c³eÓ<×@Ñ@ÀÔG÷ ä˜D¨%Ô0Ø×.Ñ.°°d°V¨}×=Ò=ÚÜ% d¯M©MÔ;LÈTÓ;ZÐ\b×\oÑ\oÓpˆ
ØÔ)ØÔ)¨$¸Ó?À×ATÑATóVõ 	Vˆ
ä$ØÔ*¨4°Ó<Ü# DÓ)´ÀUÐPSØ$Ÿj™j¨Ó3ô5ˆ÷ Š5Ø !Õ#ÐÜ——“Ü06Üœ Ð(@À"ÓE×KÐKÈÓLÌsÐSXËzÕYó1[�Ô-÷ ’ñ; (ð@ ÐùóOIùò Y÷	 
�ˆüò Jùób÷ 
×	Ð	ú÷ 
�ˆüó6X÷	 �[ˆ[ú÷ �[ˆ[ú÷ —‘úsØ   »"T-ÁT"
Á-T"
Á?T"
ÂT-Â#T(Â:T(Ã	T-Ã(%UÄU
Ä'UÅ U
ÅU
ÅU
Å)U
Å9UÆC U É!U Ë#U:Ì!U:Ì$U4Ì>U4Í!U4Í5U4Í=U:Î58VÓ?V"Ô"T-Ô-T>	ÕUÕU	Õ U1	Õ4U:Õ:VÖVÖ"V4c          	      ó^   € V ^8„  d   QhR\         R\        R\        R\        \         ,          /# )r2   ra   rR   rÃ   r4   r©   )r6   s   "r(   r7   r7   v  s,   € ÷ ñ ¤Cð ´ð ¼dð ÄtÌCÅyñ r8   c           
     ó¤  € ^ RI HpHpHp \	        V4      p\        V! V4      4      p\        WV4       \        W\        W4      V4      pV\        W! V4      V4      ,          p\        W\        V 4      \        P                  RVP                  R4      R7      p	V	'       dž   \        P                  ;_uu_ 4        \!        V 4      p
\#        V4      \        P$                  V
&   V! V4      \        P&                  V
&   \)        V	4      \        P*                  V
&   RRR4       \,        P/                  RV \1        V	4      4       V	#   + '       g   i     L2; i)u±  Lazy startup: register from a cached manifest with no child process (first real call goes
through ``_ensure_lazy_server_connected``). Trust metadata is recorded first so the
call-time gate is identical for live and cached registrations.

Lazy startup (#56832, design by Vansh5632): tools appear in the registry immediately; the first real
call routes through ``_get_connected_server_for_call`` â†’ ``_ensure_lazy_server_connected``.
)r<  Útools_from_cache_entryÚutility_tools_from_cache_entryTrT  )r.  rq   r/  r,  Nz?MCP server '%s' (lazy): registered %d tool(s) from schema cache)rC  r<  r£  r¤  r   rî   ri   r  ræ   r  r9  r   r   rÑ   rL   rb   r    rK   Ú_lazy_server_configsÚ_lazy_server_fingerprintsr^   rÓ   r>   r   r  )ra   rR   rÃ   r<  r£  r¤  r  Úcached_toolsr  r6  rY   s   &&&        r(   Ú_register_from_cache_syncr¨  v  s  € ÷ rÑqÜ(¨Ó0€LÜ Ñ!7¸Ó!>Ó?€LÜ ¨lÔ;Ü! $Ô6GÈÓ6UÐWcÓd€JØÔ% dÐ,JÈ5Ó,QÐS_Ó`Õ`€JÜ%Ø¤>°$Ó#7¼u×?XÑ?XÐ_cØ Ÿ*™* YÓ/ô1€J÷ Ü�[�[‹[Ü˜dÓ#ˆCÜ.2°6«lŒE×&Ñ& sÑ+Ù3EÀfÓ3MŒE×+Ñ+¨CÑ0Ü15°jÓ1AŒE×)Ñ)¨#Ñ.÷	 ô
 	�‰ÐUÐW[Ô]`ÐakÓ]lÔmØÐ÷ �[ús   Â8AD?Ä?E	r#   )[r  rq  rV  Úloggingr$   Údataclassesr   Útypesr   Útypingr   r   r   r   r   r	   r
   Útools.mcp_tool_commonr   r   r   r   r   r]   r   rƒ  r   r³   r   r  r   rÍ   Útools.mcp_tool_handlersr   r   r   r   r   Útools.mcp_tool_schemar   r   r   r   Útools.mcp_tool_scoper   r   r   r    Útools.mcp_toolr!   Ú	getLoggerr>   r�   ÚrangerŽ  r÷   Ú_make_list_event_types_handlerÚ_make_subscribe_event_handlerÚ_make_unsubscribe_event_handlerr  rA   rN   r[   ri   ro   ru   r{   r   rˆ   r—   r•   r§   rÅ   rÙ   ræ   rî   rð   r  r  r+  r9  rK  r[  rj  ri  ru  r~  r‡  r‘  r�  r¨  rŽ   r8   r(   Ú<module>r·     s»  ðñhó
 Û Û Û Ý !Ý !ß O× OÑ Oß mÕ mÝ ,Ý ,Ý 0Ý ,÷?õ ?÷dó dç XÓ XçÝ,à	×	Ò	Ð+Ó	,€ß�uÑB¹¸b¼	ÓB—u‘uÑB¹¸b¼	ÓBÓBÐ à-Ð ð Ð2°OÐE`ØÐ.°Ð>VØ˜×>Ñ>Ð@QÐSZ×SxÑSxØ˜×@Ñ@ð	BÐ õ	"õ	õ	2÷iõPõ6õ>õ:õ$õ'õ Kõ$'õ&õ>õ>_õ$Jð ÷
>ð 
>ó ð
>õõ õ(sðV)ØMQð)Øei÷)õXNõ<õ:Yõ"6õbõ
$ð0QÈ5ð QØ7;÷Qõ$?õY÷xr8   