laptop-gpu-mcp
A minimal MCP server for running Python scripts on a remote machine over HTTP, exposing tools to Claude for script discovery, execution, and job status tracking.
README
laptop-gpu-mcp
A minimal MCP (Model Context Protocol) server for running Python scripts on a remote machine over HTTP. Expose your Python environment to Claude as discoverable, schema-validated tools instead of hand-rolling SSH commands.
What this does
Exposes three tools to Claude:
list_scripts— discover.pyfiles in your scripts directoryrun_python— execute a script in a specific conda environment; optionally run in background and poll resultsjob_status— check status or list all running jobs
Claude can call these like function calls, with automatic parameter validation and error handling.
Why MCP instead of SSH?
Instead of: ssh user@host 'python script.py ...' with manual parsing of output
You get: Claude sees run_python(script, env, args, background, timeout) as a typed tool
Benefits:
- Claude reasons about which tool to use
- Parameters are validated before execution (e.g., rejects path traversal, invalid conda envs)
- Background jobs get tracked with job IDs that Claude can poll later
- If you add tools later, Claude discovers them automatically
Customize for your setup
Clone this repo and edit these files:
1. Configuration
Copy the example config and edit it for your machine:
cp config.example.json config.json
{
"scriptsBaseDir": "/home/youruser/scripts", // Where your .py files live
"condaBaseDir": "/home/youruser/miniconda3", // Your conda installation
"allowedEnvs": ["env1", "env2"], // Conda envs you want to expose
"host": "0.0.0.0", // Listen on all interfaces
"port": 8420 // HTTP port (change if in use)
}
config.json is gitignored, so your paths and environment names never get
committed. Every setting can also be overridden with an environment variable
(SCRIPTS_BASE_DIR, CONDA_BASE_DIR, ALLOWED_CONDA_ENVS as a comma-separated
list, MCP_HOST, MCP_PORT) — handy for one-off runs or systemd units. Env
vars take precedence over config.json.
2. Security: Firewall and auth
This server has no authentication. It's safe only on private networks.
If running on a machine you control (same network, no internet exposure):
- Allow the port through your firewall for the remote client's subnet
- Example (Linux):
sudo ufw allow from 192.168.1.0/24 to any port 8420 - Example (Windows): netsh or Windows Defender firewall rules
If you need to expose this beyond a trusted network, add auth before deploying.
3. Optional: Persistent background service
To survive reboots, use systemd (Linux) or Task Scheduler (Windows). Examples in NOTES.md.
Quick start
npm install
npm run build
npm start # Listens on http://0.0.0.0:8420/mcp
# Or for development (no build step):
npm run dev
Health check: curl http://localhost:8420/health
Connecting from Claude
Claude Code CLI
claude mcp add --transport http my-remote-python http://192.168.1.100:8420/mcp
(Replace 192.168.1.100 with your server's IP)
Claude Desktop
Settings → Connectors → Add custom connector, use the same URL.
After connecting, Claude will see your three tools and can call them directly.
Example usage
Run a script in the foreground:
Claude: run_python(script="train.py", env="pytorch", args=["--epochs", "10"])
→ Blocks until done, returns stdout/stderr
Start a long job in the background:
Claude: run_python(script="preprocess.py", env="data", background=true)
→ Returns job_id immediately (e.g., "job_abc123")
Claude: job_status(job_id="job_abc123")
→ Check progress, returns status and logs
Testing
Included test scripts:
src/hello.py— simple foreground testsrc/slow.py— long-running background test
Adapt these to verify your setup works.
Known limitations
- No persistence on crash. If the server process dies, jobs die with it. Use a systemd service or Task Scheduler to auto-restart (see
NOTES.mdfor deployment details and known issues). - Single machine only. This server runs Python on one remote machine. To run on multiple machines, deploy one server per machine.
- No job persistence. Job state lives only in memory; reboots lose it.
Next steps
- Clone this repo
- Set
SCRIPTS_BASE_DIR,CONDA_BASE_DIR,ALLOWED_CONDA_ENVSfor your machine npm install && npm run build && npm start- Test connectivity:
curl http://your-server:8420/health - Add the HTTP connector to Claude Code/Desktop
- Try calling the tools
See NOTES.md for deployment troubleshooting and operational notes.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。