This guide teaches you how to connect Port OS to VS Code, so GitHub Copilot's agent mode can list and control your devices. You need VS Code 1.101 or later, GitHub Copilot, and a Port OS account with at least one connected device.

Check [supported smart-home devices and alpha availability](/smart-home-mcp/) before linking your account.

## Before you start: set up your devices

1. Go to [portoperatingsystem.com](/) and sign in.
2. Open the [plugin catalog](/plugins/) and add the plugins for your providers, such as Philips Hue, Sonos or SmartThings. Sign in to each provider on its own page; Port OS never sees your provider password.
3. Open [Your Devices](/dashboard/). If your devices are listed there, you're ready to connect VS Code.

## Connection details

Enter this server URL:

Then use these settings:

| Setting | Value |
| --- | --- |
| Transport | Streamable HTTP |
| Authentication | OAuth |

## 1. Add Port OS

Choose one of two ways.

### Recommended: install the extension

Install [Port OS Smart Home MCP](https://marketplace.visualstudio.com/items?itemName=portos.portos-smart-home-mcp) from the VS Code Marketplace, or [open it in VS Code](https://vscode.dev/redirect?url=vscode%3Aextension%2Fportos.portos-smart-home-mcp). You can also press `Ctrl+P` (`Cmd+P` on macOS) and run:

```text
ext install portos.portos-smart-home-mcp
```

The extension registers the hosted Port OS server with VS Code. Nothing runs on your computer.

### Manual: add the server yourself

Run **MCP: Add Server** from the Command Palette, choose **HTTP**, and enter the server URL above. Choose whether to save it for your user or for the current workspace.

You can instead add this entry to `.vscode/mcp.json`, keeping your other servers:

```json
{
  "servers": {
    "portos": {
      "type": "http",
      "url": "https://api.portoperatingsystem.com/mcp"
    }
  }
}
```

## 2. Start the server and sign in

1. Go to the **Agents** tab in VS Code and click the configuration button.
2. Click **Start** on **Port OS Smart Home** to activate it. With the extension, you can also click **Port OS: Connect** in the status bar, or run **Port OS: Connect Smart Home MCP** from the Command Palette.
3. VS Code asks to let the server sign in. Click **Allow**, and your browser opens to sign in to Port OS.
4. Review the permissions and approve them.

## 3. Verify in Agent

Open Copilot Chat in **Agent** mode and ask **“Show my connected devices.”** Compare the names with [Your Devices](/dashboard/).

## Troubleshooting

- If VS Code shows a 401 or “unauthorized” error for the server, usually after an extension update, run **Developer: Reload Window** from the Command Palette, then click **Start** on **Port OS Smart Home** again. You stay signed in.
- If the error remains after reloading, run **Authentication: Remove Dynamic Authentication Providers**, remove the Port OS entry, and click **Start** to sign in again.
- If no devices appear, confirm you signed in to the same Port OS account as [Your Devices](/dashboard/) and that it has connected devices.

## References

1. [Official VS Code MCP server instructions](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)
2. [Port OS Smart Home MCP extension on the Marketplace](https://marketplace.visualstudio.com/items?itemName=portos.portos-smart-home-mcp)
3. [Port OS authentication guide](/docs/user-guides/how-to-connect-any-supported-agent-to-port-os/)
