@supermodeltools/mcp-server 0.5.3 → 0.5.4
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 +273 -26
- package/dist/tools/create-supermodel-graph.js +31 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,45 @@ MCP server that provides deep codebase analysis to AI agents via the [Supermodel
|
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
|
+
### Quick Setup (Recommended)
|
|
12
|
+
|
|
13
|
+
Run the setup script to configure the recommended timeout settings:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl -sSL https://raw.githubusercontent.com/supermodeltools/mcp/main/setup.sh | bash
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
<details>
|
|
20
|
+
<summary>Prefer to inspect before running? (Click to expand)</summary>
|
|
21
|
+
|
|
22
|
+
Download, review, then execute:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Download the script
|
|
26
|
+
curl -sSL https://raw.githubusercontent.com/supermodeltools/mcp/main/setup.sh -o setup.sh
|
|
27
|
+
|
|
28
|
+
# Review the contents
|
|
29
|
+
cat setup.sh
|
|
30
|
+
|
|
31
|
+
# Make executable and run
|
|
32
|
+
chmod +x setup.sh
|
|
33
|
+
./setup.sh
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or clone the entire repo:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git clone https://github.com/supermodeltools/mcp.git
|
|
40
|
+
cd mcp
|
|
41
|
+
./setup.sh
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
</details>
|
|
45
|
+
|
|
46
|
+
This will configure `MCP_TOOL_TIMEOUT=900000` for optimal performance with large codebases.
|
|
47
|
+
|
|
48
|
+
### Manual Install
|
|
49
|
+
|
|
11
50
|
```bash
|
|
12
51
|
npm install -g @supermodeltools/mcp-server
|
|
13
52
|
```
|
|
@@ -18,6 +57,45 @@ Or run directly:
|
|
|
18
57
|
npx @supermodeltools/mcp-server
|
|
19
58
|
```
|
|
20
59
|
|
|
60
|
+
## ⚠️ Important: Configure Timeout for Large Codebase Analysis
|
|
61
|
+
|
|
62
|
+
The `explore_codebase` tool can take **5-15 minutes** to analyze large repositories. Most MCP clients have a default timeout of 60-120 seconds, which will cause the operation to fail prematurely.
|
|
63
|
+
|
|
64
|
+
**Quick Setup:**
|
|
65
|
+
|
|
66
|
+
Add this to your shell profile to set a 15-minute timeout:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
export MCP_TOOL_TIMEOUT=900000
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Installation by Client:**
|
|
73
|
+
|
|
74
|
+
<details>
|
|
75
|
+
<summary><strong>Claude Code CLI</strong></summary>
|
|
76
|
+
|
|
77
|
+
Add to your shell profile (`~/.zshrc` for macOS or `~/.bashrc` for Linux):
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
export MCP_TOOL_TIMEOUT=900000
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Then reload your shell:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
source ~/.zshrc # or ~/.bashrc
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Verify it's set:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
echo $MCP_TOOL_TIMEOUT
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
</details>
|
|
96
|
+
|
|
97
|
+
**Note:** Timeout configuration via `MCP_TOOL_TIMEOUT` is only supported in Claude Code CLI. For more details, see the [official Claude Code documentation](https://code.claude.com/docs/en/settings.md).
|
|
98
|
+
|
|
21
99
|
## Configuration
|
|
22
100
|
|
|
23
101
|
Get your API key from the [Supermodel Dashboard](https://dashboard.supermodeltools.com).
|
|
@@ -114,25 +192,7 @@ Add to `~/.cursor/mcp.json`:
|
|
|
114
192
|
}
|
|
115
193
|
```
|
|
116
194
|
|
|
117
|
-
### Claude
|
|
118
|
-
|
|
119
|
-
Add to `claude_desktop_config.json`:
|
|
120
|
-
|
|
121
|
-
```json
|
|
122
|
-
{
|
|
123
|
-
"mcpServers": {
|
|
124
|
-
"supermodel": {
|
|
125
|
-
"command": "npx",
|
|
126
|
-
"args": ["-y", "@supermodeltools/mcp-server"],
|
|
127
|
-
"env": {
|
|
128
|
-
"SUPERMODEL_API_KEY": "your-api-key"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Claude Code
|
|
195
|
+
### Claude Code CLI
|
|
136
196
|
|
|
137
197
|
Add the MCP server with your API key:
|
|
138
198
|
|
|
@@ -196,9 +256,176 @@ Analyzes code structure, dependencies, and relationships across a repository. Us
|
|
|
196
256
|
- Cleans up temporary files automatically
|
|
197
257
|
- Cross-platform compatible
|
|
198
258
|
|
|
259
|
+
## Tool Performance & Timeout Requirements
|
|
260
|
+
|
|
261
|
+
The `explore_codebase` tool analyzes your entire repository to build a comprehensive code graph. Analysis time scales with repository size and complexity.
|
|
262
|
+
|
|
263
|
+
| Tool | Typical Duration | Recommended Timeout | Repository Size |
|
|
264
|
+
|------|------------------|---------------------|--------------------|
|
|
265
|
+
| `explore_codebase` | 2-5 min | 600000ms (10 min) | Small (<1k files) |
|
|
266
|
+
| `explore_codebase` | 5-10 min | 900000ms (15 min) | Medium (1k-10k files) |
|
|
267
|
+
| `explore_codebase` | 10-15 min | 1200000ms (20 min) | Large (10k+ files) |
|
|
268
|
+
|
|
269
|
+
**Default recommendation**: The server uses a 15-minute timeout (`900000ms`) by default, which works well for most medium-sized repositories.
|
|
270
|
+
|
|
271
|
+
**Caching behavior**: The first run analyzes your codebase and caches the results. Subsequent queries on the same repository are typically much faster (seconds instead of minutes) as they use the cached graph.
|
|
272
|
+
|
|
273
|
+
**Setting custom timeouts**: If you need to adjust the timeout for larger repositories, you can set the `SUPERMODEL_TIMEOUT_MS` environment variable:
|
|
274
|
+
|
|
275
|
+
```json
|
|
276
|
+
{
|
|
277
|
+
"mcpServers": {
|
|
278
|
+
"supermodel": {
|
|
279
|
+
"command": "npx",
|
|
280
|
+
"args": ["-y", "@supermodeltools/mcp-server"],
|
|
281
|
+
"env": {
|
|
282
|
+
"SUPERMODEL_API_KEY": "your-api-key",
|
|
283
|
+
"SUPERMODEL_TIMEOUT_MS": "1200000"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
199
290
|
## Troubleshooting
|
|
200
291
|
|
|
201
|
-
|
|
292
|
+
### Timeout Errors
|
|
293
|
+
|
|
294
|
+
#### "Request timeout"
|
|
295
|
+
|
|
296
|
+
**Cause:** The analysis is taking longer than your MCP client's timeout allows (varies by client—Claude Code CLI defaults to ~2 minutes, Claude Desktop enforces 5 minutes). Large repositories or complex codebases may require more time to analyze.
|
|
297
|
+
|
|
298
|
+
**Solutions:**
|
|
299
|
+
|
|
300
|
+
1. **Analyze a subdirectory instead** - Target specific parts of your codebase:
|
|
301
|
+
```bash
|
|
302
|
+
# Instead of analyzing the entire repo
|
|
303
|
+
explore_codebase(directory="/path/to/repo")
|
|
304
|
+
|
|
305
|
+
# Analyze just the core module
|
|
306
|
+
explore_codebase(directory="/path/to/repo/src/core")
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
2. **Increase your MCP client timeout** - For Claude Code CLI, set the `MCP_TOOL_TIMEOUT` environment variable:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Set timeout to 15 minutes (900000ms) for large codebase analysis
|
|
313
|
+
export MCP_TOOL_TIMEOUT=900000
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Then reload your shell or start a new terminal session. This timeout applies to all MCP tool executions.
|
|
317
|
+
|
|
318
|
+
**Note:** Timeout configuration is currently only supported in Claude Code CLI.
|
|
319
|
+
|
|
320
|
+
3. **Verify `.gitignore` excludes build artifacts** - Ensure your repository excludes:
|
|
321
|
+
- `node_modules/`, `vendor/`, `venv/`
|
|
322
|
+
- `dist/`, `build/`, `out/`
|
|
323
|
+
- `.next/`, `.nuxt/`, `.cache/`
|
|
324
|
+
|
|
325
|
+
The MCP server automatically excludes these patterns when zipping, but `.gitignore` prevents them from being in your working directory in the first place—both improve performance and reduce analysis size.
|
|
326
|
+
|
|
327
|
+
#### "Analysis interrupted mid-way"
|
|
328
|
+
|
|
329
|
+
**Cause:** Network interruption or the MCP server process was terminated before completion.
|
|
330
|
+
|
|
331
|
+
**Solutions:**
|
|
332
|
+
|
|
333
|
+
1. **Check MCP server logs** - Logs location varies by client:
|
|
334
|
+
|
|
335
|
+
> **Note:** Log filenames match your MCP server name from the config. If you named it differently (e.g., `my-server`), look for `mcp-server-my-server.log` instead of `mcp-server-supermodel.log`.
|
|
336
|
+
|
|
337
|
+
**Claude Desktop (macOS):**
|
|
338
|
+
```bash
|
|
339
|
+
tail -f ~/Library/Logs/Claude/mcp-server-supermodel.log
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Claude Desktop (Windows):**
|
|
343
|
+
```powershell
|
|
344
|
+
Get-Content "$env:APPDATA\Claude\Logs\mcp-server-supermodel.log" -Wait
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Claude Desktop (Linux):**
|
|
348
|
+
```bash
|
|
349
|
+
tail -f ~/.config/Claude/logs/mcp-server-supermodel.log
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Cursor:**
|
|
353
|
+
```bash
|
|
354
|
+
# Check the Cursor logs directory
|
|
355
|
+
tail -f ~/Library/Application\ Support/Cursor/logs/mcp-server-supermodel.log
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Claude Code:**
|
|
359
|
+
```bash
|
|
360
|
+
# Logs are shown in the terminal when running with verbose mode
|
|
361
|
+
claude --verbose
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
2. **Retry the analysis** - Temporary network issues often resolve on retry
|
|
365
|
+
|
|
366
|
+
3. **Check your internet connection** - The analysis requires a stable connection to the Supermodel API
|
|
367
|
+
|
|
368
|
+
4. **Verify the API is accessible:**
|
|
369
|
+
```bash
|
|
370
|
+
curl -H "Authorization: Bearer YOUR_API_KEY" https://api.supermodeltools.com/health
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
#### "ERROR Request failed. Check the MCP server logs"
|
|
374
|
+
|
|
375
|
+
**Multiple possible causes:**
|
|
376
|
+
|
|
377
|
+
##### 1. Missing or invalid API key
|
|
378
|
+
|
|
379
|
+
Check if your API key is set:
|
|
380
|
+
```bash
|
|
381
|
+
echo $SUPERMODEL_API_KEY
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Verify it's valid at [Supermodel Dashboard](https://dashboard.supermodeltools.com).
|
|
385
|
+
|
|
386
|
+
**Solution:**
|
|
387
|
+
```bash
|
|
388
|
+
# Set in your shell profile (~/.zshrc or ~/.bashrc)
|
|
389
|
+
export SUPERMODEL_API_KEY="your-api-key"
|
|
390
|
+
source ~/.zshrc
|
|
391
|
+
|
|
392
|
+
# Or update your MCP client config with the correct key
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
##### 2. API service outage or rate limiting
|
|
396
|
+
|
|
397
|
+
Check the error details in logs (see log locations above).
|
|
398
|
+
|
|
399
|
+
**Solution:**
|
|
400
|
+
- Visit [Supermodel Status](https://status.supermodeltools.com) for service status
|
|
401
|
+
- If rate limited, wait a few minutes before retrying
|
|
402
|
+
- Consider upgrading your API plan if hitting rate limits frequently
|
|
403
|
+
|
|
404
|
+
##### 3. Repository too large
|
|
405
|
+
|
|
406
|
+
The API has size limits for analysis. Check the [Supermodel documentation](https://docs.supermodeltools.com) for current limits.
|
|
407
|
+
|
|
408
|
+
**Solution:**
|
|
409
|
+
```bash
|
|
410
|
+
# Check your repo size
|
|
411
|
+
du -sh /path/to/repo
|
|
412
|
+
|
|
413
|
+
# If too large, analyze subdirectories instead
|
|
414
|
+
explore_codebase(directory="/path/to/repo/src")
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
##### 4. Network or firewall issues
|
|
418
|
+
|
|
419
|
+
Corporate firewalls may block outbound requests to the Supermodel API.
|
|
420
|
+
|
|
421
|
+
**Solution:**
|
|
422
|
+
- Test connectivity: `curl https://api.supermodeltools.com/health`
|
|
423
|
+
- Check firewall rules allow HTTPS to `api.supermodeltools.com`
|
|
424
|
+
- Contact your IT department if behind a corporate proxy
|
|
425
|
+
|
|
426
|
+
### Debug Logging
|
|
427
|
+
|
|
428
|
+
Debug logs go to stderr and include:
|
|
202
429
|
|
|
203
430
|
- `[DEBUG] Server configuration:` - Startup config
|
|
204
431
|
- `[DEBUG] Auto-zipping directory:` - Starting zip creation
|
|
@@ -206,12 +433,32 @@ Debug logs go to stderr:
|
|
|
206
433
|
- `[DEBUG] Making API request` - Request details
|
|
207
434
|
- `[ERROR] API call failed:` - Error details with HTTP status
|
|
208
435
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
436
|
+
To enable verbose logging, set the `DEBUG` environment variable:
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
# In your MCP config
|
|
440
|
+
{
|
|
441
|
+
"mcpServers": {
|
|
442
|
+
"supermodel": {
|
|
443
|
+
"command": "npx",
|
|
444
|
+
"args": ["-y", "@supermodeltools/mcp-server"],
|
|
445
|
+
"env": {
|
|
446
|
+
"SUPERMODEL_API_KEY": "your-api-key",
|
|
447
|
+
"DEBUG": "supermodel:*"
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Common Issues
|
|
455
|
+
|
|
456
|
+
- **401 Unauthorized:** Check `SUPERMODEL_API_KEY` is set correctly
|
|
457
|
+
- **ZIP too large:** Directory contains too many files/dependencies. Ensure `.gitignore` is configured properly
|
|
458
|
+
- **Permission denied:** Check read permissions on the directory
|
|
459
|
+
- **Insufficient disk space:** Free up space in your system's temp directory
|
|
460
|
+
- **Directory does not exist:** Verify the path is correct and absolute
|
|
461
|
+
- **ENOTFOUND or connection errors:** Check your internet connection and firewall settings
|
|
215
462
|
|
|
216
463
|
## Benchmarking
|
|
217
464
|
|
|
@@ -53,7 +53,9 @@ exports.metadata = {
|
|
|
53
53
|
};
|
|
54
54
|
exports.tool = {
|
|
55
55
|
name: 'explore_codebase',
|
|
56
|
-
description: `
|
|
56
|
+
description: `Comprehensive codebase analysis using Supermodel API. ⚠️ This operation takes 5-15 minutes for large repositories. Ensure your Claude CLI timeout is configured (MCP_TOOL_TIMEOUT=900000). Analyzes code structure, dependencies, and patterns while respecting .gitignore.
|
|
57
|
+
|
|
58
|
+
Analyzes code within the target directory to produce a graph that can be used to navigate the codebase when solving bugs, planning or analyzing code changes.
|
|
57
59
|
|
|
58
60
|
## Example Output
|
|
59
61
|
|
|
@@ -625,7 +627,7 @@ async function logErrorResponse(error) {
|
|
|
625
627
|
}
|
|
626
628
|
}
|
|
627
629
|
/**
|
|
628
|
-
* Fetch graph from API with comprehensive logging
|
|
630
|
+
* Fetch graph from API with comprehensive logging and progress updates
|
|
629
631
|
*/
|
|
630
632
|
async function fetchFromApi(client, file, idempotencyKey) {
|
|
631
633
|
const startTime = Date.now();
|
|
@@ -643,17 +645,44 @@ async function fetchFromApi(client, file, idempotencyKey) {
|
|
|
643
645
|
file: fileBlob,
|
|
644
646
|
idempotencyKey: idempotencyKey,
|
|
645
647
|
};
|
|
648
|
+
// Start progress logging
|
|
649
|
+
console.error('[Supermodel] Starting codebase analysis...');
|
|
650
|
+
// Set up periodic progress updates every 15 seconds
|
|
651
|
+
let progressInterval = null;
|
|
652
|
+
let elapsedSeconds = 0;
|
|
653
|
+
progressInterval = setInterval(() => {
|
|
654
|
+
elapsedSeconds += 15;
|
|
655
|
+
console.error(`[Supermodel] Analysis in progress... (${elapsedSeconds}s elapsed)`);
|
|
656
|
+
}, 15000);
|
|
646
657
|
try {
|
|
647
658
|
const response = await client.graphs.generateSupermodelGraph(requestParams);
|
|
648
659
|
const duration = Date.now() - startTime;
|
|
660
|
+
// Clear progress interval
|
|
661
|
+
if (progressInterval) {
|
|
662
|
+
clearInterval(progressInterval);
|
|
663
|
+
progressInterval = null;
|
|
664
|
+
}
|
|
649
665
|
// Calculate approximate response size
|
|
650
666
|
const responseSize = JSON.stringify(response).length;
|
|
651
667
|
logResponse(200, 'OK', responseSize, duration);
|
|
668
|
+
// Log completion with summary
|
|
669
|
+
const summary = response.summary;
|
|
670
|
+
if (summary) {
|
|
671
|
+
console.error(`[Supermodel] Analysis complete, retrieving results... (${summary.filesProcessed || 0} files processed)`);
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
console.error('[Supermodel] Analysis complete, retrieving results...');
|
|
675
|
+
}
|
|
652
676
|
logger.debug(`[${getTimestamp()}] [API SUCCESS] Request completed successfully`);
|
|
653
677
|
return response;
|
|
654
678
|
}
|
|
655
679
|
catch (error) {
|
|
656
680
|
const duration = Date.now() - startTime;
|
|
681
|
+
// Clear progress interval on error
|
|
682
|
+
if (progressInterval) {
|
|
683
|
+
clearInterval(progressInterval);
|
|
684
|
+
progressInterval = null;
|
|
685
|
+
}
|
|
657
686
|
logger.error(`[${getTimestamp()}] [API FAILURE] Request failed after ${duration}ms`);
|
|
658
687
|
// Log detailed error information
|
|
659
688
|
await logErrorResponse(error);
|