Skip to main content

Installation

Python

Install using pip:
pip install mcp-rank
Or with poetry:
poetry add mcp-rank

Requirements

  • Python 3.9+
  • httpx for async HTTP requests
  • openai or anthropic (optional, for Agent class)

Configuration

Environment Variables

Set your API key as an environment variable:
export MCP_RANK_API_KEY="sk_mcp_rank_..."

Using .env Files

Create a .env file in your project root:
MCP_RANK_API_KEY=sk_mcp_rank_...
Load it in your code:
from dotenv import load_dotenv
load_dotenv()

Direct Configuration

Or pass the API key directly:
from mcp_rank import MCPRankClient

client = MCPRankClient(
    api_key="sk_mcp_rank_...",
    base_url="https://api.mcprank.com",  # optional
    timeout=30.0,  # optional
)

Verify Installation

Test that everything works:
import asyncio
from mcp_rank import MCPRankClient

async def test():
    async with MCPRankClient(api_key="sk_mcp_rank_...") as client:
        health = await client.health()
        print(f"API Status: {health['status']}")
        print(f"Server Count: {health['server_count']}")

asyncio.run(test())
Expected output:
API Status: healthy
Server Count: 490