@supermodeltools/mcp-server 0.4.12 → 0.5.1

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 CHANGED
@@ -66,6 +66,34 @@ With the API key set globally, you can omit the `env` block from your MCP config
66
66
  }
67
67
  ```
68
68
 
69
+ ### Default Working Directory (Optional)
70
+
71
+ For automated benchmarking tools (like mcpbr) or batch processing, you can specify a default working directory as a command-line argument. When provided, the `explore_codebase` tool will use this directory automatically if no explicit `directory` parameter is given.
72
+
73
+ **Command-line usage:**
74
+
75
+ ```bash
76
+ npx @supermodeltools/mcp-server /path/to/repository
77
+ ```
78
+
79
+ or with Node.js:
80
+
81
+ ```bash
82
+ node dist/index.js /path/to/repository
83
+ ```
84
+
85
+ **Example with benchmarking tools:**
86
+
87
+ ```yaml
88
+ mcp_server:
89
+ command: "npx"
90
+ args: ["-y", "@supermodeltools/mcp-server", "{workdir}"]
91
+ env:
92
+ SUPERMODEL_API_KEY: "${SUPERMODEL_API_KEY}"
93
+ ```
94
+
95
+ This allows the agent to call `explore_codebase()` without specifying a directory parameter, automatically using the configured default workdir. You can still override it by explicitly passing a `directory` parameter in individual tool calls.
96
+
69
97
  ## Usage
70
98
 
71
99
  ### Cursor
@@ -185,6 +213,10 @@ Debug logs go to stderr:
185
213
  - Insufficient disk space: Free up space in your system's temp directory
186
214
  - Directory does not exist: Verify the path is correct and absolute
187
215
 
216
+ ## Benchmarking
217
+
218
+ Benchmark this MCP server using [mcpbr](https://github.com/caspianmoon/mcpbr-benchmark-caching) with the provided [`mcpbr-config.yaml`](./mcpbr-config.yaml) configuration.
219
+
188
220
  ## Links
189
221
 
190
222
  - [API Documentation](https://docs.supermodeltools.com)
package/dist/index.js CHANGED
@@ -37,7 +37,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  const server_1 = require("./server");
38
38
  const logger = __importStar(require("./utils/logger"));
39
39
  async function main() {
40
- const server = new server_1.Server();
40
+ // Parse command-line arguments to get optional default workdir
41
+ // Usage: node dist/index.js [workdir]
42
+ const args = process.argv.slice(2);
43
+ const defaultWorkdir = args.length > 0 ? args[0] : undefined;
44
+ if (defaultWorkdir) {
45
+ logger.debug('Default workdir:', defaultWorkdir);
46
+ }
47
+ const server = new server_1.Server(defaultWorkdir);
41
48
  await server.start();
42
49
  }
43
50
  main().catch((error) => {
package/dist/server.js CHANGED
@@ -69,7 +69,9 @@ const fetchWithTimeout = (url, init) => {
69
69
  class Server {
70
70
  server;
71
71
  client;
72
- constructor() {
72
+ defaultWorkdir;
73
+ constructor(defaultWorkdir) {
74
+ this.defaultWorkdir = defaultWorkdir;
73
75
  this.server = new mcp_js_1.McpServer({
74
76
  name: 'supermodel_api',
75
77
  version: '0.0.1',
@@ -118,6 +120,9 @@ Example:
118
120
  logger.debug('Server configuration:');
119
121
  logger.debug('Base URL:', config.basePath);
120
122
  logger.debug('API Key set:', !!process.env.SUPERMODEL_API_KEY);
123
+ if (this.defaultWorkdir) {
124
+ logger.debug('Default workdir:', this.defaultWorkdir);
125
+ }
121
126
  this.client = {
122
127
  graphs: new sdk_1.DefaultApi(config),
123
128
  };
@@ -132,7 +137,7 @@ Example:
132
137
  this.server.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
133
138
  const { name, arguments: args } = request.params;
134
139
  if (name === create_supermodel_graph_1.default.tool.name) {
135
- return create_supermodel_graph_1.default.handler(this.client, args);
140
+ return create_supermodel_graph_1.default.handler(this.client, args, this.defaultWorkdir);
136
141
  }
137
142
  throw new Error(`Unknown tool: ${name}`);
138
143
  });
@@ -194,7 +194,7 @@ Query types available: graph_status, summary, get_node, search, list_nodes, func
194
194
  description: 'Raw jq filter for escape hatch queries or legacy mode (when query param not specified)',
195
195
  },
196
196
  },
197
- required: ['directory'],
197
+ required: [],
198
198
  },
199
199
  };
200
200
  /**
@@ -233,16 +233,28 @@ function generateIdempotencyKey(directory) {
233
233
  }
234
234
  return `${repoName}-${pathHash}:supermodel:${hash}${statusHash}`;
235
235
  }
236
- const handler = async (client, args) => {
236
+ const handler = async (client, args, defaultWorkdir) => {
237
237
  if (!args) {
238
- logger.error('No arguments provided to handler');
239
- return (0, types_1.asErrorResult)('Missing required arguments. Provide a "directory" parameter.');
238
+ args = {};
240
239
  }
241
- const { jq_filter, directory, query, targetId, searchText, namePattern, filePathPrefix, labels, depth, relationshipTypes, limit, includeRaw, } = args;
242
- // Validate directory
240
+ const { jq_filter, directory: providedDirectory, query, targetId, searchText, namePattern, filePathPrefix, labels, depth, relationshipTypes, limit, includeRaw, } = args;
241
+ // Use provided directory or fall back to default workdir
242
+ const directory = providedDirectory || defaultWorkdir;
243
+ // Validate directory - check if explicitly invalid first
244
+ if (providedDirectory !== undefined && typeof providedDirectory !== 'string') {
245
+ logger.error('Invalid directory parameter:', providedDirectory);
246
+ return (0, types_1.asErrorResult)('Invalid "directory" parameter. Provide a valid directory path as a string.');
247
+ }
248
+ // Check if we have any directory at all
243
249
  if (!directory || typeof directory !== 'string') {
244
250
  logger.error('Invalid directory parameter:', directory);
245
- return (0, types_1.asErrorResult)('Invalid "directory" parameter. Provide a valid directory path as a string.');
251
+ return (0, types_1.asErrorResult)('No "directory" parameter provided and no default workdir configured. Please provide a directory path or start the server with a workdir argument.');
252
+ }
253
+ if (providedDirectory) {
254
+ logger.debug('Using provided directory:', directory);
255
+ }
256
+ else {
257
+ logger.debug('Using default workdir:', directory);
246
258
  }
247
259
  // Generate idempotency key for API request
248
260
  const idempotencyKey = generateIdempotencyKey(directory);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supermodeltools/mcp-server",
3
- "version": "0.4.12",
3
+ "version": "0.5.1",
4
4
  "description": "MCP server for Supermodel API - code graph generation for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",