Skip to content

[POC] Browser tools in Copilot CLI - MCP Version#314570

Draft
jruales wants to merge 1 commit intomainfrom
jruales/2026.05-copilot-cli-browser-mcp-version
Draft

[POC] Browser tools in Copilot CLI - MCP Version#314570
jruales wants to merge 1 commit intomainfrom
jruales/2026.05-copilot-cli-browser-mcp-version

Conversation

@jruales
Copy link
Copy Markdown
Contributor

@jruales jruales commented May 5, 2026

exposes open_browser_page tool to Copilot CLI chat sessions via MCP

Copilot AI review requested due to automatic review settings May 5, 2026 22:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Screenshot Changes

Base: 44a2ad3c Current: 2efe65b8

Changed (12)

chat/input/chatInput/Default/Light
Before After
before after
chat/input/chatInput/WithFileChanges/Dark
Before After
before after
chat/input/chatInput/WithFileChanges/Light
Before After
before after
chat/input/chatInput/WithTodos/Light
Before After
before after
chat/input/chatInput/WithTodosAndFileChanges/Dark
Before After
before after
chat/input/chatInput/WithTodosAndFileChanges/Light
Before After
before after
chat/input/chatInput/WithArtifactsAndFileChanges/Dark
Before After
before after
chat/input/chatInput/WithArtifactsAndFileChanges/Light
Before After
before after
chat/input/chatInput/Full/Light
Before After
before after
chat/widget/chatWidget/PendingToolApproval/Dark
Before After
before after
chat/widget/chatWidget/PendingToolApproval/Light
Before After
before after
chat/widget/chatWidget/MultiTurn/Light
Before After
before after

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an “internal MCP server” concept to the MCP gateway so VS Code can expose in-process tools (starting with the Browser “open page” tool) to external MCP clients like Copilot CLI via the existing gateway channel.

Changes:

  • Introduces an InternalMcpServerRegistry service for registering virtual/in-process MCP servers and tools.
  • Extends McpGatewayToolBrokerChannel to list and invoke tools from internal servers alongside real MCP servers.
  • Adds an Electron workbench contribution that registers a vscode-internal:browser MCP server backed by ILanguageModelToolsService and adds tests for the new internal-server behavior.
Show a summary per file
File Description
src/vs/workbench/contrib/mcp/test/common/mcpGatewayToolBrokerChannel.test.ts Adds coverage for listing/using internal MCP servers and tool routing.
src/vs/workbench/contrib/mcp/electron-browser/mcpGatewayToolBrokerContribution.ts Wires IInternalMcpServerRegistry into the gateway tool broker channel registration (desktop).
src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.ts Implements internal-server support in list/notify/invoke flows.
src/vs/workbench/contrib/mcp/common/internalMcpToolUtils.ts Adds conversion utility from internal IToolResult to MCP CallToolResult.
src/vs/workbench/contrib/mcp/common/internalMcpServerRegistry.ts New registry/service contracts + implementation for internal MCP servers/tools.
src/vs/workbench/contrib/mcp/browser/mcpGatewayToolBrokerContribution.ts Wires IInternalMcpServerRegistry into the gateway tool broker channel registration (web/remote).
src/vs/workbench/contrib/mcp/browser/mcp.contribution.ts Registers IInternalMcpServerRegistry singleton in the MCP workbench contribution.
src/vs/workbench/contrib/browserView/electron-browser/tools/browserTools.contribution.ts Registers the new Browser MCP server workbench contribution.
src/vs/workbench/contrib/browserView/electron-browser/tools/browserMcpServerContribution.ts Implements vscode-internal:browser internal MCP server and bridges to ILanguageModelToolsService.

Copilot's findings

  • Files reviewed: 9/9 changed files
  • Comments generated: 7

Comment on lines +76 to +83
next.push({
definition: {
name: data.id,
description: data.modelDescription,
inputSchema: data.inputSchema as MCP.Tool['inputSchema'],
},
invoke: (args, _ctx, token) => this._invokeTool(data.id, args, token),
});
Comment on lines +269 to +275
const internalTool = this._findInternalTool(internalServer, name);
if (!internalTool) {
throw new Error(`Unknown tool '${name}' on internal server '${serverId}'`);
}
const sessionResource = chatSessionResource ? URI.parse(chatSessionResource) : undefined;
const result = await internalTool.invoke(args, { chatSessionResource: sessionResource }, token);
this._logService.debug(`[McpGateway][ToolBroker] Internal tool '${name}' on '${serverId}' completed (isError=${result.isError ?? false}, content blocks=${result.content.length})`);
Comment on lines +114 to +115
const next = this._servers.get().filter(s => s !== server);
if (next.length !== this._servers.get().length) {
Comment on lines +20 to +21
* - `data` parts with any other mime type are dropped (with a warning text
* block) since MCP has no generic binary content type — the model would
Comment on lines 53 to 58
constructor(
private readonly _mcpService: IMcpService,
private readonly _logService: ILogService,
private readonly _startupGracePeriodMs = 5000,
private readonly _internalServerRegistry: IInternalMcpServerRegistry | undefined = undefined,
) {
Comment on lines 240 to +246
private async _listToolsForServer(serverId: string): Promise<readonly MCP.Tool[]> {
const internalServer = this._getInternalServerById(serverId);
if (internalServer) {
const tools = internalServer.tools.get().map(t => t.definition);
this._logService.debug(`[McpGateway][ToolBroker] listToolsForServer (internal) '${serverId}': ${tools.length} tool(s)`);
return tools;
}
Comment on lines +274 to +276
const result = await internalTool.invoke(args, { chatSessionResource: sessionResource }, token);
this._logService.debug(`[McpGateway][ToolBroker] Internal tool '${name}' on '${serverId}' completed (isError=${result.isError ?? false}, content blocks=${result.content.length})`);
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants