Skip to content
Projects

About

A .NET-based Windows desktop automation MCP (Model Context Protocol) server that provides AI assistants with the ability to interact with the Windows desktop environment.

AI & Machine Learning

How these counts are measured

Measured star growth

in 24h
0
in 7 days
-2
in 15 days
-2
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.en.md

Original

Windows MCP.Net

English | 中文

A .NET-based Windows desktop automation MCP (Model Context Protocol) server that provides AI assistants with the ability to interact with the Windows desktop environment.

📋 Table of Contents

🚀 Quick Start

Prerequisites

  • Windows Operating System
  • .NET 10.0 Runtime or higher

Important Note: This project requires .NET 10 to run. Please ensure you have .NET 10 installed locally. If not installed, please visit the .NET 10 Download Page to download and install.

1. MCP Client Configuration

Add the following configuration to your MCP client:

Using Global Installed Tool (Recommended)

{
    "mcpServers": {
     "WindowsMCP.Net": {
      "type": "stdio",
      "command": "dnx",
      "args": ["WindowsMCP.Net@", "--yes"],
      "env": {}
    }
    }
}

Using Project Source Code Direct Run (Development Mode)

Method 1: Workspace Configuration

Create .vscode/mcp.json file in project root:

{
  "mcpServers": {
    "Windows-MCP.Net-Dev": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["run", "--project", "src/Windows-MCP.Net.csproj"],
      "cwd": "${workspaceFolder}",
      "env": {}
    }
  }
}

Method 2: User Configuration

Run MCP: Open User Configuration through VS Code command palette, add:

{
  "mcpServers": {
    "Windows-MCP.Net-Local": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["run", "--project", "src/Windows-MCP.Net.csproj"],
      "env": {}
    }
  }
}

Note: Using project source code method is convenient for development and debugging. Changes take effect without reinstallation. VS Code 1.102+ supports automatic discovery and management of MCP servers.

2. Installation and Running

Method 1: Global Installation (Recommended)

dotnet tool install --global WindowsMCP.Net

Method 2: Run from Source

# Clone repository
git clone https://github.com/AIDotNet/Windows-MCP.Net.git
cd Windows-MCP.Net

# Build project
dotnet build

# Run project
dotnet run --project src/Windows-MCP.Net.csproj

3. Getting Started

After configuration is complete, restart your MCP client to start using Windows desktop automation features!

🚀 Features

Core Functionality

  • Application Launch: Launch applications from the Start Menu by name
  • PowerShell Integration: Execute PowerShell commands and return results
  • Desktop State Capture: Capture current desktop state including active applications, UI elements, etc.
  • Clipboard Operations: Copy and paste text content
  • Mouse Operations: Click, drag, move mouse cursor
  • Keyboard Operations: Text input, key presses, keyboard shortcuts
  • Window Management: Resize windows, adjust positions, switch applications
  • Scroll Operations: Scroll at specified coordinates
  • Web Scraping: Fetch web content and convert to Markdown format
  • Browser Operations: Open specified URLs in default browser
  • Screenshot Functionality: Capture screen and save to temporary directory
  • File System Operations: Create, read, write, copy, move, delete files and directories
  • OCR Text Recognition: Extract text from screen or specified regions, find text locations
  • System Control: Adjust screen brightness, system volume, screen resolution and other system settings
  • Wait Control: Add delays between operations

Supported Tools

Desktop Operation Tools

Tool Name Description
LaunchTool Launch applications from the Start Menu
PowershellTool Execute PowerShell commands and return status codes
StateTool Capture desktop state information including applications and UI elements
ClipboardTool Clipboard copy and paste operations
ClickTool Mouse click operations (supports left, right, middle buttons, single, double, triple clicks)
TypeTool Input text at specified coordinates with clear and enter support
ResizeTool Resize window size and position
SwitchTool Switch to specified application window
ScrollTool Scroll at specified coordinates or current mouse position
DragTool Drag from source coordinates to target coordinates
MoveTool Move mouse cursor to specified coordinates
ShortcutTool Execute keyboard shortcut combinations
KeyTool Press individual keyboard keys
WaitTool Pause execution for specified seconds
ScrapeTool Scrape web content and convert to Markdown format
ScreenshotTool Capture screen and save to temporary directory, return image path
OpenBrowserTool Open specified URL in default browser

FileSystem Tools

Tool Name Description
ReadFileTool Read content from specified file
WriteFileTool Write content to file
CreateFileTool Create new file with specified content
CopyFileTool Copy file to specified location
MoveFileTool Move or rename file
DeleteFileTool Delete specified file
GetFileInfoTool Get file information (size, creation time, etc.)
ListDirectoryTool List files and subdirectories in directory
CreateDirectoryTool Create new directory
DeleteDirectoryTool Delete directory and its contents
SearchFilesTool Search for files in specified directory

OCR Image Recognition Tools

Tool Name Description
ExtractTextFromScreenTool Extract text from entire screen using OCR
ExtractTextFromRegionTool Extract text from specified screen region using OCR
FindTextOnScreenTool Find specified text on screen using OCR
GetTextCoordinatesTool Get coordinates of text on screen
ExtractTextFromFileTool Extract text from image files using OCR

UI Element Recognition Tools

Tool Name Description
FindElementByTextTool Find UI elements by text content
FindElementByClassNameTool Find UI elements by class name
FindElementByAutomationIdTool Find UI elements by automation ID
GetElementPropertiesTool Get properties of element at specified coordinates
WaitForElementTool Wait for specified element to appear on screen

SystemControl Tools

Tool Name Description
BrightnessTool Adjust screen brightness, supports increase/decrease and specific percentage
VolumeTool Adjust system volume, supports increase/decrease and specific percentage
ResolutionTool Set screen resolution (high, medium, low settings)

💡 Use Cases

🤖 AI Assistant Desktop Automation

  • Intelligent Customer Service Robot: AI assistants can automatically operate Windows applications to help users complete complex desktop tasks
  • Voice Assistant Integration: Combined with voice recognition, control desktop applications through voice commands
  • Intelligent Office Assistant: AI assistants automatically handle daily office tasks such as document organization, email sending, etc.

📊 Office Automation

  • Data Entry Automation: Automatically extract data from web pages or documents and enter it into Excel or other applications
  • Report Generation: Automatically collect system information, screenshots, and generate formatted report documents
  • Batch File Processing: Automatically organize, rename, and categorize large numbers of files and documents
  • Email Automation: Automatically send periodic reports and notification emails

🧪 Software Testing & Quality Assurance

  • UI Automation Testing: Simulate user operations to automatically test desktop application functionality
  • Regression Testing: Automatically execute repetitive test cases to ensure software quality
  • Performance Monitoring: Automatically collect application performance data and generate monitoring reports
  • Bug Reproduction: Automatically reproduce user-reported issues to assist developers in debugging

🎯 Business Process Automation

  • Customer Service: Automatically handle customer requests and update CRM systems
  • Order Processing: Automatically collect order information from multiple channels and enter it into systems
  • Inventory Management: Automatically update inventory data and generate restocking reminders
  • Financial Reconciliation: Automatically compare financial data from different systems and mark discrepancies

🔍 Data Collection & Analysis

  • Web Data Scraping: Automatically collect product prices, news, and other information from multiple websites
  • Competitive Analysis: Regularly collect competitor product information and pricing data
  • Market Research: Automatically collect and organize market data, generate analysis reports
  • Social Media Monitoring: Monitor brand mentions and automatically collect user feedback

🎮 Gaming & Entertainment

  • Game Assistance: Automatically execute repetitive game tasks (please follow game rules)
  • Streaming Assistant: Automatically manage streaming software, switch scenes, send messages
  • Media Management: Automatically organize music and video files, update media libraries

🏥 Healthcare & Medical

  • Medical Record Entry: Automatically convert paper medical records to electronic format
  • Medical Image Analysis: Combined with OCR technology, automatically extract key information from medical reports
  • Appointment Management: Automatically handle patient appointment requests and update hospital management systems

🏫 Education & Training

  • Online Examinations: Automatically grade multiple-choice questions and generate grade reports
  • Course Management: Automatically update course information and send notifications to students
  • Learning Progress Tracking: Automatically record student learning activities and generate progress reports

🏭 Manufacturing & Logistics

  • Production Data Collection: Automatically collect data from production equipment and update ERP systems
  • Quality Inspection: Combined with image recognition, automatically detect product quality
  • Logistics Tracking: Automatically update cargo status and send tracking information to customers

🔧 System Operations

  • Server Monitoring: Automatically check server status and generate monitoring reports
  • Log Analysis: Automatically analyze system logs and identify abnormal patterns
  • Backup Management: Automatically execute data backups and verify backup integrity
  • Software Deployment: Automate software installation and configuration processes

📸 Demo Screenshots

Text Input Demo

Automatic text input in Notepad using TypeTool:

Text Input Demo

Web Search Demo

Open and search web content using ScrapeTool:

Web Search Demo

📹 Demo Video

Complete desktop automation operation demo:

网页搜索演示

📸 Demo Screenshots

Text Input Demo

Automatic text input in Notepad using TypeTool:

Text Input Demo

Web Search Demo

Using ScrapeTool to open and search web content:

Web Search Demo

📹 Demo Video

Complete desktop automation operation demonstration:

Web Search Demo

🛠️ Tech Stack

  • .NET 10.0: Based on the latest .NET framework
  • Model Context Protocol: Uses MCP protocol for communication
  • Microsoft.Extensions.Hosting: Application hosting framework
  • Serilog: Structured logging
  • HtmlAgilityPack: HTML parsing and web scraping
  • ReverseMarkdown: HTML to Markdown conversion

🚧 Feature Extension Suggestions

Planned Features

Advanced UI Recognition & Interaction

  • Enhanced UI Element Recognition: Support for more UI frameworks (WPF, WinForms, UWP)
  • OCR Text Recognition Optimization: Multi-language support, improved recognition accuracy
  • Smart Wait Mechanism: Dynamic waiting for element loading completion

Enhanced File System Operations

  • Advanced File Search: Support for content search, regular expression matching
  • Batch File Operations: Support for batch copy, move, rename
  • File Monitoring: Real-time file system change monitoring

System Monitoring & Performance Analysis

  • System Resource Monitoring: CPU, memory, disk, network usage
  • Process Management: Process listing, performance monitoring, process control
  • Performance Analysis Reports: Generate detailed system performance reports

Multimedia Processing Capabilities

  • Audio Control: System volume control, audio device management
  • Image Processing: Image scaling, cropping, format conversion
  • Screen Recording: Support for screen recording and playback

Network & Communication Features

  • Network Diagnostics: Ping, port scanning, connectivity testing
  • HTTP Client: Support for RESTful API calls
  • WiFi Management: WiFi network scanning and connection management

Security & Permission Management

  • Permission Checking: User permission verification and management
  • Data Encryption: Encrypted storage of sensitive data
  • Operation Auditing: Complete operation logs and audit trails

Development Roadmap

Phase 1 (High Priority) - Core Feature Enhancement

  • ✅ UI Element Recognition Tools (Completed Windows API implementation)
  • 🔄 Enhanced File Management Tools
  • 📋 System Monitoring Tools
  • 🔒 Basic Security Tools

Phase 2 (Medium Priority) - Feature Expansion

  • 📋 OCR Text Recognition Optimization
  • 📋 Advanced File Search
  • 📋 Audio Control Tools
  • 📋 Network Diagnostic Tools
  • 📋 Excel Operation Support

