Skip to content

Agent Host: selected plugin agent does not auto-start its plugin-owned MCP servers #342860

Agent suggestions

Public preview

Description

@nfrank-ni

Does this issue occur when all extensions are disabled?: The SDK isolation reproduction runs without VS Code extensions or user configuration. The original symptom is in a standalone Agent Host; an extension-bisect run was not performed.

  • VS Code / Agent Host version: 1.142.0, commit 6d62b1d5dace93a33b3a6d3eca1317bd5e15bcb1.
  • Original host OS: Linux container. Isolated native-runtime reproduction: Windows 11 Enterprise 10.0.22631 x64, Node 26.3.0.
  • Reproduced using the Windows runtime packages for both @github/[email protected] (the affected stable host's pin) and 1.0.23-preview.5 (the pin in current VS Code main at 90657836b7b947d57d5be87c8e0ed925358a36a9). A complete current Insiders UI/end-to-end run has not been performed.

Steps to reproduce

  1. Register a file-based plugin on the Agent Host. The plugin contains an agent with tools: ['probe/read'] and an MCP server named probe in its legacy .mcp.json.
  2. Start a Copilot session selecting that plugin agent and send its first message.
  3. Inspect MCP state and the tools on the first model request.

Expected: the enabled plugin-owned MCP server starts automatically and probe/read is available to the selected agent.

Actual: the server is discovered/enabled but remains not_configured (Stopped in AHP), and its tool is absent. Explicitly starting the server after runtime creation makes the tool available on a subsequent turn.

Minimal plugin

plugin.json:

{"name":"mcp-agent-probe","version":"1.0.0","description":"Minimal plugin-owned MCP startup reproduction"}

.mcp.json:

{"mcpServers":{"probe":{"type":"stdio","command":"node","args":["${PLUGIN_ROOT}/server.mjs"]}}}

agents/probe.agent.md:

---
name: probe-agent
description: Minimal MCP startup probe
tools:
  - probe/read
---
Reply ready. Do not call tools.

server.mjs (a dependency-free, constant-value MCP server):

import { createInterface } from 'node:readline';
for await (const line of createInterface({ input: process.stdin })) {
  const request = JSON.parse(line);
  if (!Object.hasOwn(request, 'id')) continue;
  let result;
  switch (request.method) {
    case 'initialize':
      result = { protocolVersion: request.params.protocolVersion,
        capabilities: { tools: {} }, serverInfo: { name: 'probe', version: '1.0.0' } };
      break;
    case 'tools/list':
      result = { tools: [{ name: 'read', description: 'Read a constant',
        inputSchema: { type: 'object', properties: {} } }] };
      break;
    case 'tools/call':
      result = { content: [{ type: 'text', text: 'ok' }] };
      break;
    case 'ping': result = {}; break;
    default:
      process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id: request.id,
        error: { code: -32601, message: 'Method not found' } }) + '\n');
      continue;
  }
  process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id: request.id, result }) + '\n');
}

SDK differential reproduction

With a normally configured SDK client, the failing session config is:

const session = await client.createSession({
  pluginDirectories: [pluginRoot],
  enableConfigDiscovery: true,
  customAgents: [{
    name: 'probe-agent', tools: ['probe/read'],
    prompt: 'Reply ready. Do not call tools.'
  }],
  agent: 'probe-agent',
  // Normal model/provider and permission-request configuration.
});
await session.sendAndWait({ prompt: 'Reply ready. Do not call tools.' });
console.log(await session.rpc.mcp.listConfigured());

The automated isolation test uses a loopback OpenAI-compatible model that returns a constant response and records the request's tool names, fresh runtime directories, and no real credentials or external data services. Observed on both SDK releases:

Configuration MCP status after first turn MCP tool on model request
pluginDirectories + inline customAgents + selected agent not_configured absent
pluginDirectories, no inline catalog; discover with session.rpc.agent.list() and select the returned native plugin agent id before first send connected probe-read
Inline selected agent plus its owning plugin's resolved MCP definitions in customAgents[0].mcpServers connected probe-read

The last two cases do not issue MCP Start requests and do not register root/session-level MCP servers. The fixture's MCP configuration and allowlist are unchanged between cases.

Suspected host-side boundary

Related but distinct from #341680, which concerns missing sibling agents. Main now projects all agents, but toSdkSessionCustomAgents flattens plugin agents and forwards their instructions/tools without their owning plugin's MCP definitions. The explicit SDK catalog replaces native plugin-agent discovery. Meanwhile, file-plugin MCP definitions remain on the plugin-discovery registration path rather than session config.

A possible fix is to preserve the owning plugin's MCP scope when projecting its agents, reusing the existing MCP conversion and honoring disabled servers. The authoritative definitions should remain inside the plugin; moving them to host-level configuration or manually starting them should not be necessary.

I am preparing a draft with focused regression coverage to discuss this approach; maintainer confirmation of the intended runtime ownership/registration behavior would be appreciated. The current full Linux-host/Insiders integration remains to be verified.

Activity

  1. added 2 commits that reference this issue on Oct 20, 2026
    0920c15
    6b8b52e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions