docs
MCP Integration
Setup & Configuration

MCP Setup & Configuration

Learn how to integrate Testr with AI assistants through the Model Context Protocol (MCP).

Prerequisites

Before setting up MCP integration:

  1. Testr Account: Active account with API access
  2. API Key: Generated from your Testr dashboard
  3. MCP-Compatible Client: Claude Desktop, Cursor, or other MCP client

Step 1: Generate API Key

  1. Log in to your Testr Dashboard (opens in a new tab)
  2. Navigate to SettingsAPI Keys
  3. Click "Generate New API Key"
  4. Copy the key (format: testr_...) - store it securely
  5. The key provides full access to your account via MCP

Step 2: MCP Client Configuration

Cursor IDE Configuration

Add Testr to your Cursor MCP configuration:

{
  "mcpServers": {
    "Testr": {
      "url": "https://testr.pro/api/mcp",
      "headers": {
        "x-api-key": "testr_YOUR_API_KEY"
      }
    }
  }
}

To configure in Cursor:

  1. Open Cursor preferences/settings
  2. Navigate to MCP settings
  3. Add the above configuration
  4. Replace testr_YOUR_API_KEY with your actual API key
  5. Restart Cursor to apply changes

Claude Desktop Configuration

For Claude Desktop, add to your claude_desktop_config.json:

{
  "mcpServers": {
    "testr": {
      "command": "npx",
      "args": [
        "mcp-client",
        "--url",
        "https://testr.pro/api/mcp",
        "--header",
        "x-api-key=testr_YOUR_API_KEY"
      ]
    }
  }
}

Generic MCP Client

For other MCP clients, use these connection details:

  • Server URL: https://testr.pro/api/mcp
  • Authentication: Header x-api-key: testr_YOUR_API_KEY
  • Protocol: MCP over HTTPS
  • Session Management: Automatic (24-hour sessions)

Step 3: Verify Connection

Once configured, test the connection:

  1. Start your MCP client (restart if already running)
  2. Check server status - you should see "Testr" as an available server
  3. Test with a simple command:
    List my recent test definitions
  4. Expected response: JSON list of your test definitions

Configuration Options

Security Considerations

  • API Key Protection: Never commit API keys to version control
  • Environment Variables: Use .env files for development
  • Key Rotation: Regenerate keys periodically from dashboard
  • Access Scope: API keys provide full account access

Connection Settings

The MCP server automatically handles:

  • Session Management: 24-hour auto-renewal
  • Error Recovery: Automatic reconnection on failures
  • Rate Limiting: Built-in request throttling
  • Authentication: Secure header-based auth

Troubleshooting

Common Issues

❌ "Unauthorized: API key required"

  • Verify API key is correctly set in configuration
  • Check key format (should start with testr_)
  • Ensure no extra spaces or characters

❌ "Session not found"

  • MCP server may have restarted
  • Restart your MCP client to establish new session
  • Check server status at https://testr.pro/api/mcp?health=true

❌ "Connection refused"

  • Verify internet connectivity
  • Check if corporate firewall blocks HTTPS requests
  • Try accessing https://testr.pro/api/mcp directly in browser

❌ "Tool not found"

  • Ensure MCP client supports tool calling
  • Check that Testr server appears in available servers list
  • Verify configuration syntax is correct

Debug Mode

Enable detailed logging in your MCP client:

Cursor: Add to settings:

{
  "mcp.debug": true,
  "mcp.logLevel": "debug"
}

Claude Desktop: Set environment variable:

export MCP_DEBUG=1

Testing Connection

Manual verification using curl:

curl -X POST https://testr.pro/api/mcp \
  -H "Content-Type: application/json" \
  -H "x-api-key: testr_YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "capabilities": {}
    },
    "id": 1
  }'

Expected Response: JSON with session ID and server capabilities.

Advanced Configuration

Custom Client Implementation

If building a custom MCP client:

import { McpClient } from '@modelcontextprotocol/sdk/client';
 
const client = new McpClient({
  url: 'https://testr.pro/api/mcp',
  headers: {
    'x-api-key': 'testr_YOUR_API_KEY'
  }
});
 
await client.initialize();
const tools = await client.listTools();

Webhook Integration

For real-time updates, configure webhooks:

  1. DashboardSettingsWebhooks
  2. Add endpoint for test completion notifications
  3. Configure events: Test start, completion, failure
  4. Secure with signatures for production use

Next Steps

Once MCP is configured:

  1. Learn MCP Usage Patterns - Common commands and workflows
  2. Explore Tool Reference - Complete API documentation
  3. Try Example Commands - Ready-to-use MCP commands

Need help? Check our troubleshooting guide or contact support.