[Feature Request] Register the MCP server via VS Code's native API and add zh-CN localization

Ouverte
#197 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript, vscode

Piste de recherche

Start by reading package.json, src/debugMCPServer.ts, src/utils/agentCatalog.ts, and src/utils/agentConfigurationManager.ts, then check the VS Code MCP extension guide and existing localization setup. Implementing native registration, preserving non-VS-Code agent configuration, adding fallback behavior, and localizing manifest and runtime strings span several areas. Done means the acceptance criteria pass for both zh-CN and English, including port and host changes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Feature Request: register the MCP server through VS Code's native API, and add zh-CN localization

中文摘要:希望扩展不要再去直接改写各 Agent 的 MCP 配置文件,而是使用 VS Code 原生的 MCP 服务器注册 API(vscode.lm.registerMcpServerDefinitionProvider / contributes.mcpServerDefinitionProviders)来自注册自己;同时希望扩展的界面文案、命令标题、设置项描述等提供中文(zh-CN)本地化支持。

Background

Today DebugMCP does not use VS Code's native MCP server registration mechanism. Instead it:

  1. Runs its own Streamable HTTP MCP server on http://localhost:<port>/mcp (src/debugMCPServer.ts).
  2. Registers itself with agents by reading and rewriting the agents' config files on disk (src/utils/agentCatalog.ts, src/utils/agentConfigurationManager.ts), e.g. %APPDATA%\Code\User\mcp.json for GitHub Copilot, ~/.copilot/mcp-config.json for Copilot CLI, ~/.codex/config.toml for Codex, and the various mcp_settings.json files for Cline / Roo Code / Cursor / Claude Code / Antigravity.

The file-writing approach works, but it has real downsides:

  • It mutates files the extension does not own. Users who keep their MCP configuration under version control or sync it across machines get unexpected diffs.
  • Entries are never cleaned up. Uninstalling the extension leaves a stale debugmcp entry behind in every config file the user selected, and there is no uninstall-time cleanup.
  • It races with the host editor. VS Code (and the agent itself) may rewrite the same file, so the entry can be lost or clobbered; the user may have to restart or reload the window for Copilot to pick it up.
  • It cannot be expressed in the UI. The server does not appear as an extension-provided MCP server in the MCP views, and there is no way to let the user disable/re-enable it from the standard MCP surfaces.
  • Port changes are not tracked. Changing debugmcp.serverPort leaves the previously written URL behind in the config files until the next migration runs.
  • It does not work in restricted environments. Writing to other tools' config directories can fail (read-only home, sandboxed remote, enterprise policy) and there is no VS Code-native fallback.

Request 1 — Register the MCP server through VS Code's native API

VS Code already provides a first-class way for an extension to expose an MCP server, documented in the official MCP extension guide:

  • Contribute contributes.mcpServerDefinitionProviders in package.json.
  • Implement the provider with vscode.lm.registerMcpServerDefinitionProvider(providerId, { onDidChangeMcpServerDefinitions, provideMcpServerDefinitions, resolveMcpServerDefinition }).
  • Return a vscode.McpHttpServerDefinition pointing at http://localhost:<port>/mcp.

Proposal:

  • Add a debugmcp definition provider that registers the server as a VS Code-managed MCP server, so Copilot (and any other VS Code-native agent) discovers it without any config file being touched.
  • Use resolveMcpServerDefinition to lazily start the local server (and to surface port/host changes), so the extension no longer has to eagerly bind a port just to be registered.
  • Emit onDidChangeMcpServerDefinitions when debugmcp.serverPort / debugmcp.bindHost change, so the definition stays in sync instead of leaving a stale URL in a config file.
  • Keep the existing file-based registration for the non-VS-Code agents (Cline, Cursor, Codex, Copilot CLI, Claude Code, …), since those have no equivalent host API. Ideally this becomes an explicit, opt-in choice in the agent selection popup rather than an automatic side effect.
  • If the native API is unavailable on the user's VS Code version, fall back to the current file-based path instead of failing.

Related: #118 (MCP not connected to GitHub Copilot agent runtime) — a native registration would also make the server visible to VS Code's own MCP status/error reporting.

Request 2 — Chinese (zh-CN) localization

The extension UI is currently English-only. Please add localization for the end-user-facing surface:

  • Manifest strings (package.json + package.nls.json + package.nls.zh-cn.json): displayName, description, command titles (e.g. "Show Agent Selection Popup"), configuration property titles/descriptions (debugmcp.serverPort, debugmcp.timeoutInSeconds, debugmcp.bindHost, debugmcp.captureDebugOutput), and the category.
  • Runtime strings (via a l10n bundle and vscode.l10n.t()): the agent selection dialog ("DebugMCP Setup - Choose AI Agent to Configure", "Configure …", "Add DebugMCP server to this agent"), all notification and error messages (e.g. "DebugMCP server running on …", "DebugMCP successfully configured for …", the invalid-JSON error), and the output-channel messages.
  • Ideally also localize the debug-live skill content, or at least ship a zh-CN variant of it.

Acceptance criteria

  • Installing the extension and activating it registers the MCP server in VS Code through the native MCP server definition API, with no file outside the extension being modified for the VS Code / Copilot case.
  • The registered definition reflects the current debugmcp.serverPort / debugmcp.bindHost, and updates when those settings change.
  • The server shows up in VS Code's MCP server list / status UI as provided by the extension.
  • Uninstalling the extension leaves no stale debugmcp entries behind for VS Code / Copilot.
  • The agent selection UI, commands, settings descriptions and notifications render in Chinese when the VS Code display language is zh-cn, and remain English otherwise.
  • Non-VS-Code agents (Cline, Cursor, Codex, Copilot CLI, Claude Code) keep working through the existing configuration-file mechanism.

Notes

  • The extension currently targets vscode: ^1.104.0, which already includes vscode.lm.registerMcpServerDefinitionProvider.
Langage dominant
TypeScript
Étoiles
580
Forks
63
Merge moyen
1 j 17 h
PR mergées (30 j)
11

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/DebugMCP

Toutes les issues de microsoft/DebugMCP

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.