curl "https://api.mcprank.com/v1/proxy/google/info" \
-H "X-API-Key: your-api-key" \
-H "Authorization: Bearer your-access-token"
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}")
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
}
{
"provider": "google",
"connected": true,
"status": "active",
"can_access": true
}
{
"provider": "google",
"connected": true,
"status": "needs_reauth",
"can_access": false
}
{
"provider": "google",
"connected": false,
"status": null,
"can_access": false
}
OAuth Proxy
Get Proxy Info
Check if user can access a provider via proxy
GET
/
v1
/
proxy
/
{provider}
/
info
curl "https://api.mcprank.com/v1/proxy/google/info" \
-H "X-API-Key: your-api-key" \
-H "Authorization: Bearer your-access-token"
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}")
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
}
{
"provider": "google",
"connected": true,
"status": "active",
"can_access": true
}
{
"provider": "google",
"connected": true,
"status": "needs_reauth",
"can_access": false
}
{
"provider": "google",
"connected": false,
"status": null,
"can_access": false
}
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
string
required
OAuth provider name. Currently supported:
googleHeaders
string
required
Your MCP Rank API key
string
required
Bearer token. Format:
Bearer {mcp_identity_access_token}Response
string
The provider name
boolean
Whether the user has connected this provider
string
Connection status. Possible values:
active- Connection is workingneeds_reauth- User needs to re-authenticate (e.g., token expired and couldn’t refresh)null- Not connected
boolean
Whether proxy requests can be made.
true only if connected is true and status is active.curl "https://api.mcprank.com/v1/proxy/google/info" \
-H "X-API-Key: your-api-key" \
-H "Authorization: Bearer your-access-token"
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}")
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
}
{
"provider": "google",
"connected": true,
"status": "active",
"can_access": true
}
{
"provider": "google",
"connected": true,
"status": "needs_reauth",
"can_access": false
}
{
"provider": "google",
"connected": false,
"status": null,
"can_access": false
}
Use Cases
Pre-flight check before proxy requests
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
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 |