npm-mcp
A read-only MCP server for the public npm registry that enables AI clients to search for npm packages and retrieve focused package metadata, versions, and latest dist-tags without exposing install or publish capabilities.
README
npm-mcp
npm-mcp is a small, read-only Model Context Protocol server for the public npm registry. It lets MCP-compatible AI clients discover npm packages and inspect focused package metadata without exposing install, publish, login, shell, filesystem, or arbitrary-fetch capabilities.
Start with Docker
See the Docker quick start to launch the server and MCP Inspector from a fresh checkout. The essential command is:
docker compose --profile inspector up --build -d
To test model-driven MCP tool use without running a model locally, use LibreChat with OpenRouter's free-model router:
docker compose -f compose.yaml -f compose.openrouter.yaml --profile openrouter up --build -d
Then open http://127.0.0.1:3080. An OpenRouter API key is required even for free models. See OPENROUTER_QUICKSTART.md for setup and usage. The local Ollama profile remains available as an optional fully local alternative.
Tools
| Tool | Use it when | Input |
|---|---|---|
npm_search_packages |
The exact package name is unknown or alternatives are wanted | query, optional limit (default 10, max 50) |
npm_get_package |
The exact package name is known and metadata or dependencies are needed | packageName |
npm_get_latest_version |
Only the current latest dist-tag is needed |
packageName |
npm_get_versions |
Published versions and all dist-tags are needed | packageName |
All tools return JSON as text for broad client compatibility and expose the same value as MCP structured content. Package responses are deliberately filtered rather than returning the registry's full metadata document.
Requirements and installation
- Node.js 20 or newer (for native
fetchandAbortSignal.timeout) - npm
git clone <repository-url>
cd npm-mcp
npm install
Run locally
npm start
The process waits for MCP messages on stdin and writes protocol responses to stdout. Do not type interactively into it; an MCP client should launch it. Development watch mode is available with npm run dev.
Deployment
For local clients, use the stdio entry point. For Docker and cloud deployment, use the stateless Streamable HTTP entry point at /mcp; it requires a bearer token by default and exposes /healthz for health probes. See the Docker and cloud deployment guide for Docker Compose and deployment instructions for Google Cloud Run, Azure Container Apps, AWS App Runner/ECS Fargate, and Kubernetes.
The Compose file also includes the official MCP Inspector as an optional client. Run docker compose --profile inspector up --build -d, then open http://127.0.0.1:6274. See Run an MCP client in Docker for token setup and CLI usage.
Test
npm test
Tests use Node's built-in test runner and mocked fetch responses, so they do not require the live npm registry.
To inspect the server interactively with MCP Inspector:
npx @modelcontextprotocol/inspector node src/index.js
Open the URL printed by Inspector, connect, select Tools, choose a tool, enter its arguments, and run it.
MCP client configuration
Use an absolute path so the client can start the server from any working directory:
{
"mcpServers": {
"npm": {
"command": "node",
"args": ["/absolute/path/to/npm-mcp/src/index.js"]
}
}
}
The exact outer configuration key can vary by MCP client, but the command and arguments are the same.
Example calls
{"name":"npm_search_packages","arguments":{"query":"postgres orm","limit":10}}
{"name":"npm_get_package","arguments":{"packageName":"@nestjs/core"}}
{"name":"npm_get_latest_version","arguments":{"packageName":"react"}}
{"name":"npm_get_versions","arguments":{"packageName":"axios"}}
Architecture
src/index.jsowns stdio startup only.src/http.jsandsrc/http-server.jsprovide the authenticated Streamable HTTP entry point used by containers.src/server.jscreates the MCP server and registers the four tools.src/tools/contains schemas, focused response shaping, and handlers.src/services/npm-registry.jsis the only module that communicates with npm. It validates package names, constrains URLs to the official registry endpoints, applies a timeout, and normalizes network/HTTP/response errors.
Scoped names are encoded as a single registry path segment. The server is stateless and performs no writes.
Future improvements
Possible later additions include download statistics, dependency analysis, package security information, caching, and OAuth-based remote authentication.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。