# Using VS Code and Cursor over SSH

VS Code and Cursor can open a folder on your server and run the terminal, the debugger and your extensions there, while you edit on your own computer. Both connect over the same SSH connection a terminal uses.

## What you need

- A server with the status **Running**, started from a template in SSH mode, with an SSH key you hold attached. See [Connect with SSH](/docs/connect-ssh).
- VS Code with the **Remote - SSH** extension, or Cursor with its own SSH remote support. Cursor reads the same SSH configuration file; if its menu names differ from the ones below, follow its own documentation to add a host.

## Add the server

1. Open the server in the console and select the **Connect** tab.
2. Under **Connecting from**, choose **VS Code** and select **Copy VS Code config**.
3. In VS Code press `F1`, run **Remote-SSH: Open SSH Configuration File** and paste the entry at the end. In Cursor, open the same file from its remote SSH command.
4. Press `F1`, run **Remote-SSH: Connect to Host** and choose the host.
5. Open a folder, for example `/workspace`.

The first connection installs a small helper on the server, which takes a moment. On Windows, see [SSH from Windows](/docs/windows-ssh) for the location of the config file.

## When the host or port changes

The host and port can change when a server is stopped and started again. Copy the entry again from the **Connect** tab and replace the old one. If you see a warning that the host key changed, see [Troubleshooting](/docs/troubleshooting).

## Tips

- Keep your project in `/workspace`: it is on the server's disk and survives a stop.
- Install extensions on the remote side when the editor offers it. Extensions that need the GPU, such as a notebook kernel, run on the server.
- To open a web app from the server, forward the port from the editor's **Ports** panel, or use the tunnel command from the **Connect** tab. See [Ports and networking](/docs/ports-and-networking).
- You are billed while the server runs, not while the editor is open. Stop the server when you finish.

## AI coding agents

An assistant inside your editor can also manage servers for you, for example deploy, stop or read logs, through the Apidly MCP server. That is set up in the assistant's MCP settings, not over SSH. See [Use Apidly from an AI assistant (MCP)](/docs/mcp).

## If it does not connect

- **Permission denied:** the key must be one you attached to the server, and the user is `root`. If needed, add the path of your private key as `IdentityFile` in the entry.
- **Connection refused or timed out:** the server is stopped, still starting, or the port changed. Copy the entry again.
- **The window hangs on the first connection:** wait a minute, then retry. If the image has no `curl` or `wget`, the helper cannot be installed.

More cases are in [Troubleshooting](/docs/troubleshooting).
