Skip to main content
Glama
Windows Command Line MCP Server

Windows Command Line MCP Server

Windows 命令行 MCP 服务器

安全的模型上下文协议 (MCP) 服务器,使 AI 模型能够安全高效地与 Windows 命令行功能交互。

版本许可证:MIT 铁匠徽章

概述

Windows 命令行 MCP 服务器在 AI 模型和 Windows 系统操作之间搭建了一座强大而安全的桥梁。它允许在受控的环境下执行命令、创建项目和检索系统信息,同时保持严格的安全协议。

Related MCP server: Windows CLI MCP Server

主要特点

🔒 增强的安全性

  • 全面的命令允许列表

  • 严格的输入验证

  • 防止破坏性系统操作

  • 可配置的安全级别

🛠 开发工具支持

  • 为 React、Node.js 和 Python 创建项目

  • 安全开发环境交互

  • 扩展对开发工作流程的命令支持

🖥 系统交互能力

  • 执行 Windows CLI 命令

  • 运行 PowerShell 脚本

  • 检索系统和网络信息

  • 管理流程和服务

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Windows 命令行 MCP 服务器:

npx -y @smithery/cli install @alxspiker/Windows-Command-Line-MCP-Server --client claude

先决条件

  • Node.js 16 或更高版本

  • npm 或 yarn

  • Windows操作系统

设置

git clone https://github.com/alxspiker/Windows-Command-Line-MCP-Server.git
cd Windows-Command-Line-MCP-Server
npm install
npm run build

用法

命令行选项

  • 默认模式:使用预定义的安全命令

  • --allow-all :以扩展模式运行(需采取额外预防措施)

  • 可以将自定义命令列表指定为参数

项目创建

使用内置项目创建工具安全地创建新项目:

  • 支持的项目类型:React、Node.js、Python

  • 在沙盒~/AIProjects目录中创建的项目

可用工具

  1. 执行命令:运行 Windows CLI 命令

  2. 执行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 :列出服务器可以执行的所有命令

与 Claude for Desktop 一起使用

要将此服务器与 Claude for Desktop 一起使用:

  1. 使用上面的设置说明构建服务器

  2. 将其添加到您的claude_desktop_config.json中:

{
  "mcpServers": {
    "windows-cmd": {
      "command": "node",
      "args": ["/path/to/dist/index.js"]
    }
  }
}

将/path/to/dist/index.js替换为dist目录中构建的index.js文件的绝对路径。

  1. 重启 Claude 桌面版

  2. 您现在可以通过要求 Claude 执行 Windows 系统操作来使用这些工具

安全注意事项

允许的命令

默认情况下,只允许安全命令:

  • 系统信息检索

  • 网络配置

  • 流程管理

  • 开发工具交互

阻止的操作

危险命令总是被阻止,包括:

  • 磁盘格式化

  • 用户管理

  • 系统关闭

  • 关键注册表修改

配置

通过指定允许的命令或使用配置标志来定制服务器的行为。

例子

# Run with default safe commands
node dist/index.js

# Run with specific allowed commands
node dist/index.js dir echo npm git

# Run in extended mode (use with caution)
node dist/index.js --allow-all

贡献

  1. 分叉存储库

  2. 创建你的功能分支( git checkout -b feature/amazing-feature )

  3. 提交您的更改( git commit -m 'Add some amazing feature' )

  4. 推送到分支( git push origin feature/amazing-feature )

  5. 打开拉取请求

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

致谢

  • 受到模型上下文协议规范的启发

  • 开发时充分考虑了安全性和灵活性

版本历史记录

  • 0.3.0 :实现了 README 中提到的所有工具(系统信息、网络信息、进程管理、服务信息)

  • 0.2.0 :添加项目创建,扩展开发工具

  • 0.1.0 :具有基本命令执行功能的初始版本

支持

如有问题、疑问或建议,请在 GitHub 上打开问题。

Available Tools

8 tools
execute_commandB

Execute a Windows command and return its output. Only commands in the allowed list can be executed. This tool should be used for running simple commands like 'dir', 'echo', etc.

Inputs: command (required), workingDir, timeout.

execute_powershellB

Execute a PowerShell script and return its output. This allows for more complex operations and script execution. PowerShell must be in the allowed commands list.

Inputs: script (required), workingDir, timeout.

get_network_infoB

Retrieve network configuration information including IP addresses, adapters, and DNS settings. Can be filtered to a specific interface.

Inputs: networkInterface.

get_scheduled_tasksB

Retrieve information about scheduled tasks on the system. Can query all tasks or get detailed status of a specific task.

Inputs: action, taskName.

get_service_infoB

Retrieve information about Windows services. Can query all services or get detailed status of a specific service.

Inputs: action, serviceName.

get_system_infoB

Retrieve system information including OS, hardware, and user details. Can provide basic or full details.

Inputs: detail.

list_allowed_commandsA

List all commands that are allowed to be executed by this server. This helps understand what operations are permitted.

Inputs: no named parameters.

list_running_processesA

List all running processes on the system. Can be filtered by providing an optional filter string that will match against process names.

Inputs: filter.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: execute_command for basic commands, execute_powershell for scripts, get_network_info for networking, get_scheduled_tasks for tasks, get_service_info for services, get_system_info for system details, list_allowed_commands for permissions, and list_running_processes for processes. The descriptions clearly differentiate them, preventing misselection.

    Naming Consistency4/5

    The naming is mostly consistent with a verb_noun pattern (e.g., execute_command, get_network_info, list_allowed_commands), but there is a minor deviation with 'list_running_processes' using 'running' as an adjective instead of a simple noun like 'processes'. This slight inconsistency does not significantly hinder readability.

    Tool Count5/5

    With 8 tools, the count is well-scoped for a Windows command line server, covering essential operations like command execution, system queries, and permissions. Each tool earns its place without feeling excessive or insufficient for the domain.

    Completeness4/5

    The tool set provides good coverage for querying system state (e.g., network, services, tasks) and executing commands, but there are minor gaps such as no tools for managing or modifying these elements (e.g., starting/stopping services, creating tasks). Agents can work around this by using execute_powershell for such operations.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that provides programmatic access to the Windows terminal, enabling AI models to interact with the Windows command line through standardized tools for writing commands, reading output, and sending control signals.
      3
      MIT
    • A
      license
      B
      quality
      F
      maintenance
      A Model Context Protocol server that provides secure command-line access to Windows systems, allowing MCP clients like Claude Desktop to safely execute commands in PowerShell, CMD, and Git Bash shells with configurable security controls.
      9
      374 npm
      266
      MIT