vsc-lsp-mcp: Instructions file for Codex

AGENTS.md

vsc-lsp-mcp AGENTS.md is an instructions file for Codex, OpenCode from beixiyo/vsc-lsp-mcp. It costs 1,652 tokens per session, scanned A, original, MIT.

Instructions for a VS Code extension that exposes the editor's code-intelligence features through MCP. It describes how several VS Code windows share one broker that routes requests to the right window.

In plain words
What is it for?
Use it when developing the extension, its broker, or its language-server features such as definitions, references, completion, renaming, and call hierarchies.
Why use it?
It helps agents understand the extension's multi-window design and avoid breaking request routing, instance discovery, or the separate broker process.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is beixiyo/vsc-lsp-mcp's own configuration. It tells Codex and OpenCode how to work on vsc-lsp-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything vsc-lsp-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to beixiyo/vsc-lsp-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/beixiyo/vsc-lsp-mcp/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/beixiyo/vsc-lsp-mcp

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for vsc-lsp-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/beixiyo/vsc-lsp-mcp/agents-md/github.svg)](https://agentmods.dev/instructions/beixiyo/vsc-lsp-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/beixiyo/vsc-lsp-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/beixiyo/vsc-lsp-mcp/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for vsc-lsp-mcp AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/beixiyo/vsc-lsp-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/beixiyo/vsc-lsp-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,652 This file is loaded in full into every session.
When invoked 1,652 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01652 $0.01652
Opus 5 $0.00826 $0.00826
Sonnet 5 $0.00330 $0.00330
Haiku 4.5 $0.00165 $0.00165

Measured 9d ago against content hash 6314d7902bdd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

vsc-lsp-mcp AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 115 lines

How it starts

The opening of the file, as written. The whole thing — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.

项目结构

  • src/index.ts:VS Code Extension Host 入口,构建为 dist/index.js
  • src/mcp/index.ts:当前 VS Code 窗口的启动编排,依次启动内部 Instance Server、确保共享 Broker 存在并注册 VS Code MCP provider
  • src/broker/main.ts:独立 Broker 子进程入口,构建为 dist/broker.js,不属于 VS Code Extension Host
  • src/broker/:共享 MCP Broker,负责单实例锁、稳定外部端口、MCP session、实例发现和请求转发
  • src/instance/:每个 VS Code 窗口的内部服务、实例注册表和路由规则
  • src/mcp/:在当前 VS Code 窗口内执行的 MCP/LSP 操作与 VS Code MCP provider
  • src/protocol.ts:Broker 与内部 Instance Server 之间共享的请求类型和协议描述
  • src/filePermissions.ts:注册表、状态文件和启动锁共用的私有文件权限常量
  • src/lsp/:对 VS Code LSP 能力的封装,负责定义、引用、补全、重命名、调用层级等操作
  • src/transform/:将 VS Code / LSP 返回结果转换成 JSON 或 Markdown
  • src/utils/:通用工具,目前主要是日志输出
  • l10n/:运行时代码字符串的本地化资源,配合 vscode.l10n.t 使用
  • package.nls*.jsonpackage.json 中扩展描述、配置项等静态贡献点的本地化资源
  • dist/tsup 构建产物,不手写维护

多实例架构

项目包含两个构建入口和两个独立进程:

VS Code Extension Host
src/index.ts -> src/mcp/index.ts
  ├─ 启动当前窗口的 Instance Server
  ├─ 将窗口信息写入共享注册表
  ├─ 复用或启动独立 Broker
  └─ 注册 VS Code MCP provider

独立 Broker 进程
src/broker/main.ts -> src/broker/server.ts
  ├─ 对外提供单个 /mcp 地址
  ├─ 从注册表发现所有 VS Code 窗口
  ├─ 按 instanceId 或最长工作区路径前缀选择实例
  └─ 将请求转发到目标窗口的内部 loopback 端点
  • src/index.ts 是 VS Code 直接加载的唯一扩展入口,对应 package.jsonmain: ./dist/index.js
  • src/broker/main.tssrc/broker/ensure.ts 通过独立 Node 子进程启动,不由 VS Code 直接加载
  • tsup.config.ts 必须同时产出 dist/index.jsdist/broker.js
  • 外部 MCP 客户端只连接共享 Broker,不直接连接各窗口的内部端口
  • Broker 使用固定外部端口;端口被占用时必须明确失败,不能回退到客户端未知的其他端口
  • 每个窗口使用随机内部端口和随机 token,仅监听 127.0.0.1
  • Broker 生命周期必须与任意单个 VS Code 窗口解耦,关闭首个窗口不能导致其他窗口断线
  • 多实例首版只承诺本机桌面 file: 工作区,不要未经设计直接宣称支持 Remote SSH、WSL、Dev Container 或虚拟工作区

推荐阅读顺序

理解启动与请求链路时按以下顺序阅读,不要从工具实现或注册表细节开始:

  1. src/index.ts
  2. src/mcp/index.ts
  3. src/instance/server.ts
  4. src/broker/ensure.ts
  5. src/broker/main.ts
  6. src/broker/server.ts
  7. src/broker/tools.ts
  8. src/instance/router.ts
  9. src/instance/registry.ts

请求链路为:外部 MCP 客户端 -> 共享 Broker -> 实例路由 -> 目标 VS Code Instance Server -> LSP/Workspace 操作 -> Broker 原样返回结果

Read the full file on GitHub · 115 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 115 lines · 1,652 tokens per session scan A 6314d7902bdd

Subscribe to this mod's changes

vsc-lsp-mcp AGENTS.md is an instructions file published in the GitHub repository beixiyo/vsc-lsp-mcp (40 stars, last pushed 1mo ago), licensed MIT. It adds 1,652 tokens to every session, about $0.0083 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens