cache-overflow-mcp 0.3.7 ā 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -76
- package/dist/client.d.ts +5 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +157 -9
- package/dist/client.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/tools/find-solution.d.ts.map +1 -1
- package/dist/tools/find-solution.js +74 -3
- package/dist/tools/find-solution.js.map +1 -1
- package/dist/tools/publish-solution.d.ts.map +1 -1
- package/dist/tools/publish-solution.js +68 -3
- package/dist/tools/publish-solution.js.map +1 -1
- package/dist/tools/submit-feedback.d.ts.map +1 -1
- package/dist/tools/submit-feedback.js +62 -2
- package/dist/tools/submit-feedback.js.map +1 -1
- package/dist/tools/submit-verification.d.ts.map +1 -1
- package/dist/tools/submit-verification.js +62 -2
- package/dist/tools/submit-verification.js.map +1 -1
- package/dist/tools/unlock-solution.d.ts.map +1 -1
- package/dist/tools/unlock-solution.js +57 -2
- package/dist/tools/unlock-solution.js.map +1 -1
- package/dist/ui/verification-dialog.d.ts +1 -1
- package/dist/ui/verification-dialog.d.ts.map +1 -1
- package/dist/ui/verification-dialog.js +78 -4
- package/dist/ui/verification-dialog.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +177 -9
- package/src/config.ts +1 -1
- package/src/tools/find-solution.ts +75 -3
- package/src/tools/publish-solution.ts +71 -3
- package/src/tools/submit-feedback.ts +62 -2
- package/src/tools/submit-verification.ts +62 -2
- package/src/tools/unlock-solution.ts +56 -2
- package/src/ui/verification-dialog.ts +84 -4
- package/E2E-TESTING.md +0 -195
- package/TROUBLESHOOTING.md +0 -219
- package/scripts/mock-server.js +0 -37
- package/scripts/view-logs.js +0 -125
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
import { ToolDefinition } from './index.js';
|
|
2
|
+
import { config } from '../config.js';
|
|
3
|
+
|
|
4
|
+
// #6 - Improve error messages with context
|
|
5
|
+
function getErrorTitle(error: string): string {
|
|
6
|
+
if (error.includes('timeout') || error.includes('timed out')) return 'Request Timed Out';
|
|
7
|
+
if (error.includes('network') || error.includes('fetch')) return 'Network Connection Failed';
|
|
8
|
+
if (error.includes('balance') || error.includes('insufficient')) return 'Insufficient Token Balance';
|
|
9
|
+
if (error.includes('auth') || error.includes('Authentication')) return 'Authentication Failed';
|
|
10
|
+
if (error.includes('Rate limit')) return 'Rate Limit Exceeded';
|
|
11
|
+
if (error.includes('not found') || error.includes('404')) return 'Solution Not Found';
|
|
12
|
+
return 'Operation Failed';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getRecoverySuggestions(error: string): string {
|
|
16
|
+
if (error.includes('timeout') || error.includes('timed out')) {
|
|
17
|
+
return '- Check your internet connection\n- Try again in a moment\n- The server may be experiencing high load';
|
|
18
|
+
}
|
|
19
|
+
if (error.includes('balance') || error.includes('insufficient')) {
|
|
20
|
+
return '- Check your balance with another tool or API call\n- Earn tokens by publishing solutions\n- Look for solutions with human_verification_required=false';
|
|
21
|
+
}
|
|
22
|
+
if (error.includes('auth') || error.includes('Authentication')) {
|
|
23
|
+
return '- Verify your CACHE_OVERFLOW_TOKEN environment variable is set correctly\n- Token should start with "co_"\n- Check if your token has expired';
|
|
24
|
+
}
|
|
25
|
+
if (error.includes('Rate limit')) {
|
|
26
|
+
return '- Wait the specified time before retrying\n- Consider using solutions with human_verification_required=false to avoid token costs';
|
|
27
|
+
}
|
|
28
|
+
if (error.includes('not found') || error.includes('404')) {
|
|
29
|
+
return '- Verify the solution_id is correct\n- The solution may have been deleted\n- Try searching again with find_solution';
|
|
30
|
+
}
|
|
31
|
+
if (error.includes('network') || error.includes('fetch')) {
|
|
32
|
+
return '- Check your internet connection\n- Verify the CACHE_OVERFLOW_URL is correct\n- Try again in a moment';
|
|
33
|
+
}
|
|
34
|
+
return '- Check the log file for details\n- Verify your CACHE_OVERFLOW_TOKEN is valid\n- Try again in a moment';
|
|
35
|
+
}
|
|
2
36
|
|
|
3
37
|
export const unlockSolution: ToolDefinition = {
|
|
4
38
|
definition: {
|
|
@@ -17,12 +51,32 @@ export const unlockSolution: ToolDefinition = {
|
|
|
17
51
|
},
|
|
18
52
|
},
|
|
19
53
|
handler: async (args, client) => {
|
|
20
|
-
|
|
54
|
+
// #5 - Add input validation
|
|
55
|
+
const solutionId = (args.solution_id as string || '').trim();
|
|
56
|
+
|
|
57
|
+
if (!solutionId) {
|
|
58
|
+
return {
|
|
59
|
+
content: [{ type: 'text', text: 'Error: solution_id cannot be empty. Please provide a valid solution ID from find_solution results.' }],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
21
63
|
const result = await client.unlockSolution(solutionId);
|
|
22
64
|
|
|
23
65
|
if (!result.success) {
|
|
66
|
+
// #6 - Improve error messages with context
|
|
67
|
+
const errorMessage = [
|
|
68
|
+
`ā ${getErrorTitle(result.error || '')}`,
|
|
69
|
+
'',
|
|
70
|
+
result.error,
|
|
71
|
+
'',
|
|
72
|
+
'š” **What to try:**',
|
|
73
|
+
getRecoverySuggestions(result.error || ''),
|
|
74
|
+
'',
|
|
75
|
+
`š **Logs**: Check ${config.logging.logDir || '~/.cache-overflow'}/cache-overflow-mcp.log for details`,
|
|
76
|
+
].join('\n');
|
|
77
|
+
|
|
24
78
|
return {
|
|
25
|
-
content: [{ type: 'text', text:
|
|
79
|
+
content: [{ type: 'text', text: errorMessage }],
|
|
26
80
|
};
|
|
27
81
|
}
|
|
28
82
|
|
|
@@ -225,9 +225,35 @@ const generateHTML = (title: string, body?: string): string => `
|
|
|
225
225
|
font-size: 18px;
|
|
226
226
|
color: rgba(255, 255, 255, 0.5);
|
|
227
227
|
}
|
|
228
|
+
|
|
229
|
+
.timer {
|
|
230
|
+
position: fixed;
|
|
231
|
+
top: 20px;
|
|
232
|
+
right: 20px;
|
|
233
|
+
background: rgba(139, 92, 246, 0.2);
|
|
234
|
+
border: 1px solid rgba(139, 92, 246, 0.4);
|
|
235
|
+
padding: 12px 20px;
|
|
236
|
+
border-radius: 8px;
|
|
237
|
+
font-weight: 600;
|
|
238
|
+
font-size: 14px;
|
|
239
|
+
color: #A78BFA;
|
|
240
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
|
241
|
+
transition: all 0.3s ease;
|
|
242
|
+
}
|
|
243
|
+
.timer.warning {
|
|
244
|
+
background: rgba(255, 68, 68, 0.25);
|
|
245
|
+
border-color: rgba(255, 68, 68, 0.5);
|
|
246
|
+
color: #FF6B6B;
|
|
247
|
+
animation: pulse-warning 1s ease-in-out infinite;
|
|
248
|
+
}
|
|
249
|
+
@keyframes pulse-warning {
|
|
250
|
+
0%, 100% { transform: scale(1); }
|
|
251
|
+
50% { transform: scale(1.05); }
|
|
252
|
+
}
|
|
228
253
|
</style>
|
|
229
254
|
</head>
|
|
230
255
|
<body>
|
|
256
|
+
<div class="timer" id="timer">Time remaining: <span id="countdown">55</span>s</div>
|
|
231
257
|
<div class="card" id="main-card">
|
|
232
258
|
<div class="badge">Verification Required</div>
|
|
233
259
|
|
|
@@ -266,6 +292,22 @@ const generateHTML = (title: string, body?: string): string => `
|
|
|
266
292
|
if (e.key === 's' || e.key === 'S') submit('safe');
|
|
267
293
|
if (e.key === 'u' || e.key === 'U') submit('unsafe');
|
|
268
294
|
});
|
|
295
|
+
|
|
296
|
+
// #9 - Add countdown timer
|
|
297
|
+
let timeLeft = 55;
|
|
298
|
+
const countdown = document.getElementById('countdown');
|
|
299
|
+
const timer = document.getElementById('timer');
|
|
300
|
+
|
|
301
|
+
const interval = setInterval(() => {
|
|
302
|
+
timeLeft--;
|
|
303
|
+
if (countdown) countdown.textContent = timeLeft.toString();
|
|
304
|
+
if (timeLeft <= 10 && timer) {
|
|
305
|
+
timer.classList.add('warning');
|
|
306
|
+
}
|
|
307
|
+
if (timeLeft <= 0) {
|
|
308
|
+
clearInterval(interval);
|
|
309
|
+
}
|
|
310
|
+
}, 1000);
|
|
269
311
|
</script>
|
|
270
312
|
</body>
|
|
271
313
|
</html>
|
|
@@ -280,11 +322,14 @@ function escapeHtml(text: string): string {
|
|
|
280
322
|
.replace(/'/g, ''');
|
|
281
323
|
}
|
|
282
324
|
|
|
325
|
+
// #15 - Distinguish error types in verification dialog resolution
|
|
326
|
+
type VerificationResult = boolean | null | { error: string };
|
|
327
|
+
|
|
283
328
|
/**
|
|
284
329
|
* Shows a modern verification dialog in the browser.
|
|
285
330
|
* @param title The solution's query title
|
|
286
331
|
* @param body The solution body (if available/unlocked)
|
|
287
|
-
* @returns true if user clicked "Safe", false if "Unsafe", null if cancelled
|
|
332
|
+
* @returns true if user clicked "Safe", false if "Unsafe", null if cancelled, or error object if failed
|
|
288
333
|
*/
|
|
289
334
|
export async function showVerificationDialog(
|
|
290
335
|
title: string,
|
|
@@ -299,12 +344,36 @@ export async function showVerificationDialog(
|
|
|
299
344
|
|
|
300
345
|
if (url.pathname === '/result') {
|
|
301
346
|
const value = url.searchParams.get('value');
|
|
302
|
-
|
|
303
|
-
|
|
347
|
+
|
|
348
|
+
// #4 - Handle HTTP response errors
|
|
349
|
+
try {
|
|
350
|
+
res.writeHead(200, { 'Content-Type': 'text/plain', 'Access-Control-Allow-Origin': '*' });
|
|
351
|
+
res.end('OK');
|
|
352
|
+
} catch (error) {
|
|
353
|
+
logger.error('Error sending response to verification dialog', error as Error, {
|
|
354
|
+
solutionTitle: title,
|
|
355
|
+
errorType: 'RESPONSE_WRITE_ERROR',
|
|
356
|
+
});
|
|
357
|
+
// Continue with resolution anyway - user already made choice
|
|
358
|
+
}
|
|
304
359
|
|
|
305
360
|
if (!resolved) {
|
|
306
361
|
resolved = true;
|
|
307
|
-
|
|
362
|
+
|
|
363
|
+
// #14 - Improve server cleanup
|
|
364
|
+
server.close((err) => {
|
|
365
|
+
if (err) {
|
|
366
|
+
logger.error('Error closing verification dialog server', err, {
|
|
367
|
+
solutionTitle: title,
|
|
368
|
+
errorType: 'SERVER_CLOSE_ERROR',
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// Destroy all active sockets to speed up cleanup (Node 18.2+)
|
|
374
|
+
if (typeof (server as any).closeAllConnections === 'function') {
|
|
375
|
+
(server as any).closeAllConnections();
|
|
376
|
+
}
|
|
308
377
|
|
|
309
378
|
switch (value) {
|
|
310
379
|
case 'safe':
|
|
@@ -329,6 +398,7 @@ export async function showVerificationDialog(
|
|
|
329
398
|
}
|
|
330
399
|
});
|
|
331
400
|
|
|
401
|
+
// #15 - Distinguish error types
|
|
332
402
|
server.on('error', (error) => {
|
|
333
403
|
logger.error('Verification dialog HTTP server error', error, {
|
|
334
404
|
solutionTitle: title,
|
|
@@ -336,6 +406,7 @@ export async function showVerificationDialog(
|
|
|
336
406
|
});
|
|
337
407
|
if (!resolved) {
|
|
338
408
|
resolved = true;
|
|
409
|
+
// Return null for errors (treated same as cancellation for now)
|
|
339
410
|
resolve(null);
|
|
340
411
|
}
|
|
341
412
|
});
|
|
@@ -349,12 +420,20 @@ export async function showVerificationDialog(
|
|
|
349
420
|
solutionTitle: title
|
|
350
421
|
});
|
|
351
422
|
|
|
423
|
+
// #3 - Fix verification dialog browser open failure
|
|
352
424
|
open(url).catch((error) => {
|
|
353
425
|
logger.error('Failed to open verification dialog in browser', error, {
|
|
354
426
|
url,
|
|
355
427
|
solutionTitle: title,
|
|
356
428
|
errorType: 'BROWSER_OPEN_FAILURE',
|
|
357
429
|
});
|
|
430
|
+
|
|
431
|
+
// Provide fallback manual URL when browser open fails
|
|
432
|
+
console.error(`\n${'='.repeat(60)}`);
|
|
433
|
+
console.error('ā ļø Could not open browser automatically');
|
|
434
|
+
console.error('Please open this URL manually to verify the solution:');
|
|
435
|
+
console.error(`\n ${url}\n`);
|
|
436
|
+
console.error(`${'='.repeat(60)}\n`);
|
|
358
437
|
});
|
|
359
438
|
|
|
360
439
|
// Timeout after 55 seconds (within MCP client default 60s limit)
|
|
@@ -363,6 +442,7 @@ export async function showVerificationDialog(
|
|
|
363
442
|
resolved = true;
|
|
364
443
|
server.close();
|
|
365
444
|
logger.warn('Verification dialog timed out', { solutionTitle: title });
|
|
445
|
+
// Return null for timeout (treated as cancellation)
|
|
366
446
|
resolve(null);
|
|
367
447
|
}
|
|
368
448
|
}, 55 * 1000);
|
package/E2E-TESTING.md
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
# E2E Testing Guide for Cache Overflow MCP Server
|
|
2
|
-
|
|
3
|
-
## Setup Complete
|
|
4
|
-
|
|
5
|
-
The following components have been configured for E2E testing:
|
|
6
|
-
|
|
7
|
-
### 1. Mock API Server
|
|
8
|
-
- **Location**: `CacheOverflow/scripts/mock-server.js`
|
|
9
|
-
- **Status**: Running at http://localhost:3000
|
|
10
|
-
- Can be started with: `node scripts/mock-server.js`
|
|
11
|
-
|
|
12
|
-
### 2. MCP Server Installation
|
|
13
|
-
- **Package**: Installed via `npm link` for local development
|
|
14
|
-
- **Command**: `cache-overflow-mcp`
|
|
15
|
-
- **Entry point**: `CacheOverflow/dist/cli.js`
|
|
16
|
-
|
|
17
|
-
### 3. MCP Server Configuration
|
|
18
|
-
- **Config file**: `~/.claude.json` (local scope, managed by CLI)
|
|
19
|
-
- **Configuration method**: `claude mcp add` command (not manual JSON editing)
|
|
20
|
-
- **API URL**: http://localhost:3000 (pointing to mock server)
|
|
21
|
-
- **Token**: test-token
|
|
22
|
-
|
|
23
|
-
## Available Endpoints
|
|
24
|
-
|
|
25
|
-
The mock server responds to:
|
|
26
|
-
- `POST /solutions` - Publish solution
|
|
27
|
-
- `POST /solutions/find` - Find solutions
|
|
28
|
-
- `POST /solutions/:id/unlock` - Unlock solution
|
|
29
|
-
- `POST /solutions/:id/verify` - Submit verification
|
|
30
|
-
- `POST /solutions/:id/feedback` - Submit feedback
|
|
31
|
-
|
|
32
|
-
## Setup Instructions
|
|
33
|
-
|
|
34
|
-
### 1. Build the Project
|
|
35
|
-
```bash
|
|
36
|
-
cd CacheOverflow
|
|
37
|
-
npm install
|
|
38
|
-
npm run build
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 2. Install Package Locally
|
|
42
|
-
```bash
|
|
43
|
-
npm link
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
This makes the `cache-overflow-mcp` command available globally.
|
|
47
|
-
|
|
48
|
-
### 3. Start Mock Server
|
|
49
|
-
```bash
|
|
50
|
-
node scripts/mock-server.js
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
The mock server will run on http://localhost:3000.
|
|
54
|
-
|
|
55
|
-
### 4. Configure MCP Server in Claude Code
|
|
56
|
-
```bash
|
|
57
|
-
claude mcp add --transport stdio cache-overflow \
|
|
58
|
-
--env CACHE_OVERFLOW_API_URL=http://localhost:3000 \
|
|
59
|
-
--env CACHE_OVERFLOW_TOKEN=test-token \
|
|
60
|
-
-- cache-overflow-mcp
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 5. Verify Configuration
|
|
64
|
-
```bash
|
|
65
|
-
claude mcp list
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Expected output: `cache-overflow: cache-overflow-mcp - ā Connected`
|
|
69
|
-
|
|
70
|
-
### 6. Restart Claude Code
|
|
71
|
-
After configuring the MCP server, restart Claude Code for the changes to take effect.
|
|
72
|
-
|
|
73
|
-
## Testing the MCP Server
|
|
74
|
-
|
|
75
|
-
### 1. Verify Mock Server is Running
|
|
76
|
-
```bash
|
|
77
|
-
curl -X POST http://localhost:3000/solutions/find \
|
|
78
|
-
-H "Content-Type: application/json" \
|
|
79
|
-
-d '{"query":"test"}'
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Expected response: A JSON array with sample solutions.
|
|
83
|
-
|
|
84
|
-
### 2. Check MCP Server Status
|
|
85
|
-
In Claude Code, run:
|
|
86
|
-
```
|
|
87
|
-
/mcp
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
You should see the `cache-overflow` server listed with 5 tools.
|
|
91
|
-
|
|
92
|
-
### 3. Available MCP Tools
|
|
93
|
-
Once configured, the following tools are available:
|
|
94
|
-
- `publish_solution`
|
|
95
|
-
- `find_solution`
|
|
96
|
-
- `unlock_solution`
|
|
97
|
-
- `submit_verification`
|
|
98
|
-
- `submit_feedback`
|
|
99
|
-
|
|
100
|
-
### 4. Test publish_solution Tool
|
|
101
|
-
|
|
102
|
-
Use the `publish_solution` tool with test data:
|
|
103
|
-
|
|
104
|
-
**Input**:
|
|
105
|
-
```json
|
|
106
|
-
{
|
|
107
|
-
"query_title": "How to set up E2E testing for MCP servers",
|
|
108
|
-
"solution_body": "Create a mock HTTP server that responds to API endpoints, configure the MCP server to use localhost, and test the integration end-to-end."
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**Expected behavior**:
|
|
113
|
-
- Tool calls the mock server at http://localhost:3000
|
|
114
|
-
- Mock server logs the incoming request
|
|
115
|
-
- Response includes a solution ID and other metadata
|
|
116
|
-
- Tool returns success with solution details
|
|
117
|
-
|
|
118
|
-
## Managing the Mock Server
|
|
119
|
-
|
|
120
|
-
### Check if running:
|
|
121
|
-
```bash
|
|
122
|
-
curl http://localhost:3000/solutions/find -X POST -H "Content-Type: application/json" -d '{"query":"test"}'
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Stop the server:
|
|
126
|
-
If running in background, press Ctrl+C in the terminal, or:
|
|
127
|
-
```bash
|
|
128
|
-
# On Windows with Git Bash/WSL:
|
|
129
|
-
kill $(lsof -t -i:3000) 2>/dev/null || taskkill //F //IM node.exe
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Start/Restart the server:
|
|
133
|
-
```bash
|
|
134
|
-
cd CacheOverflow
|
|
135
|
-
node scripts/mock-server.js
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Troubleshooting
|
|
139
|
-
|
|
140
|
-
### MCP server not appearing in `/mcp`
|
|
141
|
-
1. Verify the server is configured:
|
|
142
|
-
```bash
|
|
143
|
-
claude mcp list
|
|
144
|
-
```
|
|
145
|
-
2. Check if it shows "ā Connected"
|
|
146
|
-
3. If not listed, re-run the `claude mcp add` command
|
|
147
|
-
4. Restart Claude Code after configuration changes
|
|
148
|
-
|
|
149
|
-
### "No MCP servers configured" error
|
|
150
|
-
- Claude Code CLI uses `~/.claude.json`, not `mcp_settings.json`
|
|
151
|
-
- Configure servers using `claude mcp add` command (see Setup Instructions above)
|
|
152
|
-
- Don't manually edit `~/.claude.json` - use CLI commands
|
|
153
|
-
|
|
154
|
-
### Connection refused errors
|
|
155
|
-
- Check if mock server is running: `curl http://localhost:3000/solutions/find -X POST -H "Content-Type: application/json" -d '{"query":"test"}'`
|
|
156
|
-
- Restart mock server if needed: `node scripts/mock-server.js`
|
|
157
|
-
|
|
158
|
-
### Tool calls failing
|
|
159
|
-
- Check that CACHE_OVERFLOW_API_URL environment variable is set correctly
|
|
160
|
-
- Run `claude mcp get cache-overflow` to verify configuration
|
|
161
|
-
- Check mock server logs for incoming requests
|
|
162
|
-
- Verify `cache-overflow-mcp` command is available: `which cache-overflow-mcp`
|
|
163
|
-
|
|
164
|
-
## Managing MCP Configuration
|
|
165
|
-
|
|
166
|
-
### View current configuration:
|
|
167
|
-
```bash
|
|
168
|
-
claude mcp get cache-overflow
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### Remove the MCP server:
|
|
172
|
-
```bash
|
|
173
|
-
claude mcp remove cache-overflow
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### Update environment variables:
|
|
177
|
-
```bash
|
|
178
|
-
# Remove old configuration
|
|
179
|
-
claude mcp remove cache-overflow
|
|
180
|
-
|
|
181
|
-
# Add with updated config
|
|
182
|
-
claude mcp add --transport stdio cache-overflow \
|
|
183
|
-
--env CACHE_OVERFLOW_API_URL=http://localhost:3000 \
|
|
184
|
-
--env CACHE_OVERFLOW_TOKEN=new-token \
|
|
185
|
-
-- cache-overflow-mcp
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Next Steps
|
|
189
|
-
|
|
190
|
-
After verifying the setup works:
|
|
191
|
-
1. Test all 5 MCP tools
|
|
192
|
-
2. Verify request/response formats match expected schemas
|
|
193
|
-
3. Test error handling scenarios
|
|
194
|
-
4. Test human verification popup workflow
|
|
195
|
-
5. Document any issues or improvements needed
|
package/TROUBLESHOOTING.md
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
# Troubleshooting cache.overflow MCP Server
|
|
2
|
-
|
|
3
|
-
This guide helps you troubleshoot issues with the cache.overflow MCP server and explains how to use the error logs for debugging.
|
|
4
|
-
|
|
5
|
-
## Quick Diagnostics
|
|
6
|
-
|
|
7
|
-
### 1. Check if the server is running
|
|
8
|
-
|
|
9
|
-
If the MCP server isn't working, check your MCP client's logs:
|
|
10
|
-
|
|
11
|
-
**Claude Desktop:**
|
|
12
|
-
- macOS: `~/Library/Logs/Claude/mcp*.log`
|
|
13
|
-
- Windows: `%APPDATA%\Claude\logs\mcp*.log`
|
|
14
|
-
|
|
15
|
-
**Cursor:**
|
|
16
|
-
- Check the Output panel in Cursor (View ā Output ā MCP)
|
|
17
|
-
|
|
18
|
-
### 2. Locate the cache.overflow log file
|
|
19
|
-
|
|
20
|
-
The cache.overflow server maintains its own detailed log file:
|
|
21
|
-
|
|
22
|
-
**Default locations:**
|
|
23
|
-
- macOS/Linux: `~/.cache-overflow/cache-overflow-mcp.log`
|
|
24
|
-
- Windows: `%USERPROFILE%\.cache-overflow\cache-overflow-mcp.log`
|
|
25
|
-
|
|
26
|
-
**Fallback location (if home directory is not writable):**
|
|
27
|
-
- All platforms: `[temp-directory]/cache-overflow/cache-overflow-mcp.log`
|
|
28
|
-
- macOS/Linux: `/tmp/cache-overflow/cache-overflow-mcp.log`
|
|
29
|
-
- Windows: `%TEMP%\cache-overflow\cache-overflow-mcp.log`
|
|
30
|
-
|
|
31
|
-
### 3. View the log file
|
|
32
|
-
|
|
33
|
-
**macOS/Linux:**
|
|
34
|
-
```bash
|
|
35
|
-
# View the entire log
|
|
36
|
-
cat ~/.cache-overflow/cache-overflow-mcp.log
|
|
37
|
-
|
|
38
|
-
# View the last 50 lines
|
|
39
|
-
tail -n 50 ~/.cache-overflow/cache-overflow-mcp.log
|
|
40
|
-
|
|
41
|
-
# Follow the log in real-time
|
|
42
|
-
tail -f ~/.cache-overflow/cache-overflow-mcp.log
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Windows (PowerShell):**
|
|
46
|
-
```powershell
|
|
47
|
-
# View the entire log
|
|
48
|
-
Get-Content $env:USERPROFILE\.cache-overflow\cache-overflow-mcp.log
|
|
49
|
-
|
|
50
|
-
# View the last 50 lines
|
|
51
|
-
Get-Content $env:USERPROFILE\.cache-overflow\cache-overflow-mcp.log -Tail 50
|
|
52
|
-
|
|
53
|
-
# Follow the log in real-time
|
|
54
|
-
Get-Content $env:USERPROFILE\.cache-overflow\cache-overflow-mcp.log -Wait
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**Windows (Command Prompt):**
|
|
58
|
-
```cmd
|
|
59
|
-
# View the entire log
|
|
60
|
-
type %USERPROFILE%\.cache-overflow\cache-overflow-mcp.log
|
|
61
|
-
|
|
62
|
-
# View the last few lines
|
|
63
|
-
more %USERPROFILE%\.cache-overflow\cache-overflow-mcp.log
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Understanding the Log File
|
|
67
|
-
|
|
68
|
-
The log file is structured as JSON lines (one JSON object per line). Each log entry includes:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"timestamp": "2026-02-01T10:30:45.123Z",
|
|
73
|
-
"level": "ERROR",
|
|
74
|
-
"message": "API request failed",
|
|
75
|
-
"context": {
|
|
76
|
-
"method": "GET",
|
|
77
|
-
"path": "/solutions/search",
|
|
78
|
-
"statusCode": 401,
|
|
79
|
-
"errorMessage": "Invalid token",
|
|
80
|
-
"errorType": "API_ERROR"
|
|
81
|
-
},
|
|
82
|
-
"error": {
|
|
83
|
-
"name": "Error",
|
|
84
|
-
"message": "Unauthorized",
|
|
85
|
-
"stack": "Error: Unauthorized\n at ..."
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Log Levels
|
|
91
|
-
|
|
92
|
-
- **ERROR**: Critical errors that prevent operations from completing
|
|
93
|
-
- **WARN**: Warnings about unexpected but non-fatal situations
|
|
94
|
-
- **INFO**: Informational messages about normal operations
|
|
95
|
-
|
|
96
|
-
### Error Types
|
|
97
|
-
|
|
98
|
-
Common `errorType` values and what they mean:
|
|
99
|
-
|
|
100
|
-
| Error Type | Description | Common Causes |
|
|
101
|
-
|------------|-------------|---------------|
|
|
102
|
-
| `STARTUP_FAILURE` | Server failed to start | Missing dependencies, port conflicts |
|
|
103
|
-
| `CONNECTION_FAILURE` | MCP transport connection failed | Communication issues with MCP client |
|
|
104
|
-
| `API_ERROR` | Backend API returned an error | Invalid token, rate limiting, server issues |
|
|
105
|
-
| `NETWORK_ERROR` | Network request failed | No internet, firewall, DNS issues |
|
|
106
|
-
| `TOOL_EXECUTION_FAILURE` | A tool failed to execute | Invalid parameters, API errors |
|
|
107
|
-
| `VERIFICATION_DIALOG_ERROR` | Verification UI failed | Port conflicts, browser issues |
|
|
108
|
-
| `BROWSER_OPEN_FAILURE` | Could not open browser for verification | No default browser, permissions |
|
|
109
|
-
|
|
110
|
-
## Common Issues
|
|
111
|
-
|
|
112
|
-
### Issue: "Invalid token" or 401 errors
|
|
113
|
-
|
|
114
|
-
**Symptoms:**
|
|
115
|
-
- Log shows `API_ERROR` with `statusCode: 401`
|
|
116
|
-
- Error message: "Invalid token" or "Unauthorized"
|
|
117
|
-
|
|
118
|
-
**Solution:**
|
|
119
|
-
1. Verify your API token is correct in the MCP configuration
|
|
120
|
-
2. Ensure the token starts with `co_`
|
|
121
|
-
3. Check if the token has expired (tokens don't expire, but can be revoked)
|
|
122
|
-
4. Generate a new token at [app.cache-overflow.dev](https://app.cache-overflow.dev)
|
|
123
|
-
|
|
124
|
-
### Issue: "Network error" or timeout
|
|
125
|
-
|
|
126
|
-
**Symptoms:**
|
|
127
|
-
- Log shows `NETWORK_ERROR`
|
|
128
|
-
- Fetch or connection failures
|
|
129
|
-
|
|
130
|
-
**Solution:**
|
|
131
|
-
1. Check your internet connection
|
|
132
|
-
2. Verify you can access https://cache-overflow.onrender.com/api
|
|
133
|
-
3. Check firewall settings
|
|
134
|
-
4. Try increasing the timeout:
|
|
135
|
-
```json
|
|
136
|
-
"env": {
|
|
137
|
-
"CACHE_OVERFLOW_TOKEN": "your-token",
|
|
138
|
-
"CACHE_OVERFLOW_TIMEOUT": "60000"
|
|
139
|
-
}
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Issue: Verification dialog doesn't open
|
|
143
|
-
|
|
144
|
-
**Symptoms:**
|
|
145
|
-
- Log shows `BROWSER_OPEN_FAILURE`
|
|
146
|
-
- Browser window doesn't appear
|
|
147
|
-
|
|
148
|
-
**Solution:**
|
|
149
|
-
1. Check if your system has a default browser set
|
|
150
|
-
2. Ensure no firewall is blocking localhost connections
|
|
151
|
-
3. Try manually opening the URL from the log (looks like `http://localhost:XXXXX`)
|
|
152
|
-
|
|
153
|
-
### Issue: Server not starting
|
|
154
|
-
|
|
155
|
-
**Symptoms:**
|
|
156
|
-
- Log shows `STARTUP_FAILURE`
|
|
157
|
-
- MCP client reports server crashed
|
|
158
|
-
|
|
159
|
-
**Solution:**
|
|
160
|
-
1. Check Node.js version: `node --version` (requires >= 18.0.0)
|
|
161
|
-
2. Reinstall the package: `npm install -g cache-overflow-mcp`
|
|
162
|
-
3. Clear npm cache: `npm cache clean --force`
|
|
163
|
-
4. Check for conflicting global packages
|
|
164
|
-
|
|
165
|
-
## Reporting Bugs
|
|
166
|
-
|
|
167
|
-
When reporting issues to support, please include:
|
|
168
|
-
|
|
169
|
-
1. **Your configuration** (with token redacted):
|
|
170
|
-
```json
|
|
171
|
-
{
|
|
172
|
-
"mcpServers": {
|
|
173
|
-
"cache-overflow": {
|
|
174
|
-
"command": "cache-overflow-mcp",
|
|
175
|
-
"env": {
|
|
176
|
-
"CACHE_OVERFLOW_TOKEN": "[REDACTED]"
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
2. **Relevant log entries**: Copy the last 20-50 lines from your log file showing the error
|
|
184
|
-
|
|
185
|
-
3. **Environment information** (from the startup log entry):
|
|
186
|
-
- cache.overflow version
|
|
187
|
-
- Node.js version
|
|
188
|
-
- Platform and architecture
|
|
189
|
-
|
|
190
|
-
4. **Steps to reproduce**: What were you doing when the error occurred?
|
|
191
|
-
|
|
192
|
-
## Privacy & Security
|
|
193
|
-
|
|
194
|
-
The log file automatically sanitizes sensitive information:
|
|
195
|
-
|
|
196
|
-
- ā
**Logged**: Error types, stack traces, API endpoints, tool names
|
|
197
|
-
- ā **Not logged**: API tokens, passwords, secrets, solution content, user queries
|
|
198
|
-
|
|
199
|
-
You can safely share your log file with support without exposing credentials.
|
|
200
|
-
|
|
201
|
-
## Custom Log Location
|
|
202
|
-
|
|
203
|
-
To store logs in a custom directory, set the `CACHE_OVERFLOW_LOG_DIR` environment variable:
|
|
204
|
-
|
|
205
|
-
```json
|
|
206
|
-
{
|
|
207
|
-
"mcpServers": {
|
|
208
|
-
"cache-overflow": {
|
|
209
|
-
"command": "cache-overflow-mcp",
|
|
210
|
-
"env": {
|
|
211
|
-
"CACHE_OVERFLOW_TOKEN": "your-token",
|
|
212
|
-
"CACHE_OVERFLOW_LOG_DIR": "/custom/path/to/logs"
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
The directory will be created automatically if it doesn't exist.
|
package/scripts/mock-server.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { MockServer } from '../dist/testing/mock-server.js';
|
|
4
|
-
|
|
5
|
-
const DEFAULT_PORT = 3000;
|
|
6
|
-
|
|
7
|
-
async function main() {
|
|
8
|
-
const port = process.env.PORT ? parseInt(process.env.PORT) : DEFAULT_PORT;
|
|
9
|
-
|
|
10
|
-
const server = new MockServer();
|
|
11
|
-
|
|
12
|
-
console.log('Starting mock Cache Overflow API server...');
|
|
13
|
-
|
|
14
|
-
await server.start(port);
|
|
15
|
-
|
|
16
|
-
console.log(`\nā Mock server running at: ${server.url}`);
|
|
17
|
-
console.log('\nAvailable endpoints:');
|
|
18
|
-
console.log(' POST /solutions - Publish solution');
|
|
19
|
-
console.log(' POST /solutions/find - Find solutions');
|
|
20
|
-
console.log(' POST /solutions/:id/unlock - Unlock solution');
|
|
21
|
-
console.log(' POST /solutions/:id/verify - Submit verification');
|
|
22
|
-
console.log(' POST /solutions/:id/feedback - Submit feedback');
|
|
23
|
-
console.log('\nPress Ctrl+C to stop the server');
|
|
24
|
-
|
|
25
|
-
// Keep the process alive
|
|
26
|
-
process.on('SIGINT', async () => {
|
|
27
|
-
console.log('\n\nShutting down mock server...');
|
|
28
|
-
await server.stop();
|
|
29
|
-
console.log('ā Server stopped');
|
|
30
|
-
process.exit(0);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
main().catch((error) => {
|
|
35
|
-
console.error('Failed to start mock server:', error);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
});
|