MCP隧道添加福利群:解决AI开发者的「MCP实战痛点」一个简单的MCP(Model Context Protocol)服务器,允许访问VM机器的命令行。启动时,它还会将主机隧道连接到网络,以便可以通过MCP进行访问。
npx mcp-cli
npm install -g mcp-cli mcp-cli
# Clone repository
git clone [repository-url]
cd mcp-cli
# Install dependencies
npm install

同时为后端和前端运行带有热重载功能的开发服务器:
npm run dev
构建生产环境下的前端和后端:
npm run build-all
# Start with automatic tunneling
npm start
# Start without automatic tunneling
npm start -- --no-tunnel

这将构建项目并启动服务器。默认情况下会自动创建一个隧道。使用 --no-tunnel 标志可以禁用自动隧道。
服务器将启动,并且输出将在stderr上显示(以避免干扰stdout上的MCP通信)。
使用以下工具通过MCP与服务器交互:
execute_command: 在VM上运行shell命令
{ "command": "your shell command" }start_tunnel: 创建web隧道以访问VM界面
{ "port": 8080, "subdomain": "optional-subdomain" }启动隧道后,您可以通过隧道提供的URL访问基于Web的终端界面。此界面允许您:
创建一个 .env 文件来配置服务器:
# Server configuration PORT=8080 # Localtunnel configuration LOCALTUNNEL_SUBDOMAIN=your-preferred-subdomain
此工具提供了直接访问您的VM命令行的功能。请考虑以下安全实践: