
    Ch	
              	           S r SSKJrJr  SSKrS/r " S S\5      r   SS\\\4   S-  S\R                  S-  S	\R                  S-  S
\R                  4S jjrg)z@Utilities for creating standardized httpx AsyncClient instances.    )AnyProtocolNcreate_mcp_http_clientc            	           \ rS rSr   S	S\\\4   S-  S\R                  S-  S\R                  S-  S\R                  4S jjr
Srg)
McpHttpClientFactory
   Nheaderstimeoutauthreturnc                     g )N )selfr	   r
   r   s       Q/home/james-whalen/.local/lib/python3.13/site-packages/mcp/shared/_httpx_utils.py__call__McpHttpClientFactory.__call__   s    
      r   NNN)__name__
__module____qualname____firstlineno__dictstrhttpxTimeoutAuthAsyncClientr   __static_attributes__r   r   r   r   r   
   sb     *.(,"&	 c3h$&  %  jj4	 
 
		   r   r   r	   r
   r   r   c                     SS0nUc  [         R                  " S5      US'   OXS'   U b  XS'   Ub  X#S'   [         R                  " S0 UD6$ )a  Create a standardized httpx AsyncClient with MCP defaults.

This function provides common defaults used throughout the MCP codebase:
- follow_redirects=True (always enabled)
- Default timeout of 30 seconds if not specified

Args:
    headers: Optional headers to include with all requests.
    timeout: Request timeout as httpx.Timeout object.
        Defaults to 30 seconds if not specified.
    auth: Optional authentication handler.

Returns:
    Configured httpx.AsyncClient instance with MCP defaults.

Note:
    The returned AsyncClient must be used as a context manager to ensure
    proper cleanup of connections.

Examples:
    # Basic usage with MCP defaults
    async with create_mcp_http_client() as client:
        response = await client.get("https://api.example.com")

    # With custom headers
    headers = {"Authorization": "Bearer token"}
    async with create_mcp_http_client(headers) as client:
        response = await client.get("/endpoint")

    # With both custom headers and timeout
    timeout = httpx.Timeout(60.0, read=300.0)
    async with create_mcp_http_client(headers, timeout) as client:
        response = await client.get("/long-request")

    # With authentication
    from httpx import BasicAuth
    auth = BasicAuth(username="user", password="pass")
    async with create_mcp_http_client(headers, timeout, auth) as client:
        response = await client.get("/protected-endpoint")
follow_redirectsTg      >@r
   r	   r   r   )r   r   r   )r	   r
   r   kwargss       r   r   r      sf    ^ 	DF
 !MM$/y#y #y v&v&&r   r   )__doc__typingr   r   r   __all__r   r   r   r   r   r   r   r   r   r   <module>r&      s    F   #
$ 8   &*$("@'#s(^d"@']]T!@' **t
@' 	@'r   