Skip to content

Provide better diagnostics than "The server shut down unexpectedly." #362

Closed
@AArnott

Description

@AArnott

When an MCP server fails to initialize, McpClientFactory.CreateAsync throws InvalidOperationException: 'The server shut down unexpectedly.'

No additional information is provided in the exception. We need to do better. We need to explain to the user what went wrong so that users can understand and fix the issue.

In one case, for example, the local server config was to run the following command:

docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server

All I got back was the above exception. But when I run it from the command line, I get much more useful data:

docker: error during connect: Head "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/_ping": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.

Run 'docker run --help' for more information

That actually gives me a clue that somehow my docker engine isn't running. I launched Docker Desktop, and retried. Sure enough, it works.

But at the moment, this info is inaccessible to users running in Visual Studio.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions