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 🙏

© 2026 – Pkg Stats / Ryan Hefner

lazy-mcp

v1.5.1

Published

A proxy tool that converts normal MCP servers to use lazy-loading pattern with three/four meta-tools (Experiment, Unstable)

Readme

Lazy MCP Proxy

Pipeline Status

A proxy tool that converts normal MCP servers to use a lazy-loading pattern, dramatically reducing initial context usage by 90%+ and enabling support for hundreds of commands.

Table of Contents

Features

  • Single-Server Mode: Wrap one MCP server with 3 meta-tools (legacy mode)
  • Multi-Server Mode: Aggregate multiple MCP servers with on-demand discovery (NEW!)
  • Lazy Loading: Only discover tools when needed, not upfront
  • Batch Discovery: Discover multiple servers in one call
  • 90%+ Context Reduction: From ~16K to ~1.5K tokens initially
  • Background Health Monitoring: Probes all servers on startup and periodically; list_servers shows accurate health from the first call
  • Hot Config Reload: Send SIGHUP to reload config without restarting — add, remove, or update servers on the fly

Modes

Single-Server Mode (Legacy)

Wraps one MCP server and exposes three meta-tools:

  • list_commands - Returns command names and brief descriptions
  • describe_commands - Accepts command_names: Array[String], returns full schemas
  • invoke_command - Executes commands with command_name: String, parameters: Object

Multi-Server Mode (NEW!)

Aggregates multiple MCP servers and exposes four meta-tools:

  • list_servers - Lists all configured MCP servers with health status
  • list_commands - Discovers tools from specific server(s), supports batch discovery
  • describe_commands - Gets detailed schemas from a server
  • invoke_command - Executes commands from a specific server

Installation

Recommended: Use with npx to always get the latest version:

npx lazy-mcp@latest <server-command-or-url>

Or install globally (locks to specific version):

npm install -g lazy-mcp

Usage

Multi-Server Mode (Recommended)

Create a configuration file at ~/.config/lazy-mcp/servers.json:

{
  "mode": "multi-server",
  "servers": [
    {
      "name": "chrome-devtools",
      "description": "Chrome DevTools automation",
      "type": "local",
      "command": ["npx", "-y", "chrome-devtools-mcp@latest"]
    },
    {
      "name": "gitlab",
      "description": "GitLab API integration",
      "type": "local",
      "command": [
        "npx",
        "mcp-remote@latest",
        "https://gitlab.com/api/v4/mcp",
        "--static-oauth-client-metadata",
        "{\"scope\": \"mcp\"}"
      ]
    },
    {
      "name": "my-remote-server",
      "description": "Custom remote MCP server",
      "type": "remote",
      "url": "https://api.example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${API_TOKEN}"
      }
    }
  ],
  "healthMonitor": {
    "enabled": true,
    "interval": 30000,
    "timeout": 10000
  }
}

Then run:

# Using npx (recommended - always latest version)
npx lazy-mcp@latest --config ~/.config/lazy-mcp/servers.json

# Or via environment variable
LAZY_MCP_CONFIG=~/.config/lazy-mcp/servers.json npx lazy-mcp@latest

# Or if installed globally
lazy-mcp --config ~/.config/lazy-mcp/servers.json

Single-Server Mode (Legacy)

Local MCP Servers

# Run a Python MCP server
npx lazy-mcp@latest python my_server.py

# Run a Node.js server with arguments
npx lazy-mcp@latest node server.js --port 8080

# Run complex commands (use quotes)
npx lazy-mcp@latest "uvicorn server:app --host 0.0.0.0 --port 3000"

Remote MCP Servers

# Connect to a remote HTTP MCP server
npx lazy-mcp@latest http://localhost:3000/mcp

# With authentication headers
npx lazy-mcp@latest https://api.example.com/mcp --header "Authorization=Bearer token123"

# Multiple headers
npx lazy-mcp@latest https://api.example.com/mcp --header "X-API-Key=abc123" --header "User-Agent=my-app/1.0"

Claude Desktop / OpenCode Integration

Multi-Server Mode (Recommended)

Replace multiple MCP server entries with one aggregated proxy:

Before (5 separate MCP servers):

{
  "mcp": {
    "chrome-devtools": { "command": ["npx", "lazy-mcp@latest", "npx", "-y", "chrome-devtools-mcp@latest"] },
    "gitlab": { "command": ["npx", "lazy-mcp@latest", "npx", "mcp-remote@latest", "https://..."] },
    "grepai": { "command": ["npx", "lazy-mcp@latest", "grepai", "mcp-serve"] },
    "context7": { "command": ["npx", "-y", "@upstash/context7-mcp"] },
    "perplexity": { "command": ["npx", "-y", "@perplexity-ai/mcp-server"] }
  }
}

After (Consolidated into 1 multi-server proxy):

{
  "mcp": {
    "lazy-mcp": {
      "type": "local",
      "command": ["npx", "lazy-mcp@latest", "--config", "~/.config/lazy-mcp/servers.json"],
      "enabled": true
    }
  }
}

Where ~/.config/lazy-mcp/servers.json contains all 5 servers:

