npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@railblocks/npx-server

v1.0.0

Published

## Creating MCP Servers

Readme

MCP (Model Context Protocol)

Creating MCP Servers

A Simple npx-based MCP Server

This project provides a simple MCP server that can be executed via npx. The server includes an "add" tool that performs addition of two numbers.

chmod +x npx-server.js

To inspect the server, run:

npx @modelcontextprotocol/inspector npx -y /path-to/npx-server/your-server-js-file.js

e.g.

npx @modelcontextprotocol/inspector npx -y /Users/flo/Builds/learning/npx-server.js

Usage

Running the Server

You can run this MCP server in several ways:

  1. Via npx (recommended):

    npx learning
  2. Direct execution:

    ./npx-server.js
  3. With Node.js:

    node npx-server.js

Available Tools

  • add: Adds two numbers together
    • Parameters: a (number), b (number)
    • Returns: The sum as a text string

Testing with MCP Inspector

The MCP Inspector provides a web interface to test your server:

npx @modelcontextprotocol/inspector npx -y learning

This will:

  1. Start the MCP Inspector
  2. Launch your server via npx
  3. Open a web interface where you can test the "add" tool

MCP Client Configuration

Using with Claude Desktop, Cursor, or Windsurf

To use this server in Claude Desktop, Cursor, or Windsurf, add the following configuration:

{
  "mcpServers": {
    "npx-server": {
      "command": "npx",
      "args": [
        "-y",
        "/Users/flo/Builds/learning/npx-server.js"
      ]
    }
  }
}

Note: Replace /Users/flo/Builds/learning/npx-server.js with the actual path to your npx-server.js file.

Configuration File Locations:

  • Claude Desktop (macOS): ~/Library/Application Support/Claude/claude_desktop_config.json
  • Claude Desktop (Windows): %APPDATA%\Claude\claude_desktop_config.json
  • Cursor: Add to your Cursor MCP settings
  • Windsurf: Add to your Windsurf MCP settings

Alternative: Using the published package

If you publish this package to npm, you can use a simpler configuration:

{
  "mcpServers": {
    "npx-server": {
      "command": "npx",
      "args": ["-y", "learning"]
    }
  }
}

Installation

npm install

Dependencies

  • @modelcontextprotocol/sdk: MCP SDK for creating servers
  • zod: Schema validation for tool parameters

Publish an MCP service to the NPM Registry

You'll also need to update the package name to start with your org, e.g. "@trelis/npx-server"

npm install
npm run build  # Ensures build script exists, even if no compilation is needed. You don't need this if it's a simple javascript MCP.
  1. Build and prepare your package:
  • For simple JavaScript projects, the build script might just be a placeholder
  • Add a minimal build script to package.json if missing:
"scripts": {
  "build": "echo \"No build step required\" && exit 0"
}
  1. Publish the package:
npm publish --access public  # Use --access public for open-source packages