Phase 3 (Low Priority) - Advanced Features

  • 📋 Image Processing Tools
  • 📋 Task Scheduling System
  • 📋 Database Operation Support
  • 📋 Macro Recording & Playback

🏗️ Project Structure

src/
├── Windows-MCP.Net/         # Main project
│   ├── .mcp/                # MCP server configuration
│   │   └── server.json      # Server configuration file
│   ├── Exceptions/          # Custom exception classes (to be extended)
│   ├── Interface/           # Service interface definitions
│   │   ├── IDesktopService.cs   # Desktop service interface
│   │   ├── IFileSystemService.cs # File system service interface
│   │   └── IOcrService.cs       # OCR service interface
│   ├── Models/              # Data models (to be extended)
│   ├── Prompts/             # Prompt templates (to be extended)
│   ├── Services/            # Core service implementations
│   │   ├── DesktopService.cs    # Desktop operation service
│   │   ├── FileSystemService.cs # File system service
│   │   └── OcrService.cs        # OCR service
│   ├── Tools/               # MCP tool implementations
│   │   ├── Desktop/             # Desktop operation tools
│   │   │   ├── ClickTool.cs         # Click tool
│   │   │   ├── ClipboardTool.cs     # Clipboard tool
│   │   │   ├── DragTool.cs          # Drag tool
│   │   │   ├── GetWindowInfoTool.cs # Window info tool
│   │   │   ├── KeyTool.cs           # Key tool
│   │   │   ├── LaunchTool.cs        # App launch tool
│   │   │   ├── MoveTool.cs          # Mouse move tool
│   │   │   ├── OpenBrowserTool.cs   # Browser open tool
│   │   │   ├── PowershellTool.cs    # PowerShell execution tool
│   │   │   ├── ResizeTool.cs        # Window resize tool
│   │   │   ├── ScrapeTool.cs        # Web scraping tool
│   │   │   ├── ScreenshotTool.cs    # Screenshot tool
│   │   │   ├── ScrollTool.cs        # Scroll tool
│   │   │   ├── ShortcutTool.cs      # Shortcut tool
│   │   │   ├── StateTool.cs         # Desktop state tool
│   │   │   ├── SwitchTool.cs        # App switch tool
│   │   │   ├── TypeTool.cs          # Text input tool
│   │   │   ├── UIElementTool.cs     # UI element operation tool
│   │   │   └── WaitTool.cs          # Wait tool
│   │   ├── FileSystem/          # File system tools
│   │   │   ├── CopyFileTool.cs      # File copy tool
│   │   │   ├── CreateDirectoryTool.cs # Directory creation tool
│   │   │   ├── CreateFileTool.cs    # File creation tool
│   │   │   ├── DeleteDirectoryTool.cs # Directory deletion tool
│   │   │   ├── DeleteFileTool.cs    # File deletion tool
│   │   │   ├── GetFileInfoTool.cs   # File info tool
│   │   │   ├── ListDirectoryTool.cs # Directory listing tool
│   │   │   ├── MoveFileTool.cs      # File move tool
│   │   │   ├── ReadFileTool.cs      # File read tool
│   │   │   ├── SearchFilesTool.cs   # File search tool
│   │   │   └── WriteFileTool.cs     # File write tool
│   │   └── OCR/                 # OCR recognition tools
│   │       ├── ExtractTextFromRegionTool.cs # Region text extraction tool
│   │       ├── ExtractTextFromScreenTool.cs # Screen text extraction tool
│   │       ├── FindTextOnScreenTool.cs      # Screen text search tool
│   │       └── GetTextCoordinatesTool.cs    # Text coordinate tool
│   ├── Program.cs           # Program entry point
│   └── Windows-MCP.Net.csproj   # Project file
└── Windows-MCP.Net.Test/    # Test project
    ├── DesktopToolsExtendedTest.cs  # Desktop tools extended test
    ├── FileSystemToolsExtendedTest.cs # File system tools extended test
    ├── OCRToolsExtendedTest.cs      # OCR tools extended test
    ├── ToolTest.cs                  # Tool basic test
    ├── UIElementToolTest.cs         # UI element tool test
    └── Windows-MCP.Net.Test.csproj  # Test project file

📦 Installation

Prerequisites

  • Windows Operating System
  • .NET 10.0 Runtime or higher

Important Note: This project requires .NET 10 to run. Please ensure you have .NET 10 installed locally. If not installed, please visit the .NET 10 Download Page to download and install.

Build from Source

# Clone repository
git clone https://github.com/AIDotNet/Windows-MCP.Net.git
cd Windows-MCP.Net/src

# Build project
dotnet build

# Run project
dotnet run

NuGet Package Installation

dotnet tool install --global WindowsMCP.Net

🚀 Usage

Run as MCP Server

# Direct run
dotnet run --project src/Windows-MCP.Net.csproj

# Or use installed tool
windows-mcp-net

MCP Client Configuration

Add the following configuration to your MCP client:

Using Global Installed Tool (Recommended)

{
    "mcpServers": {
     "WindowsMCP.Net": {
      "type": "stdio",
      "command": "dnx",
      "args": ["WindowsMCP.Net@", "--yes"],
      "env": {}
    }
    }
}

Using Project Source Code Direct Run (Development Mode)

Method 1: Workspace Configuration

Create .vscode/mcp.json file in project root:

{
  "mcpServers": {
    "WindowsMCP.Net-Dev": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["run", "--project", "src/Windows-MCP.Net.csproj"],
      "cwd": "${workspaceFolder}",
      "env": {}
    }
  }
}

Method 2: User Configuration

Run MCP: Open User Configuration through VS Code command palette, add:

{
  "mcpServers": {
    "WindowsMCP.Net-Local": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["run", "--project", "src/Windows-MCP.Net.csproj"],
      "env": {}
    }
  }
}

Note: Using project source code method is convenient for development and debugging. Changes take effect without reinstallation. VS Code 1.102+ supports automatic discovery and management of MCP servers.

🏗️ Project Structure

src/
├── Windows-MCP.Net/         # Main project
│   ├── .mcp/                # MCP server configuration
│   │   └── server.json      # Server configuration file
│   ├── Exceptions/          # Custom exception classes (to be extended)
│   ├── Interface/           # Service interface definitions
│   │   ├── IDesktopService.cs   # Desktop service interface
│   │   ├── IFileSystemService.cs # File system service interface
│   │   └── IOcrService.cs       # OCR service interface
│   ├── Models/              # Data models (to be extended)
│   ├── Prompts/             # Prompt templates (to be extended)
│   ├── Services/            # Core service implementations
│   │   ├── DesktopService.cs    # Desktop operation service
│   │   ├── FileSystemService.cs # File system service
│   │   └── OcrService.cs        # OCR service
│   ├── Tools/               # MCP tool implementations
│   │   ├── Desktop/             # Desktop operation tools
│   │   │   ├── ClickTool.cs         # Click tool
│   │   │   ├── ClipboardTool.cs     # Clipboard tool
│   │   │   ├── DragTool.cs          # Drag tool
│   │   │   ├── GetWindowInfoTool.cs # Window info tool
│   │   │   ├── KeyTool.cs           # Key press tool
│   │   │   ├── LaunchTool.cs        # Application launch tool
│   │   │   ├── MoveTool.cs          # Mouse move tool
│   │   │   ├── OpenBrowserTool.cs   # Browser open tool
│   │   │   ├── PowershellTool.cs    # PowerShell execution tool
│   │   │   ├── ResizeTool.cs        # Window resize tool
│   │   │   ├── ScrapeTool.cs        # Web scraping tool
│   │   │   ├── ScreenshotTool.cs    # Screenshot tool
│   │   │   ├── ScrollTool.cs        # Scroll tool
│   │   │   ├── ShortcutTool.cs      # Keyboard shortcut tool
│   │   │   ├── StateTool.cs         # Desktop state tool
│   │   │   ├── SwitchTool.cs        # Application switch tool
│   │   │   ├── TypeTool.cs          # Text input tool
│   │   │   ├── UIElementTool.cs     # UI element operation tool
│   │   │   └── WaitTool.cs          # Wait tool
│   │   ├── FileSystem/          # File system tools
│   │   │   ├── CopyFileTool.cs      # File copy tool
│   │   │   ├── CreateDirectoryTool.cs # Directory creation tool
│   │   │   ├── CreateFileTool.cs    # File creation tool
│   │   │   ├── DeleteDirectoryTool.cs # Directory deletion tool
│   │   │   ├── DeleteFileTool.cs    # File deletion tool
│   │   │   ├── GetFileInfoTool.cs   # File info tool
│   │   │   ├── ListDirectoryTool.cs # Directory listing tool
│   │   │   ├── MoveFileTool.cs      # File move tool
│   │   │   ├── ReadFileTool.cs      # File read tool
│   │   │   ├── SearchFilesTool.cs   # File search tool
│   │   │   └── WriteFileTool.cs     # File write tool
│   │   └── OCR/                 # OCR recognition tools
│   │       ├── ExtractTextFromRegionTool.cs # Region text extraction tool
│   │       ├── ExtractTextFromScreenTool.cs # Screen text extraction tool
│   │       ├── FindTextOnScreenTool.cs      # Screen text finding tool
│   │       └── GetTextCoordinatesTool.cs    # Text coordinates tool
│   ├── Program.cs           # Program entry point
│   └── Windows-MCP.Net.csproj   # Project file
└── Windows-MCP.Net.Test/    # Test project
    ├── DesktopToolsExtendedTest.cs  # Desktop tools extended tests
    ├── FileSystemToolsExtendedTest.cs # File system tools extended tests
    ├── OCRToolsExtendedTest.cs      # OCR tools extended tests
    ├── ToolTest.cs                  # Basic tool tests
    ├── UIElementToolTest.cs         # UI element tool tests
    └── Windows-MCP.Net.Test.csproj  # Test project file

🔧 Configuration

Logging Configuration

The project uses Serilog for logging, with log files saved in the logs/ directory:

  • Console output: Real-time log display
  • File output: Daily rolling, retain 31 days
  • Log level: Debug and above

Environment Variables

Variable Description Default
ASPNETCORE_ENVIRONMENT Runtime environment Production

📝 License

This project is open source under the MIT License. See the LICENSE file for details.

🔗 Related Links

🤝 Contributing Guide

We welcome community contributions! If you want to contribute to the project, please follow these steps:

Development Environment Setup

  1. Clone Repository

    git clone https://github.com/AIDotNet/Windows-MCP.Net.git
    cd Windows-MCP.Net
    
  2. Install Dependencies

    dotnet restore
    
  3. Run Tests

    dotnet test
    
  4. Build Project

    dotnet build
    

Contribution Process

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Create a Pull Request

Code Standards

  • Follow C# coding conventions
  • Add unit tests for new features
  • Update relevant documentation
  • Ensure all tests pass

Issue Reporting

When reporting issues, please provide:

  • Operating system version
  • .NET version
  • Detailed error information
  • Steps to reproduce

📞 Support

If you encounter issues or have suggestions, please:

  1. Check Issues
  2. Create a new Issue
  3. Participate in discussions
  4. Check Wiki for more help

Note: This tool requires appropriate Windows permissions to perform desktop automation operations. Please ensure use in a trusted environment.

Disclaimer: When using this tool for automation operations, please comply with relevant laws, regulations, and software usage agreements. Developers are not responsible for any consequences arising from misuse of the tool.

Explore related projects

Loading…