Skip to main content
Glama
fstubner

npm-run-mcp-server

by fstubner

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 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:

{
  "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:

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

Related MCP server: mcp-makefile-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:

{
  "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

Field

Type

Description

include

string[]

Whitelist of script names to expose. If omitted, all scripts are exposed.

exclude

string[]

Blacklist of script names to hide.

scripts

object

Detailed 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.

# 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 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

Available Tools

5 tools
buildB

Run npm script "build": node scripts/build.cjs

ParametersJSON Schema
NameRequiredDescriptionDefault
_No
argsNoOptional arguments appended after -- to the script

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavioral traits. It only repeats the command, omitting details like side effects (e.g., file modifications), failure modes, or idempotency. The minimal information ('node scripts/build.cjs') fails to convey the tool's impact beyond execution.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that directly states the tool's action and underlying command. It has no wasted words and is front-loaded with the key information. Every part earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity and lack of output schema, the description should still cover prerequisites, consequences (e.g., builds project), and error handling. It only states the command, leaving the agent uninformed about the tool's full role in the build process.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 50% (only 'args' has a description). The tool description does not explain the '_' parameter (array of strings appended to the script) or elaborate on 'args' usage. It adds no meaning beyond the existing schema description, failing to compensate for the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the action ('Run npm script') and the target resource ('build'), specifying the exact command 'node scripts/build.cjs'. It clearly distinguishes from sibling tools (prepublishonly, start, test, test_integration) by referencing the specific npm script name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus siblings, nor any prerequisites, alternatives, or when not to use it. The description is purely functional without contextual usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

prepublishonlyC

Run npm script "prepublishOnly": npm run build

ParametersJSON Schema
NameRequiredDescriptionDefault
_No
argsNoOptional arguments appended after -- to the script

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It only states it runs the script, but does not disclose potential side effects, permission requirements, or error behavior. For a script runner, more detail on process and outcomes is needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that directly states the action. It is appropriately sized and front-loaded with the key information. No unnecessary text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is very minimal. It does not explain the npm lifecycle context (prepublishOnly runs before publish) or how it differs from a plain build. With no output schema and sibling tools, it should provide more context for agent decision-making.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 50% (args has description, _ does not). The tool description does not add any parameter-specific meaning beyond what is already in the schema for 'args'. No additional clarity on parameters is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool runs the npm script 'prepublishOnly' which executes 'npm run build'. It identifies the specific script, but lacks distinction from the sibling 'build' tool, which might run build directly. Still, it is specific enough for basic understanding.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives like 'build' or 'test'. It does not mention that it is typically executed before publishing or that it is part of the npm lifecycle. The description only states what it does, not when to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

startB

Run npm script "start": node ./dist/index.js

ParametersJSON Schema
NameRequiredDescriptionDefault
_No
argsNoOptional arguments appended after -- to the script

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Does not disclose side effects, permissions, or potential destructive actions. Annotations absent, so description should cover behavior but only states the command.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Very concise, single sentence. Could be improved with structure but is efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Missing details about return value, error handling, or execution context. For a simple script runner, it's borderline adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is low (50%), and description does not explain the '_' parameter. Only provides minimal info for 'args'. Fails to compensate for missing schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool runs the npm start script, specifying the exact command. Distinguishes from siblings by naming the specific script.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like build or test. No context provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

testB

Run npm script "test": node dist/index.js --list-scripts && node scripts/integration-test.mjs && echo 'MCP server test completed successfully'

ParametersJSON Schema
NameRequiredDescriptionDefault
_No
argsNoOptional arguments appended after -- to the script

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It does reveal the exact commands run and the expected success message, but does not disclose any side effects (e.g., whether tests modify data or make network requests).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that efficiently conveys the command to run. It is concise but could be more structured by separating the explanation of the tool from the literal command.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with no output schema and two parameters. The description covers the basic behavior (running the npm test script) but omits any explanation of what the test does or what the expected output is beyond the success message.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 50%. The description adds meaning for 'args' by stating it is appended after '--', but the '_' parameter has no description in either the schema or the description. The description partially compensates for the missing schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool runs the npm 'test' script and provides the exact command executed. However, it does not distinguish this from the sibling tool 'test_integration', which likely has overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus the siblings 'build', 'start', or 'test_integration'. The description lacks any context about appropriate use cases or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

test_integrationC

Run npm script "test:integration": node scripts/integration-test.mjs

ParametersJSON Schema
NameRequiredDescriptionDefault
_No
argsNoOptional arguments appended after -- to the script

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It only says 'Run npm script', but does not disclose any behavioral traits such as side effects, prerequisites, or failure modes. This is insufficient for an agent to understand the tool's impact.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that effectively conveys the core action. It is front-loaded and free of extraneous information, though slightly more detail could be added without harming conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and the simple parameters, the description is minimal. It fails to explain expected outputs or results of running the script, leaving the agent with incomplete context for a test tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 50%; the 'args' parameter has a description, but the '_' parameter lacks one. The tool description adds no additional meaning beyond the schema, and it does not compensate for the missing schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool runs the npm script 'test:integration' and specifies the command. However, it does not differentiate from the sibling 'test' tool, although the tool name implies a specific integration test.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus siblings like 'test' or 'build'. The description only states what it does, leaving the agent without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.3/5.0
Disambiguation5/5

Each tool corresponds to a distinct npm script (build, prepublishOnly, start, test, test:integration) with no overlap in purpose or description.

Naming Consistency3/5

Tool names are mostly lowercase but mix single words (build, start, test) and compound names with varying conventions (prepublishonly as one word, test_integration with underscore). A more consistent pattern like 'prepublish_only' would improve clarity.

Tool Count5/5

5 tools is ideal for a focused server designed to run specific npm scripts. Each tool serves a clear purpose without unnecessary clutter.

Completeness4/5

The server covers the typical lifecycle scripts (build, start, test) and includes integration testing. It may lack common scripts like lint or format, but is sufficient for the stated domain of running predefined npm scripts.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    Enables AI assistants to manage development workflows by running build commands, executing tests, analyzing package.json files, installing dependencies, and performing code linting. Supports multiple package managers (npm, yarn, pnpm) and provides detailed error reporting for development operations.
    5
  • A
    license
    Not graded
    quality
    A
    maintenance
    Provides MCP servers that wrap common developer tools (git, npm, docker, etc.) returning structured JSON output, enabling AI agents to reliably interact with these tools without parsing fragile terminal text.
    7
    138
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fstubner/npm-run-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server