npm-run-mcp-server 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -158,8 +158,13 @@ async function main() {
158
158
  }
159
159
  // Register a tool per script
160
160
  for (const scriptName of scriptNames) {
161
- server.tool(scriptName, {
162
- description: `Run package script '${scriptName}' via ${pm} in ${projectDir}`,
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
+ server.tool(toolName, {
167
+ description,
163
168
  inputSchema: {
164
169
  type: 'object',
165
170
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-run-mcp-server",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "An MCP server that exposes package.json scripts as tools for agents.",
5
5
  "bin": {
6
6
  "npm-run-mcp-server": "dist/index.js"