copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

CLI should inherit MCP tools from connected VS Code instance

Open Omzig opened this issue 4 months ago • 3 comments

Describe the feature or problem you'd like to solve

When Copilot CLI is connected to a VS Code instance that has MCP extensions installed (e.g., MSSQL Agent, Anthropic Tools, etc.), the CLI session should inherit access to those MCP tools. Currently, MCP tools available in VS Code are not accessible to CLI sub-agents or custom agents spawned via the task tool.

Proposed solution

Extend the CLI-to-VSCode connection to propagate MCP server configurations and tool availability so that:

  • CLI sub-agents spawned via task tool receive MCP tools from the VS Code connection
  • Custom agents (task with agent_type) can declare MCP tool dependencies and receive them from VS Code
  • The CLI session inherits the full MCP toolset that VS Code has loaded

Use case / example workflow

  1. Developer opens VS Code with MSSQL MCP extension installed
  2. Developer opens Copilot CLI and connects it to the running VS Code instance
  3. Developer asks CLI to spawn a custom MSSQL Agent sub-agent: "help me write an SQL migration"
  4. Expected: MSSQL Agent has access to MSSQL MCP tools (database introspection, query execution, etc.)
  5. Actual: MSSQL Agent receives no MCP tools (see #2630)

This pattern applies to any VS Code MCP extension (Teams calendar, mail, Notion databases, Azure resources, etc.).

Why this matters

  • Leverages existing ecosystem: VS Code has mature MCP integrations already working well
  • Unifies tool access: No need to duplicate MCP server configurations between VS Code and CLI
  • Enables specialization: Allows agents to inherit capability from the IDE's MCP environment
  • Reduces friction: Developers can use the same MCP tools in CLI workflows that they already have in VS Code

Related issues

  • #2630 — Custom agent mcp-servers not connected in CLI sub-agent or --prompt contexts
  • #2716 — Custom agents in .claude/agents/ don't receive MCP tools when spawned as sub-agents via task tool
  • #4076 — Make the built-in research agent's MCP tools configurable

Additional context

The CLI now has a connection mechanism to VS Code (detected and used for model selection, environment context). This connection should be extended to include MCP tool propagation so that the CLI truly inherits the full IDE capability, not just partial settings.

Omzig avatar Jul 15 '26 19:07 Omzig

Triage summary

This is a clear, well-scoped feature gap: the CLI-to-VS-Code IDE connection exists today (and its reconnect reliability was just hardened by github/copilot-agent-runtime#13321), but nothing propagates VS Code's MCP server/tool configuration into CLI sub-agents or custom agents -- src/agents/customAgents/mcp.ts only resolves MCP servers from an agent's own declared config.

This needs a design decision before implementation: how to discover VS Code's MCP servers over the IDE connection, how to avoid double-spawning the same server from two processes, and how the existing MCP permission/consent model should apply to inherited tools. It is closely related to github/copilot-cli#4076's request to make the built-in research agent's MCP tools configurable, and to the narrower gaps in #2630 and #2716 you cited.

Route: developer-needed for the discovery/dedup/permission design.

This triage summary was prepared with GitHub Copilot and reviewed before posting.

gokhanarkan avatar Jul 23 '26 08:07 gokhanarkan

@gokhanarkan, thank you so much for looking at this and getting it moving along. this will be a huge improvement, if i can get to the mssql extension and its tools.... from the CLI, you know what kind of magic will happen!?!?!?

Omzig avatar Jul 23 '26 14:07 Omzig

Thanks. Confirmed the CLI's VS Code connection doesn't currently share VS Code's MCP servers or tools with CLI sessions, sub-agents or custom agents. We've moved this to the backlog as a feature request; we still need to decide how to discover those servers and avoid starting the same server twice.

hstaudacher avatar Nov 18 '26 16:11 hstaudacher