Npm Run Mcp Server

io.github.fstubner由 GitHub 账号 fstubner 发布v0.2.13更新于 Oct 24, 2026

An MCP server that exposes package.json scripts as tools for agents.

已验证STDIO仅桌面效率与工作流开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,把项目的 package.json 脚本变成工具,让助手执行构建、测试、代码检查和运行等任务。

可以做什么
自动检测项目的 package.json,并把其中的脚本暴露为工具,工具名由脚本名转换而来(例如 test:unit 变为 test_unit)。在工具说明中显示实际执行的命令,让助手知道运行的是什么。使用检测到的包管理器(npm、pnpm、yarn 或 bun)在项目根目录执行所选脚本。可通过配置文件限制暴露的脚本,并为单个脚本设置自定义名称、说明和带类型的参数。
适用场景
适合希望助手直接运行现有构建、测试、代码检查或启动脚本的 JavaScript 或 TypeScript 项目。适用于本地开发场景,让助手触发项目任务而无需手动复制命令。
运行要求
作为本地 stdio 进程运行,通常通过 npx 启动,因此需要 Node.js 和 npm。工作区中必须有 package.json,或用 --cwd 参数指定工作目录。未声明需要账号、API 密钥或环境变量。
安装前请注意
默认会暴露全部 package.json 脚本,包括 eject 或 publish 之类的脚本;应使用 include 或 exclude 配置加以限制。调用工具会在项目根目录执行脚本,可能修改文件、安装依赖或部署,使用前请先确认每个脚本的作用。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Npm Run Mcp Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

npm-run-mcp-server

Give your AI Agent the power to build, test, and deploy your project using your existing package.json scripts.

[Test] [Build & Publish] [NPM Version] [MCP Registry] [Install in Cursor] [Install in VS Code] [License: MIT]

[npm-run-mcp-server MCP server]

npm-run-mcp-server is a Model Context Protocol (MCP) server that automatically bridges your project's npm scripts to your AI assistant.

  • 🔍 Auto-detects your project's package.json (no hardcoded paths).
  • 📦 Works with everything: npm, pnpm, yarn, and bun.
  • 🔒 Safe & Configurable: Whitelist specific scripts to prevent accidental execution.
  • ⚡ Zero-config: Works out of the box, but scales with detailed config.

⚡ Quick Start

Connect your agent to your scripts in seconds. No global installation required—just let npx handle it.

Claude Desktop

Add this to your claude_desktop_config.json:

json
{  "mcpServers": {    "npm-scripts": {      "command": "npx",      "args": ["-y", "npm-run-mcp-server"]    }  }}

Cursor

[Install in Cursor]

  1. Go to Settings > Features > MCP Servers.
  2. Click + Add New MCP Server.
  3. Enter the details:
    • Type: command
    • Name: npm-scripts
    • Command: npx
    • Args: -y npm-run-mcp-server

VS Code (GitHub Copilot)

[Install in VS Code]

Add this to your workspace .vscode/settings.json:

json
{  "github.copilot.chat.mcpServers": {    "npm-scripts": {      "command": "npx",      "args": ["-y", "npm-run-mcp-server"]    }  }}

🛠️ Configuration

While npm-run-mcp-server works instantly, you might not want your AI to have access to every script (like eject or publish). You can control this by creating an npm-run-mcp.config.json file in your project root.

Example Config

Create npm-run-mcp.config.json next to your package.json:

json
{  "include": ["test", "lint", "build", "start"],  "scripts": {    "test": {      "description": "Run the test suite. Use --watch for interactive mode.",      "inputSchema": {        "properties": {          "watch": { "type": "boolean", "description": "Watch files for changes" }        }      }    }  }}

Configuration Options

FieldTypeDescription
includestring[]Whitelist of script names to expose. If omitted, all scripts are exposed.
excludestring[]Blacklist of script names to hide.
scriptsobjectDetailed configuration for specific scripts.
Per-Script Options

Inside the scripts object, you can map a script name to:

  • toolName: Override the tool name seen by the AI (e.g., rename test:unit to run_unit_tests).
  • description: Provide a custom description to help the AI understand when to use this script.
  • inputSchema: Define strictly typed arguments that the AI can pass (mapped to CLI flags).

📖 How It Works

  1. Auto-Detection: When the server starts, it looks for a package.json in your current workspace. It supports standard formatting as well as npm, pnpm, yarn, and bun conventions.
  2. Tool Creation: It converts your scripts into MCP Tools.
    • Scripts like test:unit become tools like test_unit.
    • The tool description includes the actual command (e.g., vitest run) so the AI knows what it's running.
  3. Execution: When the AI calls a tool, the server executes the script in your project's root directory using the detected package manager.

🔧 Advanced / CLI Usage

You can run the server manually for debugging or if you need to pass specific flags.

bash
# Run directlynpx npm-run-mcp-server --list-scripts
# Run in a specific directorynpx npm-run-mcp-server --cwd /path/to/project
# Force a specific package managernpx npm-run-mcp-server --pm pnpm

CLI Flags

  • --cwd <path>: Manually set the working directory.
  • --pm <npm|pnpm|yarn|bun>: Force a specific package manager.
  • --config <path>: Path to a specific JSON config file.
  • --verbose: Print debug logs to stderr.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repo.
  2. Create your feature branch (git checkout -b feature/amazing-feature).
  3. Commit your changes (git commit -m 'Add some amazing feature').
  4. Push to the branch (git push origin feature/amazing-feature).
  5. Open a Pull Request.

License

MIT © Felix Stubner

来源:README.md,提交 8268fac

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.13最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分