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

@im2nguyen/mcp

v1.0.0

Published

CLI-based MCP host

Readme

MCP CLI

A command-line interface for interacting with MCP (model context protocol) servers. MCP CLI allows you to manage and chat with different types of AI-powered servers, supporting both on-demand (stdio) and long-running (SSE) server processes.

MCP CLI supports two types of servers, each with different use cases:

  1. stdio Servers (On-demand)
  • Spawns a new process for each chat session
  • Automatically managed by the CLI
  • Perfect for stateless tools and simple integrations
  • No manual server management required
  1. SSE Servers (Long-running)
  • Runs as a persistent process
  • Must be started before chatting
  • Ideal for stateful applications or services that need to maintain connections
  • Requires manual server management

Installation

npm install -g @im2nguyen/mcp

Quick Start

  1. Create a configuration file (mcp-config.json):
{
  "mcpServers": {
    "calculator": {
      "command": "node",
      "args": ["path/to/calculator/server.js"],
      "type": "stdio"
    }
  }
}
  1. Import your configuration:
mcp config import mcp-config.json
  1. Start chatting:
mcp chat

That's it! The CLI will handle spawning the server process and managing the connection.

Common Workflows

Basic Workflow (stdio servers)

  1. Configure your server:
{
  "mcpServers": {
    "calculator": {
      "command": "node",
      "args": ["./calculator-server.js"],
      "type": "stdio"
    }
  }
}
  1. Import and start chatting:
mcp config import mcp-config.json
mcp chat

Advanced Workflow (SSE servers)

  1. Configure your server:
{
  "mcpServers": {
    "weather-api": {
      "command": "node",
      "args": ["./weather-server.js"],
      "type": "sse",
      "url": "http://localhost:3000"
    }
  }
}
  1. Import configuration:
mcp config import mcp-config.json
  1. Start the server:
mcp server start weather-api
  1. Begin chatting:
mcp chat -s weather-api
  1. When finished, stop the server:
mcp server stop weather-api

Non-Interactive Workflow (Piped Commands)

MCP CLI supports non-interactive mode where you can pipe commands directly to it, which is useful for scripting or one-time queries:

  1. Send a single query to a server:
echo "what is 20+20?" | mcp chat -s calculator
40
  1. Process multiple queries from a file:
cat queries.txt | mcp chat -s calculator
  1. Use in shell scripts or command chains:
# Example: Use in a shell script
result=$(echo "what is 20+20?" | mcp chat -s calculator)
echo "The result is: $result"

# Example: Chain with other commands
echo "what is 20+20?" | mcp chat -s calculator | grep -o "[0-9]*"

When using piped input:

  • No welcome messages or headers are displayed
  • Only the direct response is output (no "Assistant:" prefix)
  • Perfect for automation and command-line integration

Command Reference

Server Management

# List all configured servers and their status
mcp server list

# View detailed server information
mcp server info <server-id>

# Start a server (required for SSE servers)
mcp server start <server-id>
mcp server start <server-id> --debug  # Run in debug mode

# Stop a server
mcp server stop <server-id>

# Stop all running servers
mcp server stop-all

Chat

# Start a chat session
mcp chat                           # Interactive server selection
mcp chat -s <server-id>           # Connect to specific server

# Use different LLM providers
mcp chat -p anthropic             # Use Anthropic (default)
mcp chat -p openai                # Use OpenAI

# Specify models
mcp chat -m claude-3-5-sonnet     # Use specific model

# Non-interactive usage (piped input)
echo "query" | mcp chat -s <server-id>

Chat Options:

  • -s, --server <id>: Specify server ID
  • -p, --provider <provider>: LLM provider (anthropic or openai)
  • -m, --model <model>: Model name (defaults: claude-3-5-sonnet-20241022 for Anthropic, gpt-4o for OpenAI)

Configuration Management

# Import server configurations
mcp config import <file>

# Export current configurations
mcp config export <file>

# View current configuration
mcp config show

# Manage log directory
mcp config set-logs-dir <path>    # Set custom logs directory
mcp config get-logs-dir           # Show current logs directory

Logging and Debugging

MCP CLI provides comprehensive logging capabilities:

  • Default log location: ~/mcp/logs
  • Server logs: ~/mcp/logs/server-{id}.log
  • Custom log directory: mcp config set-logs-dir <path>

Best Practices

  1. Server Type Selection:

    • Use stdio servers for simple, stateless tools
    • Use SSE servers for stateful applications or when persistence is needed
  2. Process Management:

    • Let the CLI manage stdio server processes
    • Manually manage SSE server lifecycles
    • Use mcp server stop-all before shutting down
  3. Logging:

    • Check server logs for troubleshooting
    • Enable debug logging for detailed information
    • Configure custom log directory for better organization

License

MIT