@supermodeltools/mcp-server 0.4.3 → 0.4.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 +27 -13
- package/dist/cache/graph-cache.js +260 -0
- package/dist/cache/graph-types.js +6 -0
- package/dist/cache/index.js +21 -0
- package/dist/queries/discovery.js +148 -0
- package/dist/queries/index.js +241 -0
- package/dist/queries/summary.js +36 -0
- package/dist/queries/traversal.js +392 -0
- package/dist/queries/types.js +38 -0
- package/dist/server.js +38 -1
- package/dist/tools/create-supermodel-graph.js +500 -29
- package/dist/utils/zip-repository.js +332 -0
- package/package.json +4 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Query types and result shapes for the query engine
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isQueryError = isQueryError;
|
|
7
|
+
exports.createError = createError;
|
|
8
|
+
exports.createResponse = createResponse;
|
|
9
|
+
// Type guard for error responses
|
|
10
|
+
function isQueryError(result) {
|
|
11
|
+
return (typeof result === 'object' &&
|
|
12
|
+
result !== null &&
|
|
13
|
+
'error' in result &&
|
|
14
|
+
typeof result.error === 'object');
|
|
15
|
+
}
|
|
16
|
+
// Create error response
|
|
17
|
+
function createError(code, message, options) {
|
|
18
|
+
return {
|
|
19
|
+
error: {
|
|
20
|
+
code,
|
|
21
|
+
message,
|
|
22
|
+
retryable: options?.retryable,
|
|
23
|
+
detail: options?.detail,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// Create success response
|
|
28
|
+
function createResponse(query, cacheKey, source, cachedAt, result, options) {
|
|
29
|
+
return {
|
|
30
|
+
query,
|
|
31
|
+
cacheKey,
|
|
32
|
+
source,
|
|
33
|
+
cachedAt,
|
|
34
|
+
result,
|
|
35
|
+
page: options?.page,
|
|
36
|
+
warnings: options?.warnings,
|
|
37
|
+
};
|
|
38
|
+
}
|
package/dist/server.js
CHANGED
|
@@ -9,6 +9,7 @@ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
|
9
9
|
const sdk_1 = require("@supermodeltools/sdk");
|
|
10
10
|
const create_supermodel_graph_1 = __importDefault(require("./tools/create-supermodel-graph"));
|
|
11
11
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
12
|
+
const zip_repository_1 = require("./utils/zip-repository");
|
|
12
13
|
class Server {
|
|
13
14
|
server;
|
|
14
15
|
client;
|
|
@@ -18,7 +19,40 @@ class Server {
|
|
|
18
19
|
version: '0.0.1',
|
|
19
20
|
}, {
|
|
20
21
|
capabilities: { tools: {}, logging: {} },
|
|
21
|
-
instructions:
|
|
22
|
+
instructions: `# Server Instructions: Supermodel Codebase Explorer
|
|
23
|
+
|
|
24
|
+
## Graph Rules
|
|
25
|
+
- This API produces graphs of the code contained within a target directory.
|
|
26
|
+
- STRATEGY: Before debugging, planning, or analyzing a change to a code repository, generate a code graph. Use it to localize changes and find what files to search more efficiently than grep.
|
|
27
|
+
|
|
28
|
+
## Debugging Strategy
|
|
29
|
+
1. Generate a code graph of the given repository or a subset.
|
|
30
|
+
2. Analyze the nodes and relationships which appear to be related to your issue.
|
|
31
|
+
3. Analyze the broader context of these nodes in relationships within their domain and subdomain.
|
|
32
|
+
4. Use the graph like a diagram to navigate the codebase more efficiently than raw grep and to analyze the potential blast radius of any change.
|
|
33
|
+
|
|
34
|
+
## Planning Strategy
|
|
35
|
+
1. Generate a code graph of the given repository or a subset.
|
|
36
|
+
2. Analyze relationships like dependencies, calls, and inheritance to identify the potential blast radius of a proposed change.
|
|
37
|
+
3. Examine other elements of the same Domain and Subdomain to look for patterns including best practices or anti-patterns.
|
|
38
|
+
4. Look at the nodes you plan to change and find their physical locations, allowing you to analyze more efficiently than blind grepping.
|
|
39
|
+
|
|
40
|
+
## Analysis Strategy
|
|
41
|
+
1. Generate a code graph of the given repository or a subset.
|
|
42
|
+
2. Analyze the system domains to understand the high-level system architecture.
|
|
43
|
+
3. Examine leaf nodes to see the structure of the broader tree.
|
|
44
|
+
4. Use the graph like a map to navigate the codebase more efficiently than blind grepping.
|
|
45
|
+
|
|
46
|
+
## Performance Optimization
|
|
47
|
+
|
|
48
|
+
For localized bugs:
|
|
49
|
+
1. Identify the affected subsystem from the issue description
|
|
50
|
+
2. Analyze only that subdirectory (e.g., \`django/db\` instead of full repo)
|
|
51
|
+
3. This is faster, uses less memory, and avoids ZIP size limits
|
|
52
|
+
|
|
53
|
+
Example:
|
|
54
|
+
- Full repo: directory="/repo" → 180MB, 50k nodes
|
|
55
|
+
- Subsystem: directory="/repo/django/db" → 15MB, 3k nodes`,
|
|
22
56
|
});
|
|
23
57
|
const config = new sdk_1.Configuration({
|
|
24
58
|
basePath: process.env.SUPERMODEL_BASE_URL || 'https://api.supermodeltools.com',
|
|
@@ -47,6 +81,9 @@ class Server {
|
|
|
47
81
|
});
|
|
48
82
|
}
|
|
49
83
|
async start() {
|
|
84
|
+
// Clean up any stale ZIP files from previous sessions
|
|
85
|
+
// (older than 24 hours)
|
|
86
|
+
await (0, zip_repository_1.cleanupOldZips)(24 * 60 * 60 * 1000);
|
|
50
87
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
51
88
|
await this.server.connect(transport);
|
|
52
89
|
console.error('Supermodel MCP Server running on stdio');
|