npm-mcp
MCP server for npm package management — publish, install, audit, search, security & dependency health
README
npm-mcp
MCP server that lets AI assistants manage npm packages. Publish, version, search, audit, install, and more -- all through Claude Code or any MCP client.
When to Use
| Task | Tool |
|---|---|
| "Publish this package to npm" | publish |
| "Check for outdated dependencies" | outdated |
| "Run a security audit on my packages" | audit |
| "Search npm for authentication libraries" | search |
| "Bump the version and publish" | version then publish |
| "Check who owns this npm package" | owner |
| "View download stats for my package" | view |
For AI agents: See
llms.txtfor a machine-readable summary. Copytemplates/CLAUDE.mdortemplates/AGENTS.mdinto your project to teach your agent about this MCP.
Why
You're in Claude Code building a library. You finish the code, and now you need to publish it. Instead of switching to a terminal:
You: publish this package to npm with public access
Claude: [calls publish tool] Published @yourorg/lib@1.0.0 successfully
That's it. No context switching.
Setup
1. Install
git clone https://github.com/mikusnuz/npm-mcp.git
cd npm-mcp
npm install
npm run build
2. Get npm token
Go to npmjs.com > Account > Access Tokens > Generate New Token (Automation type recommended).
3. Add to Claude Code
Edit ~/.claude/settings.json:
{
"mcpServers": {
"npm-mcp": {
"command": "node",
"args": ["/path/to/npm-mcp/dist/index.js"],
"env": {
"NPM_TOKEN": "npm_xxxxxxxxxxxx"
}
}
}
}
Or if you've already run npm login locally, skip NPM_TOKEN -- it uses your ~/.npmrc automatically.
Tools
Publishing & Versioning
| Tool | Description |
|---|---|
publish |
Publish a package to npm registry |
version |
Bump package version (patch/minor/major/pre*) |
unpublish |
Remove a package version |
deprecate |
Deprecate a version (or undeprecate with empty message) |
pack |
Preview what would be published |
Package Info
| Tool | Description |
|---|---|
view |
View package info from registry |
search |
Search npm registry |
bugs |
Get bug tracker URL for a package |
repo |
Get repository URL for a package |
docs |
Get documentation URL for a package |
diff |
Show diff between package versions |
Dependency Management
| Tool | Description |
|---|---|
install |
Install packages |
uninstall |
Remove packages |
update |
Update packages to latest semver-compatible version |
outdated |
Check for outdated packages |
ls |
List installed packages |
explain |
Explain why a package is installed |
dedupe |
Reduce duplication in dependency tree |
prune |
Remove extraneous packages |
fund |
Show funding info for dependencies |
query |
Query packages using CSS-like selectors |
Security & Diagnostics
| Tool | Description |
|---|---|
audit |
Run security audit (with optional auto-fix) |
sbom |
Generate Software Bill of Materials (CycloneDX/SPDX) |
doctor |
Check npm environment health |
ping |
Check registry connectivity |
Configuration & Auth
| Tool | Description |
|---|---|
whoami |
Check current authenticated user |
token |
Manage access tokens (list/revoke) |
access |
Set or view access level on packages |
owner |
Manage package owners (ls/add/rm) |
dist-tag |
Manage distribution tags (ls/add/rm) |
profile |
View or modify npm profile settings |
config |
View npm configuration (read-only) |
Project Setup
| Tool | Description |
|---|---|
init |
Initialize a new package.json |
pkg |
Manage package.json fields programmatically |
ci |
Clean install from lockfile (for CI) |
run-script |
Run scripts defined in package.json |
link |
Symlink a local package for development |
cache |
Manage the npm cache |
Examples
Publish a scoped package:
publish({ path: "/home/user/my-lib", access: "public" })
Bump version and publish:
version({ path: "/home/user/my-lib", bump: "patch" })
publish({ path: "/home/user/my-lib" })
Check what's inside before publishing:
pack({ path: "/home/user/my-lib", dryRun: true })
Search for existing packages:
search({ query: "react state management", limit: 5 })
View package details:
view({ package: "@yourorg/lib", field: "versions" })
Install packages:
install({ path: "/home/user/my-app", packages: ["express", "cors"], saveDev: false })
Check outdated dependencies:
outdated({ path: "/home/user/my-app" })
Compare versions:
diff({ specs: ["lodash@4.17.20", "lodash@4.17.21"] })
Generate SBOM:
sbom({ path: "/home/user/my-app", format: "spdx", production: true })
Query dependencies:
query({ path: "/home/user/my-app", selector: ":root > .prod" })
Auth
| Method | How |
|---|---|
| NPM_TOKEN (recommended) | Set NPM_TOKEN env var in MCP config. Get token from npmjs.com > Access Tokens |
| npm login | Run npm login in terminal first. Token saved in ~/.npmrc is used automatically |
For 2FA-enabled accounts, pass otp parameter to publish/unpublish/deprecate/owner/access/token tools.
Environment Variables
| Variable | Default | Description |
|---|---|---|
NPM_TOKEN |
-- | npm authentication token |
NPM_PATH |
npm |
Path to npm binary (if not in PATH) |
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。