remote-pc-mcp 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raghib Murt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,331 @@
1
+ Metadata-Version: 2.4
2
+ Name: remote-pc-mcp
3
+ Version: 0.5.0
4
+ Summary: Expose any PC's capabilities - shell, filesystem, background processes, system stats, screenshots, UI control, and file transfer - to any MCP client over streamable HTTP.
5
+ Author: Raghib Murt
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Raghib Murt
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/raghibrm/remote-pc-mcp
29
+ Project-URL: Repository, https://github.com/raghibrm/remote-pc-mcp
30
+ Project-URL: Changelog, https://github.com/raghibrm/remote-pc-mcp/blob/main/CHANGELOG.md
31
+ Keywords: mcp,model-context-protocol,remote-control,automation,tailscale
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: Microsoft :: Windows
36
+ Classifier: Operating System :: POSIX :: Linux
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Topic :: System :: Systems Administration
39
+ Requires-Python: >=3.10
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Requires-Dist: mcp<2,>=1.10.0
43
+ Requires-Dist: uvicorn>=0.30.0
44
+ Requires-Dist: starlette>=0.40.0
45
+ Requires-Dist: python-dotenv>=1.0.0
46
+ Requires-Dist: httpx>=0.27.0
47
+ Requires-Dist: psutil>=5.9.0
48
+ Requires-Dist: pyautogui>=0.9.54
49
+ Requires-Dist: pillow>=10.0.0
50
+ Dynamic: license-file
51
+
52
+ # remote-pc-mcp
53
+
54
+ Expose any PC's capabilities — shell, filesystem, background processes, system stats, screenshots, UI control, and file transfer — to **any MCP client** (Claude Desktop, Claude Code, Cursor, Cline, Continue, Windsurf, custom agents — anything that speaks the [Model Context Protocol](https://modelcontextprotocol.io)) over streamable HTTP.
55
+
56
+ Drop it on any machine you want to drive remotely: a home server, a desktop, a build/CI box, a media server, a workstation, a Raspberry Pi. From a separate machine, your AI agent of choice can run commands on it, manage files, launch and monitor background jobs, take screenshots, and drive the desktop UI.
57
+
58
+ The transport is the `mcp` SDK's streamable HTTP (`stateless_http=True`), so a server restart does not break already-connected clients. Each request is self-contained — there is no in-memory session to go stale.
59
+
60
+ > ⚠️ **`shell_exec` runs arbitrary commands on the host as the user that started the server.** The bearer token is a root-equivalent credential. See [Security](#security) before exposing the server.
61
+
62
+ ## Tools
63
+
64
+ | Tool | Description |
65
+ |------|-------------|
66
+ | `shell_exec` | Run any shell command — returns stdout, stderr, exit code |
67
+ | `read_file` | Read a file as text or base64 (binary fallback) |
68
+ | `write_file` | Write text or binary content to a file |
69
+ | `list_directory` | List files and directories, optionally recursive |
70
+ | `system_info` | OS, CPU, RAM, and GPU stats (NVIDIA GPUs via `nvidia-smi`; absent on non-GPU hosts) |
71
+ | `start_process` | Start a long-running command in the background — returns a PID |
72
+ | `get_process_output` | Poll stdout/stderr of a background process by PID |
73
+ | `kill_process` | Terminate a process by PID |
74
+ | `download_file` | Download a URL directly to this machine |
75
+ | `take_screenshot` | Capture the primary display — returns base64-encoded PNG |
76
+ | `click` | Click at screen coordinates `(x, y)` — left / right / middle, single or multi-click |
77
+ | `move_mouse` | Move cursor to `(x, y)`, optionally animated |
78
+ | `type_text` | Type a string into the focused window |
79
+ | `press_key` | Press a single key or hotkey combo (e.g. `enter`, `f11`, `ctrl+c`, `win+d`) |
80
+ | `scroll` | Scroll the mouse wheel up or down, optionally at a specific point |
81
+
82
+ ## Requirements
83
+
84
+ - Python 3.10+
85
+ - Windows 10/11, or Linux with systemd (for autostart)
86
+
87
+ ## Install
88
+
89
+ On the machine you want to control:
90
+
91
+ ```bash
92
+ git clone https://github.com/raghibrm/remote-pc-mcp
93
+ cd remote-pc-mcp
94
+ cp .env.example .env
95
+ ```
96
+
97
+ Set a strong token in `.env`:
98
+
99
+ ```
100
+ REMOTE_PC_MCP_TOKEN=your-long-random-token-here
101
+ ```
102
+
103
+ Generate one:
104
+
105
+ ```bash
106
+ # Windows
107
+ python -c "import secrets; print(secrets.token_hex(32))"
108
+
109
+ # Linux / macOS
110
+ openssl rand -hex 32
111
+ ```
112
+
113
+ Then run the installer:
114
+
115
+ ```bash
116
+ # Windows
117
+ install.bat
118
+
119
+ # Linux
120
+ chmod +x install.sh
121
+ ./install.sh
122
+ ```
123
+
124
+ That's it — one command. The installer:
125
+
126
+ - installs Python dependencies
127
+ - registers the server to launch hidden on every login (Startup-folder shortcut on Windows, systemd user unit on Linux)
128
+ - starts it now
129
+ - supervises it with exponential backoff on crash (5→10→20→40→60 seconds, resets after 5 minutes of uptime)
130
+ - survives reboots — set once, runs forever
131
+
132
+ ### Verify it's up
133
+
134
+ ```bash
135
+ curl http://localhost:8765/health
136
+ # {"status":"ok","server":"remote-pc-mcp","version":"0.5.0"}
137
+ ```
138
+
139
+ ### When to rerun the installer
140
+
141
+ `install.bat` / `install.sh` are idempotent and self-healing. Rerun any time after:
142
+
143
+ - You **move the repo** to a different folder
144
+ - You **reinstall or upgrade Python** to a different path
145
+ - You **rebuild the machine** and want to restore autostart
146
+
147
+ For day-to-day operation you never need to think about it.
148
+
149
+ ### After a reboot
150
+
151
+ Autostart fires when you **sign in** to Windows. A reboot that sits at the lock screen will NOT start the daemon until somebody logs in. This is intentional — enabling Windows auto-logon to make reboots fully hands-off would let anyone with physical access to the machine get a logged-in desktop, which is the wrong trade-off for a remote-control tool.
152
+
153
+ If you need to bring the daemon back up after a reboot without walking to the PC, sign in remotely via Remote Desktop or Tailscale SSH. Once you're logged in, the Startup shortcut fires and the daemon starts.
154
+
155
+ Linux is different: `install.sh --linger` runs `sudo loginctl enable-linger $USER` so the systemd user unit runs across reboots without any logon. systemd's user services don't share the auto-logon security problem because they don't grant interactive desktop access — they just keep your user-scoped daemons alive.
156
+
157
+ ### Uninstall
158
+
159
+ ```bash
160
+ # Windows
161
+ install.bat --uninstall
162
+
163
+ # Linux
164
+ ./install.sh --uninstall
165
+ ```
166
+
167
+ Removes the autostart entry and stops the running server + supervisor.
168
+
169
+ ### Foreground run (development)
170
+
171
+ For a one-off run with visible console output and no autostart:
172
+
173
+ ```bash
174
+ python server.py
175
+ ```
176
+
177
+ That's it — no special script. Use `install.bat` / `install.sh` for the normal supervised setup.
178
+
179
+ ### Or install from PyPI
180
+
181
+ ```bash
182
+ pip install remote-pc-mcp
183
+ remote-pc-mcp # run the server in the foreground
184
+ remote-pc-mcp-daemon # supervised: restarts the server on crash
185
+ ```
186
+
187
+ A pip install gives you the server and supervisor commands but does not register autostart. For autostart on sign-in, use the clone and install-script path above. `.env`, logs, and `.state/` live in `REMOTE_PC_MCP_HOME` (default: the working directory).
188
+
189
+ ## Adding to your MCP client
190
+
191
+ Most MCP clients use the same JSON schema; the file just lives in different places. Example:
192
+
193
+ ```json
194
+ {
195
+ "mcpServers": {
196
+ "remote-pc": {
197
+ "type": "http",
198
+ "url": "http://YOUR_PC_IP_OR_HOSTNAME:8765/mcp",
199
+ "headers": {
200
+ "Authorization": "Bearer your-long-random-token-here"
201
+ }
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ Where to put it:
208
+
209
+ | Client | Config file |
210
+ |--------|-------------|
211
+ | Claude Code | `.mcp.json` in the project root (or `~/.claude.json` for user-wide) |
212
+ | Claude Desktop | `claude_desktop_config.json` (Settings → Developer → Edit Config) |
213
+ | Cursor | `.cursor/mcp.json` |
214
+ | Cline / Continue / Windsurf | each has its own MCP servers panel — paste the JSON there |
215
+ | Custom agents | wherever your agent reads MCP server definitions |
216
+
217
+ For Tailscale users, the magic-DNS hostname works in the URL:
218
+
219
+ ```json
220
+ "url": "http://your-pc.tail12345.ts.net:8765/mcp"
221
+ ```
222
+
223
+ Restart (or reload) your client. The tools appear automatically. The `"remote-pc"` key is just a label — pick whatever name you want.
224
+
225
+ ## Security
226
+
227
+ `shell_exec` runs **any command** on the host as the user that started the server. That is intentional — it is what makes the server useful for remote-driving a PC. It also means:
228
+
229
+ - **The bearer token is a root-equivalent credential.** Generate a 32-byte hex token, store it only in `.env` (which is git-ignored), and treat it like a password.
230
+ - **Never expose the server to the public internet** without TLS and a reverse proxy (nginx, Caddy, Cloudflare Tunnel).
231
+ - **Use Tailscale** (strongly recommended): bind to your Tailscale IP (set `REMOTE_PC_MCP_HOST=100.x.x.x` in `.env`) so the listener is only reachable from devices in your tailnet.
232
+ - **LAN-only deployments** with `REMOTE_PC_MCP_HOST=0.0.0.0` are reasonable if you trust every device on the LAN and have a strong token. Don't do this on an untrusted network.
233
+
234
+ The token is compared with `secrets.compare_digest` (constant-time). All error messages pass through a sanitiser that strips absolute paths, the home directory, and the token before being returned to clients.
235
+
236
+ ## Configuration
237
+
238
+ All env vars are optional except `REMOTE_PC_MCP_TOKEN`.
239
+
240
+ | Var | Default | Description |
241
+ |-----|---------|-------------|
242
+ | `REMOTE_PC_MCP_TOKEN` | _(required)_ | Bearer token clients must present |
243
+ | `REMOTE_PC_MCP_HOST` | `0.0.0.0` | Bind address. Set to a Tailscale IP to restrict reach |
244
+ | `REMOTE_PC_MCP_PORT` | `8765` | Listen port |
245
+ | `REMOTE_PC_MCP_ALLOWED_HOSTS` | _(empty)_ | Comma-separated allowlist for DNS-rebinding protection. Empty disables it (default — wrong threat model on a tailnet) |
246
+ | `REMOTE_PC_MCP_MAX_SHELL_TIMEOUT` | `600` (s) | Cap on per-call `shell_exec` timeout |
247
+ | `REMOTE_PC_MCP_MAX_READ_BYTES` | 50 MB | `read_file` upper limit |
248
+ | `REMOTE_PC_MCP_MAX_WRITE_BYTES` | 50 MB | `write_file` upper limit |
249
+ | `REMOTE_PC_MCP_MAX_DOWNLOAD_BYTES` | 2 GB | `download_file` upper limit |
250
+
251
+ After changing `.env`, restart the server so the new value takes effect:
252
+
253
+ ```bash
254
+ # Windows: easiest path is just re-run the installer (idempotent)
255
+ install.bat --uninstall && install.bat
256
+
257
+ # Linux
258
+ systemctl --user restart remote-pc-mcp
259
+ ```
260
+
261
+ ## Logs and troubleshooting
262
+
263
+ Two log files in the repo root, both rotated automatically:
264
+
265
+ | File | What's in it | Rotation |
266
+ |------|--------------|----------|
267
+ | `server.log` | App events + uvicorn startup/access logs | 10 MB × 5 |
268
+ | `daemon.log` | Supervisor events (crashes, restarts, backoff) | 2 MB × 3 |
269
+
270
+ **Server isn't responding?**
271
+
272
+ ```bash
273
+ # Is the listener up locally?
274
+ curl http://localhost:8765/health
275
+
276
+ # What's the supervisor seeing?
277
+ tail -f daemon.log
278
+
279
+ # Linux: full journal
280
+ journalctl --user -u remote-pc-mcp -f
281
+
282
+ # Windows: is the autostart registered?
283
+ explorer shell:startup # look for remote-pc-mcp.lnk
284
+ ```
285
+
286
+ **MCP client says tools are missing after a server restart?**
287
+
288
+ The streamable HTTP transport is designed so a restart does not brick clients, but the client still has to issue a request to notice the new server. First fix: invoke any tool from this server (e.g. ask your agent to run `system_info`) — the client will retry the connection. If that fails, reconnect the MCP server in your client (Claude Code: `/mcp` ; Cursor: refresh in MCP panel) or restart the client.
289
+
290
+ **Stuck process / port already in use?**
291
+
292
+ ```bash
293
+ # Windows
294
+ install.bat --uninstall && install.bat
295
+
296
+ # Linux
297
+ ./install.sh --uninstall && ./install.sh
298
+ ```
299
+
300
+ ## UI-driving tools
301
+
302
+ `take_screenshot`, `click`, `move_mouse`, `type_text`, `press_key`, and `scroll` require an **interactive desktop session**:
303
+
304
+ - **Windows**: a user must be logged in and the screen unlocked. A service running under Session 0 cannot reach the desktop. The Startup-folder install gives you exactly this — the daemon runs in your user session.
305
+ - **Linux**: needs an X11 or Wayland session. For screenshots specifically, install `scrot`, `gnome-screenshot`, or ImageMagick's `import` — `sudo apt install scrot` is the easiest.
306
+
307
+ ## Development
308
+
309
+ Project layout:
310
+
311
+ | File | Purpose |
312
+ |------|---------|
313
+ | `server.py` | The MCP server — tools, auth, transport |
314
+ | `daemon.py` | Supervisor — spawns server, restarts on crash with backoff |
315
+ | `_logging.py` | Shared logging config — one handler for app + uvicorn loggers |
316
+ | `install.{bat,sh}` | Single entry point: default installs, `--uninstall` removes |
317
+
318
+ ### Tests
319
+
320
+ A self-contained test suite under `tests/` launches its own isolated server on a high port with an ephemeral token, exercises every tool, and verifies that a mid-run server restart does not lock the client out. It does **not** touch the production server you have running.
321
+
322
+ ```bash
323
+ pip install -r requirements-dev.txt
324
+ python -m pytest tests/ -v
325
+ ```
326
+
327
+ ## License
328
+
329
+ MIT
330
+
331
+ <!-- mcp-name: io.github.raghibrm/remote-pc-mcp -->
@@ -0,0 +1,280 @@
1
+ # remote-pc-mcp
2
+
3
+ Expose any PC's capabilities — shell, filesystem, background processes, system stats, screenshots, UI control, and file transfer — to **any MCP client** (Claude Desktop, Claude Code, Cursor, Cline, Continue, Windsurf, custom agents — anything that speaks the [Model Context Protocol](https://modelcontextprotocol.io)) over streamable HTTP.
4
+
5
+ Drop it on any machine you want to drive remotely: a home server, a desktop, a build/CI box, a media server, a workstation, a Raspberry Pi. From a separate machine, your AI agent of choice can run commands on it, manage files, launch and monitor background jobs, take screenshots, and drive the desktop UI.
6
+
7
+ The transport is the `mcp` SDK's streamable HTTP (`stateless_http=True`), so a server restart does not break already-connected clients. Each request is self-contained — there is no in-memory session to go stale.
8
+
9
+ > ⚠️ **`shell_exec` runs arbitrary commands on the host as the user that started the server.** The bearer token is a root-equivalent credential. See [Security](#security) before exposing the server.
10
+
11
+ ## Tools
12
+
13
+ | Tool | Description |
14
+ |------|-------------|
15
+ | `shell_exec` | Run any shell command — returns stdout, stderr, exit code |
16
+ | `read_file` | Read a file as text or base64 (binary fallback) |
17
+ | `write_file` | Write text or binary content to a file |
18
+ | `list_directory` | List files and directories, optionally recursive |
19
+ | `system_info` | OS, CPU, RAM, and GPU stats (NVIDIA GPUs via `nvidia-smi`; absent on non-GPU hosts) |
20
+ | `start_process` | Start a long-running command in the background — returns a PID |
21
+ | `get_process_output` | Poll stdout/stderr of a background process by PID |
22
+ | `kill_process` | Terminate a process by PID |
23
+ | `download_file` | Download a URL directly to this machine |
24
+ | `take_screenshot` | Capture the primary display — returns base64-encoded PNG |
25
+ | `click` | Click at screen coordinates `(x, y)` — left / right / middle, single or multi-click |
26
+ | `move_mouse` | Move cursor to `(x, y)`, optionally animated |
27
+ | `type_text` | Type a string into the focused window |
28
+ | `press_key` | Press a single key or hotkey combo (e.g. `enter`, `f11`, `ctrl+c`, `win+d`) |
29
+ | `scroll` | Scroll the mouse wheel up or down, optionally at a specific point |
30
+
31
+ ## Requirements
32
+
33
+ - Python 3.10+
34
+ - Windows 10/11, or Linux with systemd (for autostart)
35
+
36
+ ## Install
37
+
38
+ On the machine you want to control:
39
+
40
+ ```bash
41
+ git clone https://github.com/raghibrm/remote-pc-mcp
42
+ cd remote-pc-mcp
43
+ cp .env.example .env
44
+ ```
45
+
46
+ Set a strong token in `.env`:
47
+
48
+ ```
49
+ REMOTE_PC_MCP_TOKEN=your-long-random-token-here
50
+ ```
51
+
52
+ Generate one:
53
+
54
+ ```bash
55
+ # Windows
56
+ python -c "import secrets; print(secrets.token_hex(32))"
57
+
58
+ # Linux / macOS
59
+ openssl rand -hex 32
60
+ ```
61
+
62
+ Then run the installer:
63
+
64
+ ```bash
65
+ # Windows
66
+ install.bat
67
+
68
+ # Linux
69
+ chmod +x install.sh
70
+ ./install.sh
71
+ ```
72
+
73
+ That's it — one command. The installer:
74
+
75
+ - installs Python dependencies
76
+ - registers the server to launch hidden on every login (Startup-folder shortcut on Windows, systemd user unit on Linux)
77
+ - starts it now
78
+ - supervises it with exponential backoff on crash (5→10→20→40→60 seconds, resets after 5 minutes of uptime)
79
+ - survives reboots — set once, runs forever
80
+
81
+ ### Verify it's up
82
+
83
+ ```bash
84
+ curl http://localhost:8765/health
85
+ # {"status":"ok","server":"remote-pc-mcp","version":"0.5.0"}
86
+ ```
87
+
88
+ ### When to rerun the installer
89
+
90
+ `install.bat` / `install.sh` are idempotent and self-healing. Rerun any time after:
91
+
92
+ - You **move the repo** to a different folder
93
+ - You **reinstall or upgrade Python** to a different path
94
+ - You **rebuild the machine** and want to restore autostart
95
+
96
+ For day-to-day operation you never need to think about it.
97
+
98
+ ### After a reboot
99
+
100
+ Autostart fires when you **sign in** to Windows. A reboot that sits at the lock screen will NOT start the daemon until somebody logs in. This is intentional — enabling Windows auto-logon to make reboots fully hands-off would let anyone with physical access to the machine get a logged-in desktop, which is the wrong trade-off for a remote-control tool.
101
+
102
+ If you need to bring the daemon back up after a reboot without walking to the PC, sign in remotely via Remote Desktop or Tailscale SSH. Once you're logged in, the Startup shortcut fires and the daemon starts.
103
+
104
+ Linux is different: `install.sh --linger` runs `sudo loginctl enable-linger $USER` so the systemd user unit runs across reboots without any logon. systemd's user services don't share the auto-logon security problem because they don't grant interactive desktop access — they just keep your user-scoped daemons alive.
105
+
106
+ ### Uninstall
107
+
108
+ ```bash
109
+ # Windows
110
+ install.bat --uninstall
111
+
112
+ # Linux
113
+ ./install.sh --uninstall
114
+ ```
115
+
116
+ Removes the autostart entry and stops the running server + supervisor.
117
+
118
+ ### Foreground run (development)
119
+
120
+ For a one-off run with visible console output and no autostart:
121
+
122
+ ```bash
123
+ python server.py
124
+ ```
125
+
126
+ That's it — no special script. Use `install.bat` / `install.sh` for the normal supervised setup.
127
+
128
+ ### Or install from PyPI
129
+
130
+ ```bash
131
+ pip install remote-pc-mcp
132
+ remote-pc-mcp # run the server in the foreground
133
+ remote-pc-mcp-daemon # supervised: restarts the server on crash
134
+ ```
135
+
136
+ A pip install gives you the server and supervisor commands but does not register autostart. For autostart on sign-in, use the clone and install-script path above. `.env`, logs, and `.state/` live in `REMOTE_PC_MCP_HOME` (default: the working directory).
137
+
138
+ ## Adding to your MCP client
139
+
140
+ Most MCP clients use the same JSON schema; the file just lives in different places. Example:
141
+
142
+ ```json
143
+ {
144
+ "mcpServers": {
145
+ "remote-pc": {
146
+ "type": "http",
147
+ "url": "http://YOUR_PC_IP_OR_HOSTNAME:8765/mcp",
148
+ "headers": {
149
+ "Authorization": "Bearer your-long-random-token-here"
150
+ }
151
+ }
152
+ }
153
+ }
154
+ ```
155
+
156
+ Where to put it:
157
+
158
+ | Client | Config file |
159
+ |--------|-------------|
160
+ | Claude Code | `.mcp.json` in the project root (or `~/.claude.json` for user-wide) |
161
+ | Claude Desktop | `claude_desktop_config.json` (Settings → Developer → Edit Config) |
162
+ | Cursor | `.cursor/mcp.json` |
163
+ | Cline / Continue / Windsurf | each has its own MCP servers panel — paste the JSON there |
164
+ | Custom agents | wherever your agent reads MCP server definitions |
165
+
166
+ For Tailscale users, the magic-DNS hostname works in the URL:
167
+
168
+ ```json
169
+ "url": "http://your-pc.tail12345.ts.net:8765/mcp"
170
+ ```
171
+
172
+ Restart (or reload) your client. The tools appear automatically. The `"remote-pc"` key is just a label — pick whatever name you want.
173
+
174
+ ## Security
175
+
176
+ `shell_exec` runs **any command** on the host as the user that started the server. That is intentional — it is what makes the server useful for remote-driving a PC. It also means:
177
+
178
+ - **The bearer token is a root-equivalent credential.** Generate a 32-byte hex token, store it only in `.env` (which is git-ignored), and treat it like a password.
179
+ - **Never expose the server to the public internet** without TLS and a reverse proxy (nginx, Caddy, Cloudflare Tunnel).
180
+ - **Use Tailscale** (strongly recommended): bind to your Tailscale IP (set `REMOTE_PC_MCP_HOST=100.x.x.x` in `.env`) so the listener is only reachable from devices in your tailnet.
181
+ - **LAN-only deployments** with `REMOTE_PC_MCP_HOST=0.0.0.0` are reasonable if you trust every device on the LAN and have a strong token. Don't do this on an untrusted network.
182
+
183
+ The token is compared with `secrets.compare_digest` (constant-time). All error messages pass through a sanitiser that strips absolute paths, the home directory, and the token before being returned to clients.
184
+
185
+ ## Configuration
186
+
187
+ All env vars are optional except `REMOTE_PC_MCP_TOKEN`.
188
+
189
+ | Var | Default | Description |
190
+ |-----|---------|-------------|
191
+ | `REMOTE_PC_MCP_TOKEN` | _(required)_ | Bearer token clients must present |
192
+ | `REMOTE_PC_MCP_HOST` | `0.0.0.0` | Bind address. Set to a Tailscale IP to restrict reach |
193
+ | `REMOTE_PC_MCP_PORT` | `8765` | Listen port |
194
+ | `REMOTE_PC_MCP_ALLOWED_HOSTS` | _(empty)_ | Comma-separated allowlist for DNS-rebinding protection. Empty disables it (default — wrong threat model on a tailnet) |
195
+ | `REMOTE_PC_MCP_MAX_SHELL_TIMEOUT` | `600` (s) | Cap on per-call `shell_exec` timeout |
196
+ | `REMOTE_PC_MCP_MAX_READ_BYTES` | 50 MB | `read_file` upper limit |
197
+ | `REMOTE_PC_MCP_MAX_WRITE_BYTES` | 50 MB | `write_file` upper limit |
198
+ | `REMOTE_PC_MCP_MAX_DOWNLOAD_BYTES` | 2 GB | `download_file` upper limit |
199
+
200
+ After changing `.env`, restart the server so the new value takes effect:
201
+
202
+ ```bash
203
+ # Windows: easiest path is just re-run the installer (idempotent)
204
+ install.bat --uninstall && install.bat
205
+
206
+ # Linux
207
+ systemctl --user restart remote-pc-mcp
208
+ ```
209
+
210
+ ## Logs and troubleshooting
211
+
212
+ Two log files in the repo root, both rotated automatically:
213
+
214
+ | File | What's in it | Rotation |
215
+ |------|--------------|----------|
216
+ | `server.log` | App events + uvicorn startup/access logs | 10 MB × 5 |
217
+ | `daemon.log` | Supervisor events (crashes, restarts, backoff) | 2 MB × 3 |
218
+
219
+ **Server isn't responding?**
220
+
221
+ ```bash
222
+ # Is the listener up locally?
223
+ curl http://localhost:8765/health
224
+
225
+ # What's the supervisor seeing?
226
+ tail -f daemon.log
227
+
228
+ # Linux: full journal
229
+ journalctl --user -u remote-pc-mcp -f
230
+
231
+ # Windows: is the autostart registered?
232
+ explorer shell:startup # look for remote-pc-mcp.lnk
233
+ ```
234
+
235
+ **MCP client says tools are missing after a server restart?**
236
+
237
+ The streamable HTTP transport is designed so a restart does not brick clients, but the client still has to issue a request to notice the new server. First fix: invoke any tool from this server (e.g. ask your agent to run `system_info`) — the client will retry the connection. If that fails, reconnect the MCP server in your client (Claude Code: `/mcp` ; Cursor: refresh in MCP panel) or restart the client.
238
+
239
+ **Stuck process / port already in use?**
240
+
241
+ ```bash
242
+ # Windows
243
+ install.bat --uninstall && install.bat
244
+
245
+ # Linux
246
+ ./install.sh --uninstall && ./install.sh
247
+ ```
248
+
249
+ ## UI-driving tools
250
+
251
+ `take_screenshot`, `click`, `move_mouse`, `type_text`, `press_key`, and `scroll` require an **interactive desktop session**:
252
+
253
+ - **Windows**: a user must be logged in and the screen unlocked. A service running under Session 0 cannot reach the desktop. The Startup-folder install gives you exactly this — the daemon runs in your user session.
254
+ - **Linux**: needs an X11 or Wayland session. For screenshots specifically, install `scrot`, `gnome-screenshot`, or ImageMagick's `import` — `sudo apt install scrot` is the easiest.
255
+
256
+ ## Development
257
+
258
+ Project layout:
259
+
260
+ | File | Purpose |
261
+ |------|---------|
262
+ | `server.py` | The MCP server — tools, auth, transport |
263
+ | `daemon.py` | Supervisor — spawns server, restarts on crash with backoff |
264
+ | `_logging.py` | Shared logging config — one handler for app + uvicorn loggers |
265
+ | `install.{bat,sh}` | Single entry point: default installs, `--uninstall` removes |
266
+
267
+ ### Tests
268
+
269
+ A self-contained test suite under `tests/` launches its own isolated server on a high port with an ephemeral token, exercises every tool, and verifies that a mid-run server restart does not lock the client out. It does **not** touch the production server you have running.
270
+
271
+ ```bash
272
+ pip install -r requirements-dev.txt
273
+ python -m pytest tests/ -v
274
+ ```
275
+
276
+ ## License
277
+
278
+ MIT
279
+
280
+ <!-- mcp-name: io.github.raghibrm/remote-pc-mcp -->
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "remote-pc-mcp"
7
+ description = "Expose any PC's capabilities - shell, filesystem, background processes, system stats, screenshots, UI control, and file transfer - to any MCP client over streamable HTTP."
8
+ readme = "README.md"
9
+ license = { file = "LICENSE" }
10
+ authors = [{ name = "Raghib Murt" }]
11
+ requires-python = ">=3.10"
12
+ dynamic = ["version"]
13
+ keywords = ["mcp", "model-context-protocol", "remote-control", "automation", "tailscale"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: Microsoft :: Windows",
19
+ "Operating System :: POSIX :: Linux",
20
+ "Programming Language :: Python :: 3",
21
+ "Topic :: System :: Systems Administration",
22
+ ]
23
+ # Keep in sync with requirements.txt (which the clone-based install scripts
24
+ # use). The mcp<2 cap: mcp 2.0.0 removed mcp.server.fastmcp, which server.py
25
+ # imports; capped until the server is ported to the 2.x MCPServer API.
26
+ dependencies = [
27
+ "mcp>=1.10.0,<2",
28
+ "uvicorn>=0.30.0",
29
+ "starlette>=0.40.0",
30
+ "python-dotenv>=1.0.0",
31
+ "httpx>=0.27.0",
32
+ "psutil>=5.9.0",
33
+ "pyautogui>=0.9.54",
34
+ "pillow>=10.0.0",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/raghibrm/remote-pc-mcp"
39
+ Repository = "https://github.com/raghibrm/remote-pc-mcp"
40
+ Changelog = "https://github.com/raghibrm/remote-pc-mcp/blob/main/CHANGELOG.md"
41
+
42
+ [project.scripts]
43
+ remote-pc-mcp = "remote_pc_mcp.server:main"
44
+ remote-pc-mcp-daemon = "remote_pc_mcp.daemon:main"
45
+
46
+ [tool.setuptools]
47
+ packages = ["remote_pc_mcp"]
48
+
49
+ [tool.setuptools.dynamic]
50
+ version = { attr = "remote_pc_mcp.__version__" }