NVM MCP Server
用于 Antigravity 的 NVM MCP 服务器
一个封装了 NVM (Node Version Manager) 的 MCP 服务器,让 Antigravity 智能体能够完全控制 Node.js 版本,而无需在 $PATH 中预先配置 Node 或 npm。
为什么需要它
Antigravity 智能体在非交互式子进程中运行,且不会加载你 shell 的 .zshrc / .bashrc。由于 NVM 仅在交互式 shell 中将 Node 添加到 $PATH,因此智能体无法找到 node 或 npm。此服务器在执行每个命令前直接加载 nvm.sh,从而彻底绕过了 $PATH 问题。
要求
Python 3.10+
NVM 安装在
~/.nvm(或在配置中设置NVM_DIR)pip install mcp(或pip install -r requirements.txt)
安装
# 1. Clone / copy this folder somewhere permanent
cp -r nvm-mcp-server ~/.nvm-mcp-server
# 2. Install the one dependency
pip install -r ~/.nvm-mcp-server/requirements.txt
# Or, if you prefer a venv:
python3 -m venv ~/.nvm-mcp-server/.venv
~/.nvm-mcp-server/.venv/bin/pip install mcpAntigravity 配置
打开(或创建)~/.gemini/antigravity/mcp_config.json 并添加:
{
"mcpServers": {
"nvm-manager": {
"command": "python3",
"args": ["/Users/YOUR_USERNAME/.nvm-mcp-server/nvm_server.py"],
"env": {
"NVM_DIR": "/Users/YOUR_USERNAME/.nvm"
}
}
}
}Venv 用户: 将
"python3"替换为 venv Python 的绝对路径, 例如"/Users/YOUR_USERNAME/.nvm-mcp-server/.venv/bin/python3"。
保存配置后重启 Antigravity。nvm-manager 服务器将出现在 MCP 服务器列表中。
可用工具
工具 | 功能 |
| 列出所有本地安装的 Node 版本 |
| 列出可安装的版本(接受过滤器: |
| 下载并安装一个版本( |
| 切换会话激活版本 — 对后续所有调用持久生效 |
| 显示当前会话中激活的版本 |
| 设置 NVM 别名,例如将 |
| 使用激活的(或指定的)版本运行 |
| 使用激活的(或指定的)版本运行 |
| 使用激活的(或指定的)版本运行 |
所有三个运行工具都接受一个可选的 version 字段(用于覆盖该次调用的会话激活版本)和一个可选的 cwd 字段。
智能体工作流示例
Agent: nvm_list → sees v20.11.0 and v22.3.0 installed
Agent: nvm_use "22" → session set to Node 22
Agent: npm_run "install" → runs npm install under Node 22
Agent: node_run "index.js" → runs the script under Node 22
# Need a version that isn't installed yet?
Agent: nvm_install "lts" → downloads latest LTS
Agent: nvm_use "lts" → switches to it
Agent: nvm_alias "default" "lts" → makes it the permanent default自定义 NVM 位置
如果 NVM 安装在 ~/.nvm 之外的位置,请在 mcp_config.json 的 env 块中设置 NVM_DIR:
"env": {
"NVM_DIR": "/opt/homebrew/opt/nvm"
}故障排除
症状 | 修复方法 |
| 验证 |
| 增加 |
未找到版本 | 运行 |
服务器未显示 | 检查 Antigravity → |
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/realjacoblinder/nvm-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server