跳到正文
DEV Community· Peter Mamrukov·· 2 小時前AI 評分58

Local Commander 如何透過單一 ChatGPT 或 Claude 對話,在多部電腦執行同一項任務

How to run one task on all your computers from a single ChatGPT or Claude chat

AI 導讀

Local Commander 讓 ChatGPT、Claude、Cursor 等支援登入式遠端 MCP 的應用程式,透過單一對話在多部電腦執行任務。每部電腦需安裝 Node.js 20 或以上的 agent,AI 應用程式連接 https://localcmd.app/mcp;不同電腦的獨立任務可並行,同一資料夾的工作則依次執行。核准電腦後,AI 可使用該用戶帳戶的權限執行操作,因此這並非沙盒。

正文

Few people who work with computers have just one. There's the work machine, the PC at home, maybe a small server or a cloud VM, and a parent's laptop in another city that only gets attention when it breaks.

Each of them is a separate trip. Open a remote session, SSH in, walk to the other room, or talk your mom through Settings over the phone. Then do the same thing again on the next machine.

The AI chat you already use knows most of the commands for those jobs. What it lacks is a way onto your computers. This post shows one way to give it that: real prompts, the setup, and where it stops being the right tool.

How it works

I build Local Commander, so this is the setup I know best. It has two parts. A small agent runs on each computer under your user account; it opens an outgoing connection to localcmd.app and waits for work, so there's no port forwarding to set up. Your AI app connects to the hosted MCP server at https://localcmd.app/mcp (Streamable HTTP, OAuth sign-in). When you ask for something, the model calls tools on that server, such as read a file, search, run a command, check Git or ask a local web service whether it answers, and each call runs on the computer it was addressed to. Independent tasks on different computers run side by side; work on the same folder waits its turn. If more than one computer is online and you didn't say which one, the server's instructions tell the model to ask instead of guessing. It works from ChatGPT, Claude, Cursor and other apps that support remote MCP with sign-in.

Three things to ask

Name computers the way they appear in your account. The prompts below are examples; change the names and details to match yours.

1. Which server needs attention?

You have a few machines that are supposed to just run. Instead of logging in to each one:

Check disk space, memory and failed services on all my servers and tell me which one needs attention.

The model sends the same kind of check to each computer, reads what comes back and gives you one answer instead of a row of terminal windows. Then follow up with "Show me the command and output you based that on." Ask for the evidence, not only the verdict.

2. Same project, two machines, different results

The build passes on your desktop and fails on the laptop. Before anyone touches code:

Compare this project on Work PC and Laptop: Git revision, Node and package-manager versions, the lockfile and the build command. Then run the build on both at the same time and show me the first difference that matters, as a table with one column per computer. Don't install anything or edit files.

If the two machines are on different revisions, you see that before anyone starts blaming the environment.

3. Every computer in the family

Disk space is the classic. Include the machines you would otherwise have to visit:

Check free disk space on every computer, including Mom's laptop. On any with less than 10% free, list the biggest folders in the user's profile. Don't delete or move anything.

When one of them turns out to be the real problem, stay in the same chat and narrow it down:

On Mom's laptop, find out why her photo app no longer starts. Check its error logs, whether it is running, and free disk space. Explain it in plain words I can read to her over the phone. Don't uninstall anything, restart the computer or change settings.

The "don't" lines are worth keeping in any prompt that only needs to look. They steer the model, but they are not a lock; that is what access settings are for (more below).

Set it up in four steps

  1. Install. On each computer, run npx local-commander-agent@latest. You need Node.js 20 or later.
  2. Approve. Confirm the pairing in your browser.
  3. Choose access. Your whole user account, which is the default once you approve, or only the folders you pick.
  4. Connect your AI. Add https://localcmd.app/mcp as a remote MCP server in ChatGPT, Claude, Cursor or another app, and sign in with your Local Commander account.

There's no code to write. Do the install before you need it: a laptop in another city has to be set up while someone is sitting at it, ideally its owner, and with their permission.

Limits, stated plainly

  • It is not a sandbox. Once a computer is approved, the AI can do what your user account can do there, like you at the keyboard. Folder rules prevent accidents such as the wrong folder or a stray delete, but they aren't a wall. For stronger isolation, run the agent under a separate user account.
  • The computer has to be reachable. Awake, online and running the agent. A machine that is off or offline can't be reached.
  • Dropped connections aren't papered over. If a computer drops in the middle of a task, the work is not re-run on a guess. Each request ends as done, failed or unknown, and an unknown one waits for you to check.
  • It works on your computers, not your network. The server's instructions tell the model to decline port scans and probes of other hosts.
  • The model can be wrong. It can misread output or pick the wrong fix. Ask for the commands and output behind an answer before you act on it.
  • Output goes to your AI app. Whatever a command returns goes back to the AI app, and from there it follows that app's rules.

You can block commands, cancel a running task, and revoke a computer or an AI app at localcmd.app at any time.

When something else fits

  • Tasks that only work through the screen, such as clicking through an app with no command line. Use remote desktop or a computer-use tool.
  • Repeatable admin jobs across many servers. Have the AI write the script, then run it with Ansible or over SSH against an inventory you keep. That gives you something you can review and rerun, which a chat doesn't.
  • A managed company fleet with patching and compliance. That is what remote monitoring and management (RMM) products are for; this doesn't replace them.
  • One computer and one AI app. That app's own computer features may be simpler.
  • Web tasks that don't touch files on your machines. A cloud agent needs nothing installed.
  • One computer, nothing hosted. The open-source edition (MIT) is a local MCP server for desktop clients such as Claude Desktop, Cursor and Cline, and runs without an account: https://github.com/netbka/local-commander-mcp-agent

FAQ

Can I do this from my phone?
Yes, through any AI app on your phone that is connected to Local Commander. The computer must be awake, online and running the agent. If your deploy runs from your work PC, you can start it from a train, as long as that PC is on.

Do I need to write code?
No. Install the agent, approve it, and type requests in the AI chat you already use.

Can it run the same task on all my computers at once?
Yes. Ask for it in one message. Independent tasks run side by side; work on the same folder waits its turn.

Which systems does the agent support?
Windows 11 x64, macOS 14 or later on Apple Silicon, and Linux with a systemd user session (Ubuntu 24.04 x64 or arm64), with Node.js 20 or later.

Does it show me the other computer's screen?
It isn't a screen-sharing tool. It works through commands, files and logs, with no mouse control. If a fix needs someone to click through a dialog, use screen sharing.

If your machines are spread across more than one place, I'd like to hear which job you would hand over first, and where this setup gets in your way. The same steps are on the guide page: https://localcmd.app/control-multiple-computers-with-ai

來源:DEV Community · dev.to