
npm-run-mcp-server
Exposes your project's package.json scripts as MCP tools, allowing AI assistants to discover and execute npm/yarn/pnpm/bun scripts directly. Automatically detects your package manager and enables running scripts with optional arguments through natural language commands.
README
npm-run-mcp-server
<div align="center">
A Model Context Protocol (MCP) server that exposes your project's package.json
scripts as tools for AI agents.
</div>
Transform any npm project into an AI-accessible toolkit with zero configuration. Instead of agents guessing commands, they can automatically discover and execute your build, test, deploy, and custom workflows through a standardized MCP interface.
Why Use This?
- Predictable interface - Agents get a consistent way to interact with any project's scripts
- Zero configuration - Works with any project that has npm scripts
- Universal package manager support - npm, pnpm, yarn, and bun
- Deterministic execution - Scripts run in the correct directory with proper package manager
- Ready integrations - Works with GitHub Copilot Chat, Claude, Cursor
Table of Contents
Install
npm i -D npm-run-mcp-server
# or globally
npm i -g npm-run-mcp-server
# ad-hoc
npx npm-run-mcp-server
Usage
Add this server to your MCP host configuration. It uses stdio and dynamically exposes each script from the closest package.json
(walking up from process.cwd()
).
The tool names match your script names. Each tool accepts an optional args
string that is appended after --
when running the script. The server detects your package manager (npm, pnpm, yarn, bun).
Configuration
Install in GitHub Copilot Chat (VS Code)
Option A — per-workspace via .vscode/mcp.json
:
{
"servers": {
"npm-scripts": {
"command": "npx",
"args": ["-y", "npm-run-mcp-server"]
}
}
}
Option B — user settings (settings.json
):
{
"mcp.servers": {
"npm-scripts": {
"command": "npx",
"args": ["-y", "npm-run-mcp-server"]
}
}
}
Then open Copilot Chat, switch to Agent mode, and start the npm-scripts
server from the tools panel.
Install in Claude Code (VS Code extension)
Add to VS Code user/workspace settings (settings.json
):
{
"claude.mcpServers": {
"npm-scripts": {
"command": "npx",
"args": ["-y", "npm-run-mcp-server"]
}
}
}
Restart the extension and confirm the server/tools appear.
Install in Claude Code (terminal / standalone)
Add this server to Claude's global config file (paths vary by OS). Create the file if it doesn't exist.
- Windows:
%APPDATA%/Claude/claude_desktop_config.json
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
Using npx:
{
"mcpServers": {
"npm-scripts": {
"command": "npx",
"args": ["-y", "npm-run-mcp-server"]
}
}
}
Using a local build (no global install):
{
"mcpServers": {
"npm-scripts": {
"command": "node",
"args": ["/absolute/path/to/npm-run-mcp-server/dist/index.js"]
}
}
}
Optional: include environment variables
{
"mcpServers": {
"npm-scripts": {
"command": "npx",
"args": ["-y", "npm-run-mcp-server"],
"env": {
"NODE_ENV": "production"
}
}
}
}
Restart Claude after editing the config so it picks up the new server.
Install in Cursor
- Open Settings → MCP Servers → Add MCP Server
- Type: NPX Package
- Command:
npx
- Arguments:
-y npm-run-mcp-server
- Save and start the server from the tools list
Install from source (for testing in another project)
Clone, build, and link globally:
git clone https://github.com/your-org-or-user/npm-run-mcp-server.git
cd npm-run-mcp-server
npm install
npm run build
npm link
In your other project, either reference the global binary or the built file directly:
- Using the linked binary:
{
"servers": {
"npm-scripts": {
"command": "npm-run-mcp-server"
}
}
}
- Using an explicit Node command (no global link needed):
{
"servers": {
"npm-scripts": {
"command": "node",
"args": ["/absolute/path/to/npm-run-mcp-server/dist/index.js"]
}
}
}
Optional CLI flags you can pass in args
:
--cwd /path/to/project
to choose which project to readpackage.json
from--pm npm|pnpm|yarn|bun
to override package manager detection
Testing with MCP Inspector
Test the server locally before integrating with AI agents:
# Start MCP Inspector
npx @modelcontextprotocol/inspector
# In the Inspector UI:
# 1. Transport Type: STDIO
# 2. Command: npx
# 3. Arguments: npm-run-mcp-server --cwd /path/to/your/project --verbose
# 4. Click "Connect"
You should see your package.json scripts listed as available tools. Try running one - it executes the script and returns the output.
CLI Options
Available command-line flags:
--cwd <path>
- Specify working directory (defaults to current directory)--pm <manager>
- Override package manager detection (npm|pnpm|yarn|bun)--verbose
- Enable detailed logging to stderr--list-scripts
- List available scripts and exit
Contributing
We welcome contributions! Here's how you can help:
🐛 Reporting Issues
- Use the issue tracker to report bugs
- Include your Node.js version, package manager, and operating system
- Provide a minimal reproduction case when possible
🚀 Submitting Changes
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and add tests if applicable
- Test your changes:
npm run build && npm run test
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Submit a pull request
🛠️ Development Setup
git clone https://github.com/fstubner/npm-run-mcp-server.git
cd npm-run-mcp-server
npm install
npm run build
npm run test
📋 Guidelines
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Keep commits focused and descriptive
License
MIT
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。