blob: b9531314ae5f1fd1a30be7bb79e0ed4b092375c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
---
allowed-tools: Read, Bash, Grep, WebFetch
description: Debug proof verification issues and authentication errors
---
## Debug Proof Verification
Analyze and debug authentication proof issues in your token-gated MCP server.
## Debugging Process
1. **Check Recent Errors**
- Search for EVMAUTH errors: !`grep -r "EVMAUTH" . --include="*.log" --include="*.ts" | tail -20`
- Find proof-related issues: !`grep -r "proof\|PROOF" . --include="*.log" | tail -20`
2. **Validate Configuration**
```bash
# Check all required environment variables
!echo "=== Token Gate Configuration ==="
!echo "Contract Address: ${EVMAUTH_CONTRACT_ADDRESS:-NOT SET}"
!echo "Chain ID: ${EVMAUTH_CHAIN_ID:-NOT SET}"
!echo "RPC URL: ${EVMAUTH_RPC_URL:-NOT SET}"
!echo "Token ID: ${EVMAUTH_TOKEN_ID:-NOT SET}"
!echo "Debug Mode: ${DEBUG:-false}"
!echo "Environment: ${NODE_ENV:-development}"
```
3. **Test RPC Connection**
```bash
# Verify RPC endpoint is accessible
!curl -s -X POST ${EVMAUTH_RPC_URL:-https://rpc.testnet.radiustech.xyz} \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' | jq '.'
```
4. **Analyze Proof Structure**
Check for common proof issues:
- Missing __evmauth parameter
- Expired timestamp (> 30 seconds)
- Invalid signature format (not 0x + 130 hex chars)
- Chain ID mismatch
- Contract address mismatch
- Invalid nonce format
5. **Debug Token Verification**
- Check if RPC calls are succeeding
- Verify token balance queries
- Test cache behavior
- Validate multi-token logic
## Common Issues and Solutions
### EVMAUTH_PROOF_MISSING
- **Cause**: No __evmauth in request
- **Fix**: Ensure parameter is included in tool schema
### PROOF_EXPIRED
- **Cause**: Proof older than 30 seconds
- **Fix**: Request fresh proof from Radius MCP Server
### CHAIN_MISMATCH
- **Cause**: Proof for different chain
- **Fix**: Ensure SDK and proof use same chain ID (1223953 for testnet)
### SIGNER_MISMATCH
- **Cause**: Signature doesn't match wallet
- **Fix**: Verify signature recovery process
### PAYMENT_REQUIRED
- **Cause**: User lacks required tokens
- **Fix**: Use authenticate_and_purchase to obtain tokens
## Generate Debug Report
Create a comprehensive debug report including:
1. Current configuration status
2. Recent error patterns
3. Proof validation results
4. Token verification status
5. Recommended fixes
Enable debug mode temporarily if needed:
```typescript
const radius = new RadiusMcpSdk({
contractAddress: process.env.EVMAUTH_CONTRACT_ADDRESS,
debug: true // Temporary for debugging
});
```
|