
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.
概览
一个本地 MCP 服务器,把项目的 package.json 脚本变成工具,让助手执行构建、测试、代码检查和运行等任务。
- 可以做什么
- 自动检测项目的 package.json,并把其中的脚本暴露为工具,工具名由脚本名转换而来(例如 test:unit 变为 test_unit)。在工具说明中显示实际执行的命令,让助手知道运行的是什么。使用检测到的包管理器(npm、pnpm、yarn 或 bun)在项目根目录执行所选脚本。可通过配置文件限制暴露的脚本,并为单个脚本设置自定义名称、说明和带类型的参数。
- 适用场景
- 适合希望助手直接运行现有构建、测试、代码检查或启动脚本的 JavaScript 或 TypeScript 项目。适用于本地开发场景,让助手触发项目任务而无需手动复制命令。
- 运行要求
- 作为本地 stdio 进程运行,通常通过 npx 启动,因此需要 Node.js 和 npm。工作区中必须有 package.json,或用 --cwd 参数指定工作目录。未声明需要账号、API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Npm Run Mcp Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
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:
Cursor
- Go to Settings > Features > MCP Servers.
- Click + Add New MCP Server.
- Enter the details:
- Type:
command - Name:
npm-scripts - Command:
npx - Args:
-y npm-run-mcp-server
- Type:
VS Code (GitHub Copilot)
Add this to your workspace .vscode/settings.json:
🛠️ 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:
Configuration Options
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., renametest:unittorun_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
- Auto-Detection: When the server starts, it looks for a
package.jsonin your current workspace. It supports standard formatting as well asnpm,pnpm,yarn, andbunconventions. - Tool Creation: It converts your scripts into MCP Tools.
- Scripts like
test:unitbecome tools liketest_unit. - The tool description includes the actual command (e.g.,
vitest run) so the AI knows what it's running.
- Scripts like
- 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.
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.
- Fork the repo.
- Create your feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add some amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
License
MIT © Felix Stubner
来源:README.md,提交 8268fac
工具
0版本历史
1- v0.2.13最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分