summaryrefslogtreecommitdiff
path: root/mcp-servers/token-gated-mcp-server/.claude/commands/test-auth.md
blob: d9336a9d9e864d8e3e3e6fa2de48ef9da9123a75 (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
---
allowed-tools: Bash, Read, Write, TodoWrite
description: Test the complete authentication flow end-to-end
argument-hint: "[tool-name] [token-id]"
---

## Test Authentication Flow

Test the complete token-gated authentication flow for the specified tool.

Tool: $ARGUMENTS

## Testing Steps

1. **Check Current Configuration**
   - Verify environment variables: !`echo "Contract: $EVMAUTH_CONTRACT_ADDRESS, Chain: $EVMAUTH_CHAIN_ID"`
   - Check RPC connection: !`curl -s -X POST $EVMAUTH_RPC_URL -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' | jq -r '.result'`

2. **Start MCP Server**
   - Run the server if not already running
   - Note the port and endpoint

3. **Simulate Tool Call Without Auth**
   - Call the protected tool without __evmauth
   - Verify EVMAUTH_PROOF_MISSING error
   - Check error includes requiredTokens

4. **Simulate Authentication**
   - Mock authenticate_and_purchase response
   - Generate sample proof structure
   - Verify proof format is correct

5. **Test With Valid Proof**
   - Call tool with __evmauth parameter
   - Verify successful execution or PAYMENT_REQUIRED

6. **Test Error Scenarios**
   - Expired proof (> 30 seconds old)
   - Wrong chain ID
   - Invalid signature format
   - Missing required fields

## Create Test Script

Generate a test script that validates:

- Token protection is properly configured
- Error messages are AI-friendly
- Authentication flow works end-to-end
- Caching behaves correctly

## Expected Results

✅ **Success Criteria:**

- Tool rejects calls without auth
- Error messages guide to authenticate_and_purchase
- Valid proofs are accepted
- Token ownership is properly verified

❌ **Common Failures:**

- Chain ID mismatch
- Contract address not configured
- RPC connection issues
- Debug mode enabled in production

Generate comprehensive test results and recommendations.