{
  "mode": "multi-server",
  "servers": [
    { "name": "chrome-devtools", "description": "Chrome DevTools automation", "type": "local", "command": ["npx", "-y", "chrome-devtools-mcp@latest"] },
    { "name": "gitlab", "description": "GitLab API integration", "type": "local", "command": ["npx", "mcp-remote@latest", "https://..."] },
    { "name": "grepai", "description": "Search codebase", "type": "local", "command": ["grepai", "mcp-serve"] },
    { "name": "context7", "description": "Library documentation", "type": "local", "command": ["npx", "-y", "@upstash/context7-mcp"] },
    { "name": "perplexity", "description": "Web search", "type": "local", "command": ["npx", "-y", "@perplexity-ai/mcp-server"] }
  ]
}

Result: ~90% context reduction (from ~16K to ~1.5K tokens initially)

Single-Server Mode (Legacy)

{
  "mcp": {
    "gitlab": {
      "command": ["npx", "lazy-mcp@latest", "npx", "mcp-remote", "https://gitlab.com/api/v4/mcp"]
    }
  }
}

Example

# Original local server with many tools
python my_server.py
# Exposes: tool1, tool2, tool3, ..., tool100 (uses 100x context tokens)

# Through lazy proxy - local
npx lazy-mcp@latest python my_server.py  
# Exposes: list_commands, describe_commands, invoke_command (uses 3x context tokens)

# Original remote server
curl http://localhost:3000/mcp -d '{"method":"tools/list"}'
# Returns: tool1, tool2, tool3, ..., tool100 (uses 100x context when loaded)

# Through lazy proxy - remote  
npx lazy-mcp@latest http://localhost:3000/mcp
# Exposes: list_commands, describe_commands, invoke_command (uses 3x context tokens)

Development

npm install
npm run build
npm run dev -- http://localhost:3000/mcp

Publishing New Versions

For Maintainers

  1. Update version number:

    npm version patch  # for bug fixes
    npm version minor  # for new features
    npm version major  # for breaking changes
  2. Build and test:

    npm run build
    npm test  # if tests exist
  3. Commit changes:

    git add .
    git commit -m "Release v1.x.x"
    git push
  4. Login to npm (first time only):

    npm login
  5. Publish to npm:

    npm publish
  6. Create git tag:

    git tag v1.x.x
    git push --tags

Configuration Reference

Server Configuration Fields

| Field | Type | Required | Description | |-------|------|----------|-------------| | name | string | ✅ | Unique server identifier | | description | string | ✅ | Human-readable description | | type | "local" | "remote" | ✅ | Server connection type | | command | string[] | string | For local | Command to execute (array format recommended) | | args | string[] | Optional | Arguments (only if command is string) | | url | string | For remote | HTTP/HTTPS URL | | headers | object | Optional | HTTP headers for remote servers | | env | object | Optional | Environment variables (supports ${VAR} expansion) | | enabled | boolean | Optional | Enable/disable server (default: true) | | examples | object[] | Optional | Usage examples shown in list_servers output | | tags | string[] | Optional | Capability tags for filtering (e.g. "api", "browser") |

Command Format

Recommended (OpenCode-compatible):

{
  "command": ["npx", "-y", "my-mcp-server", "--port", "3000"]
}

Legacy (still supported):

{
  "command": "npx",
  "args": ["-y", "my-mcp-server", "--port", "3000"]
}

Environment Variables

Use ${VAR_NAME} to reference environment variables:

{
  "env": {
    "API_KEY": "${MY_API_KEY}",
    "DEBUG": "true"
  },
  "headers": {
    "Authorization": "Bearer ${AUTH_TOKEN}"
  }
}

Health Monitoring

lazy-mcp includes a background health monitor that probes all servers on startup and periodically. This means list_servers returns accurate healthy and error fields from the very first call, without needing to trigger discovery manually.

Successful probes also populate the discovery cache, so the first list_commands call for a healthy server returns instantly from cache.

Top-level configuration (in servers.json):

| Field | Type | Default | Description | |-------|------|---------|-------------| | healthMonitor.enabled | boolean | true | Enable/disable background health monitoring | | healthMonitor.interval | number | 30000 | Interval between health checks (ms) | | healthMonitor.timeout | number | 10000 | Timeout per server probe (ms) |

To disable:

{
  "mode": "multi-server",
  "servers": [...],
  "healthMonitor": { "enabled": false }
}

Config Reload (SIGHUP)

In multi-server mode, you can reload the configuration without restarting the process by sending a SIGHUP signal:

kill -HUP $(pgrep -f lazy-mcp)

This will:

  • Re-read and validate the config file
  • Add newly configured servers (lazy connection on first use)
  • Remove servers no longer in config (closes connections)
  • Reconnect servers whose config changed (updated URL, env, etc.)
  • Preserve unchanged servers (keeps existing connections and caches)
  • Restart the health monitor and probe all servers

If the new config is invalid, the reload is rejected and the current config continues running. All reload activity is logged to stderr.

Note: SIGHUP is not available on Windows. Single-server mode does not support config reload (no config file).

Benefits

  • 90%+ context reduction - From ~16K to ~1.5K tokens initially
  • Progressive tool discovery - Only load schemas when needed
  • Multi-server aggregation - Manage multiple MCP servers in one config
  • Batch discovery - Discover multiple servers efficiently
  • Scales to hundreds of commands without context bloat
  • Flexible configuration - Enable/disable servers on demand
  • Environment variable support - Secure credential management
  • Both local and remote - Support for subprocess and HTTP servers
  • Health monitoring - Background probes detect broken servers before you hit them

Documentation