Skip to main content
Glama
README.md
# PC Manager

**AI-powered PC management system with 80+ MCP tools for Cursor, Claude, and other AI agents.**

PC Manager bridges the gap between AI and your operating system. It provides a comprehensive REST API, a web dashboard, and an MCP (Model Context Protocol) server that gives AI agents full control over your Windows PC.

---

## Features

### System Monitoring
- Real-time CPU, memory, disk, and network monitoring
- Live charts with usage history
- System information and uptime tracking

### File Management
- Browse, create, rename, move, copy, delete files and folders
- Built-in file viewer and editor
- Drive listing with usage info

### Process & Service Control
- List, filter, and kill processes
- Start, stop, restart Windows services
- Process memory and CPU tracking

### Network
- Interface listing with IP addresses
- Active connection monitoring
- Traffic statistics
- Ping, DNS resolve, port scan, Wake-on-LAN

### Shell
- Execute PowerShell commands remotely via web UI or API
- Command history with arrow key navigation

### Power Management
- Lock, sleep, restart, shutdown with confirmation
- Power plan and battery status

### Programs & Environment
- List installed programs and startup items
- View and edit environment variables
- PATH analysis with existence checks

### Task Scheduler
- List and run scheduled tasks

### Registry
- Read and write Windows registry values

### Security & Admin
- API key authentication
- Danger level system (LOW / MEDIUM / HIGH / CRITICAL)
- Action logging and audit history
- Admin Bridge for elevated privilege execution

### Hardware & Sensors
- GPU info (NVIDIA)
- Disk health (SMART)
- USB devices, Bluetooth, printers
- Camera capture, microphone recording

### Screen & GUI Control
- Screenshot capture
- Mouse click and move
- Keyboard input
- Window management (list, focus)
- Clipboard read/write

### Docker & Package Management
- Docker container management
- Winget package search and install
- WiFi network listing and connection

### Email Integration
- IMAP/SMTP email access (Naver, Gmail, etc.)
- Read, search, send, delete emails
- Folder listing

### AI Agent
- Natural language to API translation
- OpenAI Function Calling compatible schema
- Chat interface in web dashboard

---

## Architecture

```
+------------------+     +------------------+     +------------------+
|   Web Dashboard  |     |    AI Agents     |     |   External Apps  |
|  (localhost:7777)|     | (Cursor/Claude)  |     |   (GPT/Gemini)   |
+--------+---------+     +--------+---------+     +--------+---------+
         |                         |                        |
         |    REST API (/api/*)    |     MCP Protocol       |
         +------------+------------+----------+-------------+
                      |                       |
              +-------v-------+       +-------v-------+
              |   Flask App   |       |  MCP Server   |
              |   (app.py)    |       |(mcp_server.py)|
              +-------+-------+       +-------+-------+
                      |                       |
              +-------v-----------------------v-------+
              |          Core Modules                  |
              |  system | files | processes | network  |
              |  shell | power | registry | docker    |
              |  screen | senses | email | admin      |
              +---------------------------------------+
              |          Windows OS (PowerShell)       |
              +---------------------------------------+
```

---

## Quick Start

### Prerequisites

- Windows 10/11
- Python 3.11+
- pip

### Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/pc-manager.git
cd pc-manager

# Install dependencies
pip install -r requirements.txt

# Run the web dashboard
python app.py
```

Open `http://localhost:7777` in your browser.

### MCP Server Setup (Cursor / Claude Desktop)

1. Add to your MCP configuration:

```json
{
  "mcpServers": {
    "pc-manager": {
      "command": "python",
      "args": ["path/to/pc-manager/mcp_server.py"]
    }
  }
}
```

2. Restart Cursor or Claude Desktop
3. You now have 80+ tools available to your AI agent

### Email Setup (Optional)

1. Copy the example config:
```bash
cp mail_config.example.json mail_config.json
```

2. Edit `mail_config.json` with your email credentials:
   - For Naver Mail: Enable IMAP in settings, generate an app password
   - For Gmail: Enable IMAP, use app-specific password

### Admin Bridge Setup (Optional)

For operations requiring elevated privileges:

```powershell
powershell -ExecutionPolicy Bypass -File admin_bridge/setup_admin_bridge.ps1
```

---

## API Documentation

Once the server is running, visit:

- **Swagger UI**: `http://localhost:7777/api/docs`
- **OpenAI Schema**: `http://localhost:7777/api/agent/openai-schema`

### API Endpoints Overview

| Category | Endpoint | Description |
|----------|----------|-------------|
| System | `/api/system/*` | System info, stats, uptime |
| Files | `/api/files/*` | File operations |
| Processes | `/api/processes/*` | Process management |
| Services | `/api/services/*` | Service control |
| Network | `/api/network/*` | Network monitoring |
| Disk | `/api/disk/*` | Disk analysis |
| Shell | `/api/shell/*` | Command execution |
| Power | `/api/power/*` | Power management |
| Programs | `/api/programs/*` | Installed programs |
| Environment | `/api/env/*` | Environment variables |
| Scheduler | `/api/scheduler/*` | Task scheduler |
| Registry | `/api/registry/*` | Registry operations |
| Docker | `/api/docker/*` | Container management |
| Screen | `/api/screen/*` | Screenshot, GUI control |
| Hardware | `/api/hardware/*` | GPU, USB, Bluetooth |
| Admin | `/api/admin/*` | Elevated execution |

---

## MCP Tools (80+)

When connected via MCP, AI agents can use tools including:

| Tool | Description |
|------|-------------|
| `get_system_info` | Get OS, CPU, memory details |
| `get_system_stats` | Real-time CPU/memory/disk usage |
| `list_files` | Browse directory contents |
| `read_file` / `write_file` | Read and write files |
| `search_files` | Search by filename |
| `list_processes` / `kill_process` | Process management |
| `list_services` / `control_service` | Service management |
| `execute_command` | Run PowerShell commands |
| `take_screenshot` | Capture screen |
| `mouse_click` / `keyboard_type` | GUI automation |
| `mail_list` / `mail_send` | Email operations |
| `docker_containers` | Docker management |
| `ping_host` / `port_scan` | Network diagnostics |
| `power_action` | Lock, sleep, restart, shutdown |
| ... and 60+ more | |

---

## Project Structure

```
pc-manager/
├── app.py                 # Flask entry point
├── config.py              # Configuration
├── mcp_server.py          # MCP server (80+ tools)
├── requirements.txt       # Python dependencies
├── api/                   # REST API modules
│   ├── system.py          # System info & stats
│   ├── files.py           # File management
│   ├── processes.py       # Process management
│   ├── services.py        # Service control
│   ├── network.py         # Network monitoring
│   ├── disk.py            # Disk analysis
│   ├── shell.py           # Shell execution
│   ├── power.py           # Power management
│   ├── agent.py           # AI agent bridge
│   └── ...                # 15+ more modules
├── core/                  # Core utilities
│   ├── security.py        # Authentication
│   ├── history.py         # Action logging
│   └── admin_bridge.py    # Elevated execution
├── admin_bridge/          # Admin elevation scripts
├── static/                # Frontend assets
│   ├── css/style.css
│   └── js/app.js
├── templates/
│   └── index.html         # Web dashboard
└── .cursor/
    └── mcp.json           # MCP configuration
```

---

## Security Notice

- The API runs on `localhost` only by default
- All operations are authenticated via API key
- Dangerous operations (kill process, shutdown, delete) require confirmation
- Action history is logged for auditing
- **Do not expose this server to the public internet without additional security measures**

---

## Tech Stack

- **Backend**: Python, Flask, Flask-RESTX, psutil
- **Frontend**: Vanilla JS, Chart.js, Lucide Icons, Inter Font
- **AI Integration**: MCP (Model Context Protocol), OpenAI Function Calling
- **System**: PowerShell, Windows API, pyautogui

---

## License

MIT License - see [LICENSE](LICENSE) for details.

---

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request