npm-run-mcp-server 0.2.0 → 0.2.2
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/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -158,8 +158,16 @@ async function main() {
|
|
|
158
158
|
}
|
|
159
159
|
// Register a tool per script
|
|
160
160
|
for (const scriptName of scriptNames) {
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
// Sanitize tool name - MCP tools can only contain [a-z0-9_-]
|
|
162
|
+
const toolName = scriptName.toLowerCase().replace(/[^a-z0-9_-]/g, '_');
|
|
163
|
+
// Create a more descriptive description
|
|
164
|
+
const scriptCommand = scripts[scriptName];
|
|
165
|
+
const description = `Run npm script ${scriptName} - ${scriptCommand}`;
|
|
166
|
+
if (verbose) {
|
|
167
|
+
console.error(`[mcp] registering tool: ${toolName} with description: ${description}`);
|
|
168
|
+
}
|
|
169
|
+
server.tool(toolName, {
|
|
170
|
+
description,
|
|
163
171
|
inputSchema: {
|
|
164
172
|
type: 'object',
|
|
165
173
|
properties: {
|