Skip to content

chat: start stopped agent host MCP servers for MCP Apps - #348950

Merged
Connor Peet (connor4312) merged 2 commits into
mainfrom
connor4312/mcp-app-autostart
Nov 17, 2026
Merged

Connor Peet (connor4312) merged 2 commits into
mainfrom
connor4312/mcp-app-autostart

Conversation

@connor4312

@connor4312 Connor Peet (connor4312) commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Agent host MCP Apps did not load when their MCP server was not running, for example after
VS Code restarts with apps from an old session. The apps showed "isn't available yet" until
something else started the server. Local MCP Apps already start their server on demand.

  • When an agent host MCP App load fails and its enabled server is Stopped, start the server
    one time. The status change then retries the load. Apps that share a server share one start
    request.
  • Do not start a server automatically again after it fails. This prevents a start, fail and
    retry loop.
  • Show a "Start Server" button in the app placeholder when the enabled server is Stopped or in
    Error, next to the existing "Sign In" behavior.
  • Show the startup error that the host reports in the placeholder. Show a notification only when
    the start request itself fails.

(Commit message generated by Copilot)

How to test

  1. Use an MCP App from an agent host MCP server (for example a server with a ui:// resource) in an Agents window session.
  2. Restart VS Code and reopen that session. The app starts the stopped server and then loads.
  3. Make the server fail to start. The app placeholder shows a Start Server button, and the app does not start the server again automatically.

Agent host MCP Apps did not load when their MCP server was not running, for example after
VS Code restarts with apps from an old session. The apps showed "isn't available yet" until
something else started the server. Local MCP Apps already start their server on demand.

- When an agent host MCP App load fails and its enabled server is Stopped, start the server
  one time. The status change then retries the load. Apps that share a server share one start
  request.
- Do not start a server automatically again after it fails. This prevents a start, fail and
  retry loop.
- Show a "Start Server" button in the app placeholder when the enabled server is Stopped or in
  Error, next to the existing "Sign In" behavior. Show a notification if the start fails.

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 23:03
@vs-code-engineering

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

server.start() resolves after dispatch rather than startup completion, so later startup failures bypass the catch and leave users without the promised error notification.

1 open issue
What changed in this PR

This PR adds on-demand startup for agent-host MCP Apps whose servers are stopped, helping restored chat sessions load their apps after a VS Code restart.

Changes:

  • Attempts one automatic server start after a failed app load, with shared tracking of start requests.
  • Adds a Start Server placeholder button for enabled servers in Stopped or Error states.
  • Adds coverage for one-time automatic startup and explicit retry after failure.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widget/​chatContentParts/​chatMcpAppModel.test.ts Tests automatic startup limits and explicit retries.
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​chatContentParts/​toolInvocationParts/​chatMcpAppSubPart.ts Adds the Start Server button and error-notification handling.
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​chatContentParts/​toolInvocationParts/​chatMcpAppModel.ts Adds server-start requests, shared request tracking, and one-time automatic startup.

Review effort: Balanced

@vs-code-engineering

This comment has been minimized.

@vs-code-engineering vs-code-engineering Bot added the pr-demo A PR demo was recorded for this pull request label Nov 17, 2026
Starting an agent host MCP server only requests the start. The host reports a startup
failure later as the server Error state, so the start request does not reject for it.

- Show the reported startup error in the MCP App placeholder, with the Start Server button.
- Show a notification only when the start request itself fails.

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-code-engineering

This comment has been minimized.

@connor4312
Connor Peet (connor4312) added this pull request to the merge queue Nov 17, 2026
@vs-code-engineering

Copy link
Copy Markdown
Contributor

Demo of cc8d0ae

Restored MCP Apps show startup errors and a Start Server button instead of waiting indefinitely.

Restored app with an unavailable server

Before (main) After (this pull request)
Reopening the same session only says the server isn't available yet, with no startup error or recovery button.
Reopening the same session only says the server isn't available yet, with no startup error or recovery button.
The app automatically tries starting its server, shows the startup error, and offers Start Server.
The app automatically tries starting its server, shows the startup error, and offers Start Server.

The change, on this pull request's build:

after.mp4
The same steps on main
before.mp4

Recorded by an agent on a build of this pull request merged with main, signed out, with a mock model. It can be wrong. Workflow run

Tip

Was this useful? React to this comment with 👍 or 👎.
On the VS Code team? Say what was wrong or missing.

Merged via the queue into main with commit fd1eba5 Nov 17, 2026
37 of 38 checks passed
@connor4312
Connor Peet (connor4312) deleted the connor4312/mcp-app-autostart branch November 17, 2026 23:39
@vs-code-engineering vs-code-engineering Bot added this to the 1.148.0 milestone Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-demo A PR demo was recorded for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants