Windows Command Line MCP Server

Windows Command Line MCP Server

site icon
2025.04.04 0
TypeScriptWindows命令行交互AI模型集成安全系统操作开发效率
Windows Command Line MCP Server 是一个安全的模型上下文协议(MCP)服务器,旨在为AI模型提供与Windows命令行功能的安全高效交互。它通过严格的命令白名单和输入验证,确保系统操作的安全性,同时支持开发工具和系统信息检索。
View on GitHub

Overview

基本能力

产品定位

Windows Command Line MCP Server 是一个安全桥梁,连接AI模型与Windows系统操作,提供受控的命令执行、项目创建和系统信息检索功能。

核心功能

  • 增强安全性:包括命令白名单、严格的输入验证、防止破坏性系统操作和可配置的安全级别。
  • 开发工具支持:支持创建React、Node.js和Python项目,提供安全的开发环境交互。
  • 系统交互能力:执行Windows CLI命令、运行PowerShell脚本、检索系统和网络信息、管理进程和服务。

适用场景

  • AI模型需要安全地执行Windows命令行操作。
  • 开发者在安全环境中创建和管理项目。
  • 需要检索系统信息或管理Windows服务和进程的场景。

工具列表

  1. execute_command: 运行Windows CLI命令
  2. execute_powershell: 执行PowerShell脚本
  3. create_project: 安全创建新开发项目
  4. list_running_processes: 检索活动系统进程
  5. get_system_info: 收集系统配置详情
  6. get_network_info: 检索网络适配器信息
  7. get_scheduled_tasks: 列出和查询系统任务
  8. get_service_info: 管理和查询Windows服务
  9. list_allowed_commands: 列出服务器可执行的所有命令

常见问题解答

  • 安全性:默认只允许安全命令,如系统信息检索和开发工具交互,危险命令如磁盘格式化和用户管理被阻止。
  • 配置:可以通过指定允许的命令或使用配置标志来自定义服务器行为。

使用教程

使用依赖

  • Node.js 16或更高版本
  • npm或yarn
  • Windows操作系统

安装教程

  1. 通过Smithery安装:
npx -y @smithery/cli install @alxspiker/Windows-Command-Line-MCP-Server --client claude
  1. 手动安装:
git clone https://github.com/alxspiker/Windows-Command-Line-MCP-Server.git
cd Windows-Command-Line-MCP-Server
npm install
npm run build

调试方式

  1. 默认模式(使用预定义的安全命令):
node dist/index.js
  1. 指定允许的命令:
node dist/index.js dir echo npm git
  1. 扩展模式(谨慎使用):
node dist/index.js --allow-all

与Claude for Desktop集成

  1. 构建服务器。
  2. 添加到claude_desktop_config.json
{
  "mcpServers": {
    "windows-cmd": {
      "command": "node",
      "args": ["/path/to/dist/index.js"]
    }
  }
}
  1. 重启Claude for Desktop。
  2. 通过Claude执行Windows系统操作。

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。