appendix-b

appendix B  Node.js setup for local MCP servers

 

Many Model Context Protocol (MCP) servers are distributed as Node.js packages on the public npm registry. The most convenient way to run one of these servers locally is with npx, a small command-line tool that ships with Node.js. Given a package name, npx downloads the package if it is not already cached, resolves its executable entry point, and runs it, all in a single command. That makes it possible to point an MCP client such as Claude Desktop, an IDE plugin, or a custom agent at a fresh MCP server without writing any installation scripts of your own.

Before you can take advantage of any of this, you need a working Node.js installation on your machine. This appendix walks through that setup end to end. It is organized into four sections that follow the natural setup order: installing Node.js, verifying that node and npx are on your path, running an MCP server with npx, and, finally, troubleshooting the most common problems and keeping your installation healthy over time.

B.1 Installing Node.js

Node.js is the JavaScript runtime that npx depends on, and it bundles both npm (the package manager) and npx in a single installer. For the MCP servers covered in this book, install the current long-term support (LTS) release of Node 20 or later. The following subsections show the recommended installation path for each major operating system.

B.1.1 Installing Node.js on Windows

On Windows, the simplest path is the official installer:

B.1.2 Installing Node.js on macOS

B.1.3 Installing Node.js on Linux or WSL

B.2 Verifying your Node and npx installation

B.2.1 Checking the installed versions

B.2.2 How npx finds and caches packages

B.3 Running an MCP server with npx

B.3.1 Anatomy of the npx command

B.3.2 Running the filesystem MCP server

B.3.3 Wiring the server into an MCP client

B.4 Troubleshooting and keeping Node healthy

B.4.1 Common issues

B.4.2 Clearing the npx cache

B.4.3 Updating Node