MoonshotAI / MoonshotAI/kimi-code
feat(desktop): allow connecting Desktop to a remote kimi server (SSH dev boxes)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Summary
Kimi Code Desktop (1.0.0-beta.1) can only drive a server it embeds in-process on the local machine. For users whose real dev environment is a remote Linux box on a corporate intranet (dev servers, GPU machines), there is no way to point the Desktop GUI at a kimi web daemon running there. Today the only options are a browser tab, or Remote Control — which relays session content (diffs, file previews, terminal output) through Kimi's servers and requires a paid membership, which is a non-starter for code that must not leave the intranet.
Proposal: let Desktop connect to an existing/remote kimi server, so the agent, files and tool execution stay on the dev box while the Desktop UI runs locally — the VS Code Remote-SSH / JetBrains Gateway model. This is the complement of #3443 (which proposes a local engine with remote tool execution via RTS); both serve the same "my dev machine is remote" population.
Current behavior (1.0.0-beta.1)
- Desktop embeds kap-server and calls
startServer()in-process (per #3812), binds127.0.0.1:58627(bumping +1 onEADDRINUSE), andloadURLs only its own origin. - Settings → "Server address" is read-only (copy button only).
- Workspaces are local folders only; adoption of an already-running shared daemon is keyed on a local pid under
~/.kimi-code/server/, so e.g. anssh -Ltunnel squatting the port cannot work: Desktop's embedded server silently moves to the next port and the window still points at itself.
Why this should be cheap: the groundwork already exists
- The shipped renderer already honors
?kimi_origin=<url>(sessionStorage keykimi-desktop-server-origin) to retarget all REST/WS calls — this is exactly how the Remote Control tunnel page drives a foreign origin. What's missing is only a shell-level entry point to load a user-specified origin withkimi_desktop=1. - The server API is documented (
kimi-code-cli/reference/server-api.html) andkimi webalready serves remote browsers with token auth (#token=,rotate-token,KIMI_CODE_PASSWORD). - Community shells attaching to the same API already exist (#2955), and the former public
apps/kimi-desktopshell (removed in #1849) shows thewindow.kimiDesktopbridge contract is origin-agnostic apart fromloadURL.
Suggested increments (small → large)
- "Connect to server…" in Settings (or onboarding): URL + token; shell loads
<origin>/?kimi_desktop=1&platform=…#token=…. Minimal change, immediately useful withkimi web+ SSH tunnel. - Documented env var / flag (e.g.
KIMI_DESKTOP_SERVER_URL) for headless/enterprise provisioning. NoteKIMI_SERVER_URLcurrently exists only as a dev/e2e knob. - Built-in SSH tunnel helper (host/user/key → local forward), so users don't hand-roll
ssh -Land tokens never traverse anything but the tunnel. - Remote-bind capability story:
bindClassifyclassifies non-loopback binds aspublicand disables the terminal PTY / debug / shutdown routes — so a remote-attached Desktop would lose its native terminal panel. A token-authenticated non-loopback bind that keeps PTY routes (the Desktop's own embedded server already runs--dangerous-bypass-authon loopback; remote needs the opposite trade: auth on, PTY on) is required for feature parity.
Use case
- Remote Linux dev server holds the code, toolchain, GPUs and intranet-only dependencies; laptop holds the GUI.
- Compliance: session content must not transit third-party relays → Remote Control is excluded; direct browser works but loses the Desktop experience (native terminal, changes panel, approvals, workspace picker).
- Stability: relay handshake outages (observed 503 flapping at launch day) don't affect a direct connection at all.
Related: #3443 (complementary direction), #2955 (community shell), #3812 (embedded server), #1849 (desktop moved to private repo).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Desktop renderer's existing kimi_origin handling and the shell path around startServer() and loadURL(). Read kimi-code-cli/reference/server-api.html, then inspect bindClassify and the window.kimiDesktop bridge contract. Done should be a clearly scoped remote-server connection increment with authentication and behavior defined for the affected Desktop capabilities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, desktop, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100