M31A Agent Bridge for VS Code
Connect Visual Studio Code to the
M31A AI Coding Agent CLI (powered by NVIDIA
NIM) with live editor context sync, interactive inline diff reviews, real-time
LSP diagnostics, and one-click integrated terminal launch.
Install via VS Code Quick Open (Ctrl+P / Cmd+P):
ext install eshanized.m31a-ide-companion
Why Use M31A Agent Bridge for VS Code?
M31A Agent Bridge for VS Code pairs your editor with the open-source m31a
terminal AI coding agent so you keep full terminal speed while getting native
IDE ergonomics:
- Live Editor Context Sync — Streams active file focus, cursor position,
text selection (up to 16 KiB), open workspace tabs (up to 10 recent files),
and workspace trust status via
ide/contextUpdate.
- Interactive In-Editor Diff Reviews — Preview M31A's proposed edits side by
side in native VS Code diff editors (
<file> (M31A Proposed Edit)) with
editor title actions to Accept ($(check)) or Reject ($(close)).
- LSP Diagnostics & File Navigation — Exposes
getDiagnostics and
openFile MCP tools so M31A can read live compiler/linter errors and jump
directly to exact line numbers.
- M31A Impact Enrichment — When connected, M31A's
/impact static
dependency analyzer automatically enriches impact reports with live VS Code
LSP diagnostics.
- Zero-Config Integrated Terminals — Automatically exports
M31A_IDE_SERVER_PORT and M31A_IDE_WORKSPACE_PATH into VS Code integrated
terminals so m31a discovers the active editor window immediately.
- Local-First Authenticated MCP Bridge — Runs a loopback-only (
127.0.0.1)
Streamable HTTP Model Context Protocol (MCP) server protected by Host header
allow-listing, a per-window bearer token, and 0700 per-user discovery files.
Requirements
- Visual Studio Code
^1.85.0 (or a compatible editor)
- Node.js
>=20.0.0
- M31A CLI installed from npm (
npm install --global m31a or npx m31a)
- An NVIDIA NIM API key (configured via
NVIDIA_API_KEY or /auth)
Quick Start
Install the extension from the Marketplace
(ext install eshanized.m31a-ide-companion) or directly from the M31A CLI
using /ide install.
Install or run the M31A CLI:
npm install --global m31a
# or run without global install:
npx m31a
Open a workspace in VS Code (or a compatible editor such as Cursor,
Antigravity, Positron, or Trae).
Launch M31A from the Command Palette (M31A: Run M31A in Terminal) or
inside any integrated terminal:
m31a
Check $(sparkle) M31A in the bottom-right status bar, or run
M31A: Show Companion Status to inspect the active loopback port and
connected workspace path.
Commands
| Command |
ID |
Description |
| M31A: Run M31A in Terminal |
m31a.runInTerminal |
Opens an integrated terminal and starts m31a with bridge environment variables preconfigured. |
| M31A: Show Companion Status |
m31a.showStatus |
Displays the active 127.0.0.1 bridge port and connected workspace path. |
| M31A: Accept Diff Changes |
m31a.diff.accept |
Accepts the active M31A proposed diff and notifies the CLI bridge ($(check) in diff editor title bar). |
| M31A: Reject Diff Changes |
m31a.diff.cancel |
Rejects and closes the active M31A proposed diff without applying changes ($(close) in diff editor title bar). |
Once connected, M31A Agent Bridge for VS Code registers the following tools on
its local Streamable HTTP MCP server:
| Tool |
Purpose |
openDiff |
Opens a native VS Code side-by-side diff view (m31a-diff) for a proposed edit. |
closeDiff |
Closes an open diff view and returns any pending content. |
getDiagnostics |
Reads current LSP diagnostics (error, warning, info, hint) for a specific file or across the workspace. |
openFile |
Opens a file in VS Code and optionally scrolls to a 1-based line number. |
Supported Editors
M31A Agent Bridge for VS Code targets VS Code ^1.85.0 (Node >=20.0.0) and
detects host metadata automatically for:
- Visual Studio Code
- Antigravity
- Cursor
- Positron
- Trae
- Other VS Code-compatible forks
Security & Privacy
- Loopback only: Binds strictly to
127.0.0.1 and rejects HTTP Host
headers other than localhost:<port> and 127.0.0.1:<port>.
- Per-window bearer auth: Generates an authenticated discovery file inside
the per-user temporary directory (
m31a-ide-<uid> with 0700 permissions).
- Context filtering: Ignores untitled/non-file buffers and automatically
excludes IDE settings files (
settings.json) and instruction files (m31a.md
/ gemini.md) from openFiles snapshots.
- Workspace Trust aware: Tracks and forwards
vscode.workspace.isTrusted
state dynamically.
FAQ
How does the extension connect to the M31A CLI?
When a workspace opens, the extension starts a local Streamable HTTP MCP server
on 127.0.0.1 and writes a per-user discovery file plus M31A_IDE_SERVER_PORT
and M31A_IDE_WORKSPACE_PATH into VS Code integrated terminals. Running m31a
inside that terminal connects automatically.
Do I need to install the m31a npm package separately?
Yes. This extension bridges VS Code to the m31a CLI. Install it globally with
npm install --global m31a or launch it on demand with npx m31a.
Can I disable or inspect the bridge at any time?
Yes. Run M31A: Show Companion Status in the VS Code Command Palette, or use
/ide status, /ide enable, and /ide disable inside the M31A CLI.
Links