User API Keys are your credentials to access services on specific MCP Servers. Each MCP Server you wish to use requires a unique API key, which you can obtain through the AgentPay Hub.

Getting Your API Key

When you find an MCP Server you want to use in the Discover tab:
  1. Click the “Get API Key” button on the Server’s card.
  2. Your unique User API Key will be displayed.
  3. Important: Copy and store your API Key securely - it will only be shown once!
  4. The Server will now appear in your “My API Keys” tab with your API Key listed.

Managing Your API Keys

The “My API Keys” tab in the AgentPay Hub is your central location for managing all your API Keys:
  • View all your active API Keys.
  • See which Servers you have API Keys from.
  • Monitor usage and remaining free credits for each Server.
  • Track your spending history.

Understanding API Key States

Your API Key’s status can change based on your account balance and usage:
  • Active: Your key is valid and can be used to access the Server.
  • Invalid: Your key has been invalidated due to:
    • Insufficient balance (including free credits).
    • Outstanding payment from a previous failed consumption.
  • Reactivated: Your key becomes Active again once you:
    • Add sufficient funds to cover any outstanding payments.
    • Have a positive balance in your AgentPay account.
For more information about your AgentPay balance, please refer to the Managing Your Balance guide.

Using Your API Key

To use your API Key with an MCP Client:
  1. Configure your client with the Server’s endpoint URL.
  2. Add your API Key in the request headers:
    • Header Name: X-AGENTPAY-API-KEY
    • Value: Your unique User API Key for that Server.
Example Configuration:
{
  "mcpServers": {
    "mcp-server-name": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "<MCP_SERVER_URL>",
        "--header",
        "X-AGENTPAY-API-KEY:YOUR_USER_API_KEY_HERE"
      ],
      "env": {}
    }
  }
}

Best Practices

  • Store Securely: Keep your API Keys in a secure location. They are sensitive credentials.
  • Monitor Usage: Regularly check your usage and balance in the “My API Keys” tab.
  • Maintain Balance: Keep sufficient funds in your AgentPay account to avoid key invalidation.
  • Check Status: If your key becomes invalid, check your balance and any outstanding payments.
For more details on configuring your MCP Client with your API Key, see our Client Configuration Guide.