Integration with Claude
This guide explains how to configure TestNet as an MCP server for Claude Code or Claude Desktop.
Prerequisites
- TestNet is deployed and running properly
- You have a TestNet user account with
mcp:viewandmcp:executepermissions - Claude Code or Claude Desktop is installed
Obtaining JWT Token
First, obtain a TestNet JWT Token:
curl -X POST https://your-testnet-server/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "your-username", "password": "your-password"}'Get the data.token field from the response as the JWT Token.
Configuring Claude Code
Add TestNet to Claude Code's MCP configuration file:
Find Configuration File Location
- macOS:
~/.claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add TestNet MCP Server
{
"mcpServers": {
"testnet": {
"url": "https://your-testnet-server/mcp/v1",
"headers": {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
}
}Replace your-testnet-server with the actual server address, and replace the Bearer value with the actual JWT Token.
Restart Claude
After modifying the configuration file, restart Claude Code for the configuration to take effect.
Verifying Integration
Enter the following prompt in Claude Code to verify the integration is successful:
List all workflows in TestNetIf the configuration is correct, Claude will call the testnet_list_workflows tool and return the workflow list.
Usage Examples
Querying Assets
Query the subdomains under project proj_001 in TestNetClaude will call: testnet_query_assets(projectId="proj_001", assetType="sub_domain")
Executing a Workflow
Execute the domain recon workflow on example.com, workflow name is domain-recon-pipelineClaude will call: testnet_run_workflow(workflowId="domain-recon-pipeline", target="example.com", assetType="DOMAIN")
Querying Task Status
Query the execution status and results of task task_abc123Claude will call testnet_get_task_status(taskId="task_abc123") and explain the results.
Security Recommendations
Security Notes
- JWT Token Protection: Do not commit configuration files containing Tokens to code repositories
- Token Expiration: JWT Tokens are valid for 24 hours; you need to obtain a new one after expiration
- Least Privilege: Create a dedicated account for the AI assistant with only
mcp:viewandmcp:executepermissions - Operation Auditing: All MCP calls are recorded in TestNet's audit logs
Common Issues
Claude Shows "Tool Not Found"
- Check if the TestNet server address is correct
- Confirm the JWT Token has not expired
- Check if the user account has
mcp:viewpermission
Workflow Execution Returns Error
- Confirm the account has
mcp:executepermission - Confirm the workflow ID is correct (view via
testnet_list_workflows) - Confirm the input asset ID exists