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

# Detect Authentication

> Analyzes an MCP server URL to determine required authentication method

## Request Body

<ParamField body="url" type="string" required>
  MCP server URL to analyze (must be a valid URI)
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the detection was successful
</ResponseField>

<ResponseField name="isAuthenticated" type="boolean">
  Whether the server is currently authenticated
</ResponseField>

<ResponseField name="authType" type="string">
  Detected authentication type: `oauth`, `bearer`, `custom`, or `none`
</ResponseField>

<ResponseField name="requiresAuth" type="boolean">
  Whether the server requires authentication
</ResponseField>

<ResponseField name="error" type="string">
  Error message if detection failed
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.example.com/api/mcp/detect-auth \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://mcp-server.example.com"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.example.com/api/mcp/detect-auth', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      url: 'https://mcp-server.example.com'
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.example.com/api/mcp/detect-auth',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'url': 'https://mcp-server.example.com'
      }
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json OAuth Required theme={null}
  {
    "success": true,
    "isAuthenticated": false,
    "authType": "oauth",
    "requiresAuth": true
  }
  ```

  ```json No Auth Required theme={null}
  {
    "success": true,
    "isAuthenticated": true,
    "authType": "none",
    "requiresAuth": false
  }
  ```
</ResponseExample>
