MCP Setup & Configuration
Learn how to integrate Testr with AI assistants through the Model Context Protocol (MCP).
Prerequisites
Before setting up MCP integration:
- Testr Account: Active account with API access
- API Key: Generated from your Testr dashboard
- MCP-Compatible Client: Claude Desktop, Cursor, or other MCP client
Step 1: Generate API Key
- Log in to your Testr Dashboard (opens in a new tab)
- Navigate to Settings → API Keys
- Click "Generate New API Key"
- Copy the key (format:
testr_...
) - store it securely - 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:
- Open Cursor preferences/settings
- Navigate to MCP settings
- Add the above configuration
- Replace
testr_YOUR_API_KEY
with your actual API key - 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:
- Start your MCP client (restart if already running)
- Check server status - you should see "Testr" as an available server
- Test with a simple command:
List my recent test definitions
- 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:
- Dashboard → Settings → Webhooks
- Add endpoint for test completion notifications
- Configure events: Test start, completion, failure
- Secure with signatures for production use
Next Steps
Once MCP is configured:
- Learn MCP Usage Patterns - Common commands and workflows
- Explore Tool Reference - Complete API documentation
- Try Example Commands - Ready-to-use MCP commands
Need help? Check our troubleshooting guide or contact support.