NetStacks for VS Code
SSH and Telnet terminals, a device and session manager, and AI tools for network engineers, inside VS Code. Everything runs in the VS Code extension host: there is no sidecar agent, no native module and no background service. One universal VSIX (under 1 MB) works on macOS, Linux and Windows.
Requires VS Code 1.120 or later.
What it is
NetStacks for VS Code is a light companion to NetStacks Terminal. It does not need the desktop app and does not talk to it.
Both can run on the same machine at the same time:
- No shared processes, lockfiles, ports or data files. The MCP server defaults to port 47830, not the 47824 and 47826 used by the NetStacks Terminal agent.
- Credentials are separate. The extension keeps its own in VS Code SecretStorage and never reads the desktop app's database or vault.
- To bring sessions across, export JSON from the desktop app and use the session JSON import (secrets are not included in exports).
Features
- Terminal. xterm.js in a VS Code editor tab. SSH (with legacy algorithm support, one level of jump host, a "via jump" pill) and Telnet. Host-key verification with a modal when a key changes. Auto-commands on connect, reconnect with backoff, clone tab, themes and fonts, session logging and asciicast recording.
- Sessions. Sessions, folders, credential profiles and jump hosts in the Sessions view, with search, bulk open, bulk move to a folder and bulk set profile. JSON import and export (desktop-export compatible, without secrets).
- Credentials. Passwords, passphrases and API secrets are stored only in VS Code SecretStorage (the OS keychain), never in the JSON data files.
- Terminal customisation. Highlight rules, mapped keys, snippets, custom actions (
NetStacks Custom Actions…) and workflows (NetStacks: Open Workflows…).
- Session notes and device memory. Per-session notes and remembered facts about a device that is included as context for the AI.
- API resources and quick actions. Define HTTP API resources (all auth types, including multi-step auth) and run quick actions against them, from the terminal or the AI.
- NetBox, LibreNMS, NetStacks-Crawler. Add a NetBox source and sync devices to sessions (
NetStacks: Sync NetBox Source to Sessions…). LibreNMS and Crawler sources are configured in Settings and used for enrichment and AI tools.
- Hover enrichment and lookups. Hover over an IP or MAC in terminal output for DNS PTR, OUI vendor, MAC type, NetBox and Crawler matches. WHOIS, DNS and similar lookups are available to the AI. Matchers can be imported and exported as TOML.
- Tunnels. Local, SOCKS and remote (
-R) forwards, a status bar item and NetStacks: Tunnels…. Tunnels marked auto-start come up when VS Code opens. Each tunnel is owned by one VS Code window; other windows show it as "in another VS Code window".
- AI. The
@netstacks chat participant, an AI Chat side panel and a context button in terminal windows. 31 language-model tools (Copilot and other providers' agent modes can call them): run commands over SSH, read terminal output, SNMP get, walk and interface stats, lookups, NetBox, LibreNMS and Crawler queries, session, quick-action and API-resource listing, and inline diagrams. Safety rules:
- a read-only filter on
netstacks_ssh_execute refuses commands that change device state;
- anything else that touches a device asks for confirmation;
- a sanitizer masks passwords, communities, keys and similar secrets in text sent to the model.
AI features need a language-model provider (GitHub Copilot, Claude, etc.). Turn them off with
netstacks.ai.enabled.
- SNMP. v1, v2c and v3 get, walk and interface statistics, from the AI tools and the MCP server.
- MCP server (optional, off by default). Serves the same tools to external MCP clients such as Claude Code. See MCP setup.
Install
From a VSIX:
code --install-extension netstacks-vsce-<version>.vsix
From the Marketplace: search for "NetStacks" in the Extensions view (publisher NetStacks) and click Install.
Getting started
- Run
NetStacks: Open Settings… and create a credential profile (username plus password or private key). Add a jump host profile first if you need one.
- Run
NetStacks: New Session…: name, host, port, protocol (SSH or Telnet), and the profile. Optionally put it in a folder (NetStacks: New Folder…).
- Run
NetStacks: Open Session… (or double-click the session in the Sessions view). The terminal opens in an editor tab. On first connect you are asked to trust the host key.
- Optional:
NetStacks: Add NetBox Source…, then NetStacks: Sync NetBox Source to Sessions… to populate sessions from NetBox.
- Optional: open Copilot Chat and type
@netstacks, or run NetStacks: Open Chat (@netstacks).
Settings
All settings live under netstacks.* in VS Code settings. Further configuration (profiles, highlight rules, integrations, tunnels, and so on) is in the NetStacks Settings page (NetStacks: Open Settings…) and is stored in the data files described below.
sessionLogs
| Setting |
Default |
Description |
netstacks.sessionLogs.path |
"" |
Root directory for session logs + recordings. Empty = ${globalStorage}/session-logs/. Files land under ///.{log,cast}. |
netstacks.sessionLogs.startOnConnect |
"never" |
What to auto-start when a NetStacks SSH session connects. Values: never, log, log+rec. |
terminal & general
| Setting |
Default |
Description |
netstacks.workspace.compactOnStart |
true |
On activation, close the right Auxiliary Bar and focus the NetStacks Sessions view for a cleaner editing surface. Toggle anytime with Ctrl/Cmd+K Ctrl/Cmd+/. |
netstacks.terminalTheme |
"default" |
Built-in xterm color theme. Use the dropdown to pick, or run "NetStacks: Change Terminal Theme…" / click the 🎨 status bar item. Values: default, monokai, dracula, solarized-dark, solarized-light, nord, gruvbox-dark, cisco, matrix, retro-amber, sunnight. |
netstacks.reconnectDelay |
3000 |
Initial reconnect delay (ms). |
netstacks.scrollback |
10000 |
Terminal scrollback line count. |
netstacks.fontSize |
0 |
Override terminal font size (0 = follow editor). |
netstacks.fontFamily |
"" |
Override terminal font family (empty = follow editor). |
netstacks.hoverLookups |
true |
Show OUI (vendor) and PTR (reverse DNS) tooltips when hovering MAC and IPv4 addresses in terminal output. |
ai
| Setting |
Default |
Description |
netstacks.ai.enabled |
true |
Enable the @netstacks chat participant and language-model tools. |
netstacks.ai.contextButton |
true |
Show the ✦ context button in terminal windows for quick AI questions about the current session. |
netstacks.ai.enrichmentAiDigest |
false |
Show the AI Digest button (✦) in hover popups. When clicked, an LM summarizes the enrichment data in 2-3 sentences. Costs LM tokens per click. |
netstacks.ai.diagrams |
true |
Render inline SVG diagrams in the AI chat when workflows produce visual results. |
netstacks.ai.history |
true |
Save AI chat conversations to disk so they persist across sessions. |
netstacks.ai.historyLimit |
50 |
Maximum number of saved conversations. Oldest are deleted when the limit is reached. |
netstacks.ai.panel |
true |
Show the NetStacks AI Chat side panel. Disable if you only want @netstacks in Copilot Chat or via MCP. |
netstacks.ai.maxToolRounds |
20 |
Maximum number of tool-call rounds the AI can perform in a single @netstacks turn. Increase if you want the AI to chain more operations before stopping. |
netstacks.ai.systemPromptId |
"" |
Quick-prompt ID to use as the @netstacks chat system prompt. Empty = built-in NetStacks engineer persona. |
netstacks.ai.defaultModel |
"" |
Default language model. Format 'vendor:family' (e.g. 'copilot:gpt-4o', 'claude-code:claude-sonnet-4-6'). Empty = first available. |
netstacks.ai.chatModel |
"" |
Override model for the AI side panel. Empty = use default. |
enrichment
| Setting |
Default |
Description |
netstacks.enrichment.sources.dns |
true |
Enable DNS PTR enrichment in hover popups. |
netstacks.enrichment.sources.oui |
true |
Enable OUI vendor enrichment in hover popups. |
netstacks.enrichment.sources.crawler |
true |
Enable NetStacks-Crawler enrichment in hover popups. Has no effect if no Crawler source is configured. |
netstacks.enrichment.sources.netbox |
true |
Enable NetBox enrichment in hover popups. Has no effect if no NetBox source is configured. |
netstacks.enrichment.onlineOuiLookup |
true |
Look up MAC vendors online (IEEE OUI list download and macvendors.com). When off, only the local OUI table is used. |
tunnels
| Setting |
Default |
Description |
netstacks.tunnels.autoStart |
true |
Start tunnels marked auto-start when VS Code opens (only in the first window that claims each tunnel). |
mcp
| Setting |
Default |
Description |
netstacks.mcp.enabled |
false |
Serve NetStacks tools to external MCP clients (Claude Code, Cline, Cursor) over loopback HTTP. |
netstacks.mcp.port |
47830 |
Loopback port. Not 47824 or 47826 (used by the NetStacks Terminal agent). |
netstacks.mcp.deviceAccess |
"confirm" |
How MCP clients may contact devices (SSH, SNMP). Quick actions always ask, whatever this is. Values: confirm, allowReadOnly, off. |
MCP setup
The MCP server exposes NetStacks tools to external clients over HTTP on loopback only (127.0.0.1).
Set netstacks.mcp.enabled to true, or run NetStacks: Start MCP Server. The port is netstacks.mcp.port (default 47830).
Run NetStacks: MCP Setup… to see the URL, copy client commands and rotate the token.
For Claude Code, run NetStacks: Copy Claude Code MCP Command and paste the result into a shell. It has this shape:
claude mcp add --scope user --transport http netstacks-vsce http://127.0.0.1:47830/mcp --header "Authorization: Bearer <token>"
The server name is netstacks-vsce.
The bearer token is generated on first use and kept in SecretStorage (netstacks.mcp.token). NetStacks: Rotate MCP Token replaces it; clients must be updated afterwards.
Device access is governed by netstacks.mcp.deviceAccess:
confirm (default): each SSH or SNMP request from an MCP client shows a consent prompt in VS Code.
allowReadOnly: read-only commands run without a prompt; anything else still asks.
off: MCP clients cannot contact devices at all.
Quick actions always ask, whatever the setting. Only one VS Code window serves MCP at a time; a second window reports that another window is serving it. If the port is taken, the extension still activates and the MCP status item says so.
Data and privacy
- Data files. JSON files in the extension's VS Code
globalStorage folder: sessions.json, folders.json, profiles.json, known_hosts.json, settings.json and others. session-logs/ and ai-history/ sit in the same folder. The Status view shows the location. Writes are safe across several windows (lock, re-read, atomic rename).
- Secrets. Only in VS Code SecretStorage:
netstacks.profile:<id>, netstacks.apiResource:<id>, netstacks.mcp.token. They are not written to the JSON files or to JSON exports.
- Network. The extension contacts only what you use:
- SSH, Telnet, SNMP and tunnel targets you connect to;
- the IEEE OUI list (downloaded for vendor lookup) and macvendors.com, unless
netstacks.enrichment.onlineOuiLookup is off (then only the bundled local OUI table is used);
- WHOIS servers (whois.iana.org, whois.arin.net and the registry they refer to) when you or the AI run a WHOIS lookup;
- NetBox, LibreNMS, Crawler and API resources, only when you configure them;
- your chosen language-model provider, with the sanitizer applied to text sent to it.
- Migration. Nothing is imported from the old sidecar agent or from the NetStacks Terminal database. A fresh install starts empty.
Troubleshooting
- "Host key changed" modal. The server presented a different key from the one in
known_hosts.json. If the change is expected (device replaced, key regenerated), accept the new key in the modal; if not, cancel and investigate.
- "Port … is already in use". A tunnel's local port, or the MCP port, is held by another VS Code window, NetStacks Terminal or another program. Stop that or choose another port (
netstacks.mcp.port for MCP).
- A command was refused by the read-only filter.
netstacks_ssh_execute only allows read commands (show, display, get and similar). Run configuration changes yourself in the terminal. Via MCP, deviceAccess also applies.
- Tunnel shows "in another VS Code window". Another window already owns that tunnel and runs it. Use it from there, or stop it there and start it in this window.
- Vendor lookups show nothing offline. The OUI list could not be downloaded. The bundled table covers common vendors; reconnect to the network, or leave
netstacks.enrichment.onlineOuiLookup on and reload the window.
- Hover shows no NetBox or Crawler data. Check the source is configured and the matching
netstacks.enrichment.sources.* setting is on; run NetStacks: Reload Enrichment Matchers.
Development
npm ci
npm run build # or: npm run watch
npm run typecheck
npm run lint
npm run test:unit
npm run test:smoke # builds, then activates the extension against a stubbed vscode API
npm run test:integration
Integration tests start a VS Code instance. On Linux run them under a virtual display: xvfb-run -a npm run test:integration. On macOS run npm run test:integration directly.
Press F5 ("Run Extension") to debug. To package, run ./scripts/publish.sh (--version=X.Y.Z to set the version, --non-interactive to skip prompts); it builds and writes dist/netstacks-vsce-<version>.vsix.
| |