> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mcprank.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Proxy Info

> Check if user can access a provider via proxy

## Overview

Check whether a user has connected a specific OAuth provider and can make proxy requests. Use this to determine if you need to prompt the user to authenticate before making proxy requests.

## Path Parameters

<ParamField path="provider" type="string" required>
  OAuth provider name. Currently supported: `google`
</ParamField>

## Headers

<ParamField header="X-API-Key" type="string" required>
  Your MCP Rank API key
</ParamField>

<ParamField header="Authorization" type="string" required>
  Bearer token. Format: `Bearer {mcp_identity_access_token}`
</ParamField>

## Response

<ResponseField name="provider" type="string">
  The provider name
</ResponseField>

<ResponseField name="connected" type="boolean">
  Whether the user has connected this provider
</ResponseField>

<ResponseField name="status" type="string">
  Connection status. Possible values:

  * `active` - Connection is working
  * `needs_reauth` - User needs to re-authenticate (e.g., token expired and couldn't refresh)
  * `null` - Not connected
</ResponseField>

<ResponseField name="can_access" type="boolean">
  Whether proxy requests can be made. `true` only if `connected` is `true` and `status` is `active`.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.mcprank.com/v1/proxy/google/info" \
    -H "X-API-Key: your-api-key" \
    -H "Authorization: Bearer your-access-token"
  ```

  ```python Python theme={null}
  from mcp_rank import MCPRank

  client = MCPRank(api_key="your-api-key")
  client.set_user_token(access_token, refresh_token)

  info = await client.get_proxy_info("google")

  if info["can_access"]:
      # Safe to make proxy requests
      emails = await client.proxy_get("google", "gmail/v1/users/me/messages")
  else:
      # Need to connect Google first
      auth_url = await client.get_auth_url("google", redirect_uri)
      print(f"Please connect Google: {auth_url}")
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch(
    "https://api.mcprank.com/v1/proxy/google/info",
    {
      headers: {
        "X-API-Key": "your-api-key",
        "Authorization": `Bearer ${accessToken}`,
      },
    }
  );

  const info = await response.json();

  if (info.can_access) {
    // Make proxy requests
  } else if (info.connected && info.status === "needs_reauth") {
    // Prompt user to re-authenticate
  } else {
    // Prompt user to connect Google
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Connected and Active theme={null}
  {
    "provider": "google",
    "connected": true,
    "status": "active",
    "can_access": true
  }
  ```

  ```json Needs Re-authentication theme={null}
  {
    "provider": "google",
    "connected": true,
    "status": "needs_reauth",
    "can_access": false
  }
  ```

  ```json Not Connected theme={null}
  {
    "provider": "google",
    "connected": false,
    "status": null,
    "can_access": false
  }
  ```
</ResponseExample>

## Use Cases

### Pre-flight check before proxy requests

```python theme={null}
async def get_user_emails(client: MCPRank):
    """Get user's emails, handling connection state."""
    
    # Check access first
    info = await client.get_proxy_info("google")
    
    if not info["can_access"]:
        if info["status"] == "needs_reauth":
            raise Exception("Please re-connect your Google account")
        else:
            raise Exception("Please connect your Google account first")
    
    # Safe to proceed
    return await client.proxy_get("google", "gmail/v1/users/me/messages")
```

### Show connection status in UI

```python theme={null}
async def get_connection_status(client: MCPRank):
    """Get connection status for all providers."""
    
    providers = ["google"]  # Add more as they become available
    status = {}
    
    for provider in providers:
        try:
            info = await client.get_proxy_info(provider)
            status[provider] = {
                "connected": info["connected"],
                "status": info["status"],
                "can_access": info["can_access"],
            }
        except Exception:
            status[provider] = {
                "connected": False,
                "status": None,
                "can_access": False,
            }
    
    return status
```

## Error Responses

| Status Code | Description                                |
| ----------- | ------------------------------------------ |
| 400         | Unsupported provider                       |
| 401         | Missing or invalid API key or access token |
| 429         | Rate limit exceeded                        |
