Token导航 LogoToken导航TokenDH.com
Npm Run MCP Server logo
开发工具stdio官方级别未说明来源级核验

Npm Run MCP Server

MCP Server

npm-run-mcp-server

npm-run-mcp-server是一个Model Context Protocol (MCP)服务器,自动将项目的npm脚本桥接到AI助手,支持自动检测package.json、多包管理器兼容和安全配置。

工具数

0

提示词数

0

GitHub Stars

3

资源数

0
TypeScriptCursor开发工具CursorVS Code

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

fstubner

提供方

fstubner

最后核验

2026/5/17 20:19

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx npm-run-mcp-server --list-scripts

详细介绍

npm运行mcp服务器

*赋予您的AI Agent使用现有的package.json脚本构建、测试和部署项目的能力。*

![Test](https://github.com/fstubner/npm-run-mcp-server/actions/workflows/test.yml) ![Build & Publish](https://github.com/fstubner/npm-run-mcp-server/actions/workflows/build-and-publish.yml) ](https://www.npmjs.com/package/npm-run-mcp-server) ![MCP Registry](https://registry.modelcontextprotocol.io) ![Install in Cursor](https://cursor.com/en/install-mcp?name=npm-scripts&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIm5wbS1ydW4tbWNwLXNlcnZlciJdfQ==) ![Install in VS Code](https://vscode.dev/redirect/mcp/install?name=npm-scripts&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22npm-run-mcp-server%22%5D%7D) ![License: MIT](https://opensource.org/licenses/MIT)

npm运行mcp服务器 是一个 模型上下文协议(MCP) 自动桥接项目的服务器 npm 将脚本发送到您的AI助手。

  • 🔍 自动检测 你的项目 package.json (没有硬编码路径)。
  • 📦 适用于所有情况:npm、pnpm、yarn和bun。
  • 🔒 安全且可配置:将特定脚本列入白名单,以防止意外执行。
  • 零配置:开箱即用,但可根据详细配置进行扩展。

______________________________________________________________________

⚡ 快速开始

在几秒钟内将代理连接到脚本。无需全局安装,只需让 npx 处理它。

克劳德桌面版

将此添加到您的 claude_desktop_config.json:

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

光标

![Install in Cursor](https://cursor.com/en/install-mcp?name=npm-scripts&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIm5wbS1ydW4tbWNwLXNlcnZlciJdfQ==)

  1. 首选 设置 > 特性 > MCP服务器.
  2. 点击 +添加新的MCP服务器.
  3. 输入详细信息:

- 类型: command - 名字: npm-scripts - 命令: npx - 参数: -y npm-run-mcp-server

VS代码(GitHub副本)

![Install in VS Code](https://vscode.dev/redirect/mcp/install?name=npm-scripts&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22npm-run-mcp-server%22%5D%7D)

将此添加到您的工作区 .vscode/settings.json:

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

______________________________________________________________________

🛠️ 配置

npm-run-mcp-server 立即工作,您可能不希望您的AI访问 *每* 脚本(如 ejectpublish).您可以通过创建 npm-run-mcp.config.json 项目根目录中的文件。

配置示例

创建 npm-run-mcp.config.json 在您的旁边 package.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" }
        }
      }
    }
  }
}

配置选项

字段类型描述
includestring[]要公开的脚本名称白名单。如果省略, *全部* 脚本已公开。
excludestring[]要隐藏的脚本名称黑名单。
scriptsobject特定脚本的详细配置。

每个脚本选项

里面 scripts 对象,您可以将脚本名称映射到:

  • toolName:覆盖AI看到的工具名称(例如重命名 test:unitrun_unit_tests).
  • description:提供自定义描述,以帮助AI了解何时使用此脚本。
  • inputSchema:定义AI可以传递的严格类型参数(映射到CLI标志)。

______________________________________________________________________

📖 运作原理

  1. 自动检测:服务器启动时,它会查找 package.json 在您当前的工作空间中。它支持标准格式以及 npm, pnpm, yarn,以及 bun 习俗。
  2. 工具创建:它将您的脚本转换为MCP工具。

- 脚本如 test:unit 成为像这样的工具 test_unit. - 工具描述包括实际命令(例如。, vitest run)所以AI知道它在运行什么。

  1. 执行:当AI调用工具时,服务器使用检测到的包管理器执行项目根目录中的脚本。

______________________________________________________________________

🔧 高级/CLI用法

您可以手动运行服务器进行调试,或者需要传递特定标志。

# Run directly
npx npm-run-mcp-server --list-scripts

# Run in a specific directory
npx npm-run-mcp-server --cwd /path/to/project

# Force a specific package manager
npx npm-run-mcp-server --pm pnpm

CLI标志

  • `--cwd

`:手动设置工作目录。

  • --pm :强制使用特定的包管理器。
  • `--config

`:特定JSON配置文件的路径。

  • --verbose:将调试日志打印到stderr。

______________________________________________________________________

🤝 贡献

欢迎投稿!请随时提交拉取请求。

  1. 分叉回购。
  2. 创建功能分支(git checkout -b feature/amazing-feature).
  3. 提交您的更改(git commit -m 'Add some amazing feature').
  4. 推到分支(git push origin feature/amazing-feature).
  5. 打开拉取请求。

许可证

MIT© 费利克斯·斯图布纳

目录标签

目录标签

TypeScriptCursor开发工具npm脚本自动化本地部署AI助手集成开发工具链多包管理器支持安全执行控制

支持客户端

CursorVS Code

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

npm-run-mcp-server

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP