Skip to main content
Glama
Shreshtthh

Laptop Hardware MCP Server

by Shreshtthh
README.md
# Laptop Hardware MCP Server (Windows)

This project creates a local MCP server that gives GitHub Copilot access to hardware/system telemetry from your laptop (CPU, RAM, disk, battery, network, uptime).

## What this server provides

The MCP server in [server.py](server.py) exposes these tools:

- `get_live_system_stats`
- `get_cpu_info`
- `get_memory_info`
- `get_disk_info`
- `get_battery_info`
- `get_network_io`
- `get_system_overview`

VS Code MCP config is in [.vscode/mcp.json](.vscode/mcp.json).

## Why Python 3.10+ matters

The modern `mcp` Python package requires a newer Python runtime than 3.8.

If you get an error like:

- `No matching distribution found for mcp`

it usually means your active interpreter is too old.

## Check which Python versions are installed

### In PowerShell or CMD

```powershell
py -0p
```

You should see at least one version that is `3.10+` (for example 3.10, 3.11, 3.12, 3.13).

## If you do NOT have Python 3.10+

1. Install Python from python.org (Windows installer).
2. During install, enable:
   - Add Python to PATH
   - Install launcher for all users (recommended)
3. Re-open terminal and run:

```powershell
py -0p
```

## Create a virtual environment using Python 3.10+

Use one of these commands (replace version if needed).

### PowerShell / CMD

```powershell
py -3.13 -m venv .venv
```

### Git Bash

```bash
py -3.13 -m venv .venv
```

If `.venv` already exists and you want a clean reset:

```powershell
py -3.13 -m venv .venv --clear
```

## Activate the environment

### PowerShell

```powershell
.\.venv\Scripts\Activate.ps1
```

If script execution is blocked:

```powershell
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\Activate.ps1
```

### CMD

```bat
.venv\Scripts\activate.bat
```

### Git Bash

```bash
source .venv/Scripts/activate
```

Important: in Bash, use `/` slashes, not `\`.

## Install dependencies

From project root:

```bash
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
```

## Quick verification

```bash
python -c "import mcp, psutil; print('deps_ok')"
```

Expected output:

- `deps_ok`

## Run the server manually (optional test)

```bash
python server.py
```

Note: this is a stdio MCP server. If you stop it with Ctrl+C, you may see cancellation traces; that is normal for manual termination.

## Use it in VS Code Copilot Chat

1. Keep this file present: [.vscode/mcp.json](.vscode/mcp.json)
2. Reload VS Code:
   - Command Palette -> `Developer: Reload Window`
3. Open Copilot Chat and ask:
   - `Use laptop-hardware MCP server and call get_system_overview`
   - `Use laptop-hardware MCP server and call get_memory_info`
   - `Use laptop-hardware MCP server and call get_disk_info with path C:\\`

## Troubleshooting

### Error: `No matching distribution found for mcp`

Cause: old Python interpreter.

Fix:

```powershell
py -0p
py -3.13 -m venv .venv --clear
```

Then reactivate and reinstall dependencies.

### Error: `-r option requires 1 argument`

Cause: command ended at `pip install -r` without a filename.

Fix:

```bash
python -m pip install -r requirements.txt
```

### Git Bash activation command fails

Cause: using Windows backslashes.

Fix:

```bash
source .venv/Scripts/activate
```

### Copilot does not see MCP server

- Confirm [.vscode/mcp.json](.vscode/mcp.json) exists.
- Confirm dependencies are installed in `.venv`.
- Reload VS Code window.

## Project files

- [server.py](server.py): MCP tools implementation
- [requirements.txt](requirements.txt): Python dependencies
- [.vscode/mcp.json](.vscode/mcp.json): VS Code MCP server registration
- [README.md](README.md): setup and usage guide