Implant – 一个为代码智能体提供 VS Code API 接口的扩展插件
Implant – an extension to VS Code that exposes its APIs to coding agents

原始链接: https://marketplace.visualstudio.com/items?itemName=strangepleasures.implant

**Implant** 是一个 VS Code 扩展,旨在连接编码智能体(如 Claude Code、Copilot 或 Cursor)与编辑器内部智能。通过提供一个名为 `run_vscode_script` 的 MCP 工具,它允许智能体直接在 VS Code 扩展宿主中执行 JavaScript 代码片段。 这使智能体能够像编辑器本身一样与代码库进行交互——包括使用语言服务器、符号、git blame 和工作区诊断功能,从而确保代码编辑在语义上是可知的,且比单纯的文件操作更安全。 **核心功能:** * **深度集成:** 智能体可以触发重构、重命名和诊断等原生操作。 * **安全至上:** 未经用户批准,任何代码都不会执行。系统提供一个 WebView 界面,在执行前显示每个代码片段供用户检查。 * **便捷设置:** 该扩展会自动生成可移植的配置文件(MCP/rules),引导智能体学习如何调用其功能。 * **透明访问:** 利用安全的令牌门控通信,确保只有经过授权的智能体才能与宿主进行交互。 Implant 有效地将编辑器转化为 AI 的高级 API,使智能体能够在拥有 VS Code 内置智能的可靠性前提下,执行复杂的、具备上下文感知能力的编码任务。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Implant – 一个将 VS Code API 暴露给编程代理的插件 (visualstudio.com) 5 分 | 由 strangepleasure 发布于 1 小时前 | 隐藏 | 过往 | 收藏 | 讨论 | 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Give coding agents (Copilot Chat, Claude Code, Cursor, anything that speaks MCP — or anything that can shell out) live access to everything that lives inside VS Code and third-party extensions.

Explore the code with the tools the editor already has: Find References, Go-to-Definition, hover types, workspace diagnostics, git blame, symbol outlines, and any command a third-party extension registers.

Modify the code through the same language server that powers the editor: structural rename, quick-fixes and refactors, organize imports, safe file create/rename/delete via WorkspaceEdit, formatter output, source actions. Edits go through the language server — safer than sed/awk on files because they respect scope, imports, and semantics.

Implant exposes a single MCP tool, run_vscode_script, that executes a JavaScript snippet inside the running VS Code extension host with full access to the vscode.* API. Nothing runs without the user approving the exact snippet.

screenshot

Quick start

  1. Install the extension.
  2. Open your project. Implant will offer to install itself into the workspace — this drops portable rule files that teach agents when to reach for Implant.
  3. Your agent picks up the tool automatically — MCP-native clients (Copilot Chat and others on VS Code ≥ 1.101) discover it via the registry, and CLI agents pick it up from the workspace instructions installed in step 2.
  4. When an agent invokes the tool, a webview opens beside the editor showing the script with syntax highlighting. Click Run, Run + trust session, or Deny.

Palette commands

Command Purpose
Implant: Install into Workspace Writes five portable, safe-to-commit files: .vscode/implant/call.js (stdio↔HTTP MCP proxy), .mcp.json (Claude Code / generic MCP config), .cursor/mcp.json (Cursor MCP config), .claude/skills/implant/SKILL.md (Claude Code skill), .cursor/rules/implant.mdc (Cursor rules). Also upserts an <!-- BEGIN Implant --> … <!-- END Implant --> section into .github/copilot-instructions.md. Prompts before overwriting; asks which folder in multi-root workspaces.
Implant: Copy Agent Instructions Copies the same instructions to the clipboard — paste into AGENTS.md, an agent's system prompt, or wherever your setup expects.

Settings

key default meaning
implant.requireConfirmation true Show the approval webview before each script runs.
implant.timeoutMs 0 Hard execution timeout in ms. 0 disables it — long-running async scripts are cancelled by the user via a notification that appears after 10 seconds. Set to a positive value to enforce an automatic upper bound.
implant.port 0 Port for the HTTP MCP server. 0 picks an ephemeral one; the actual port is written to .vscode/implant/session.yml.

The approval webview has a Run + trust session button that skips future prompts until the window is reloaded.

Safety notes

  • Snippets run in the VS Code extension host with the same privileges as the extension itself. There is no sandbox — that is the entire point.
  • The approval webview exists so you can eyeball each snippet before it runs. Turn confirmation off only when the agent is already in a tight review loop.
  • The HTTP server only binds to 127.0.0.1 and requires a per-session bearer token — the token lives in .vscode/implant/session.yml (mode 0600, gitignored, regenerated on every activation). Requests without a valid token get 401 and raise a warning notification so you notice anything poking at the port.
  • Even with the token gate, don't run this on a shared machine: any process running as your user can read the session file.
  • The confirmation prompt is the last line of defense. Only turn implant.requireConfirmation off when the agent is already in a tight review loop that you trust.
联系我们 contact @ memedata.com