Skip to content

fix(mcp): name hosted server in client errors - #148

Merged
huangjeff5 merged 2 commits into
genkit-ai:mainfrom
yumin2002:fix-mcp-host-error-context
Dec 1, 2026
Merged

huangjeff5 merged 2 commits into
genkit-ai:mainfrom
yumin2002:fix-mcp-host-error-context

Conversation

@yumin2002

@yumin2002 yumin2002 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

This PR is ported from monorepo genkit-ai/genkit#7166 and addresses this issue: #204. When a server runs behind McpHost, three McpClient paths still identify it as a standalone client. Two hosts can each contain a server with the same name, so messages such as MCP client 'git' is closed do not identify which host failed.

Connection errors already include the host after genkit-ai/genkit#6930, which was ported here by genkit-ai/genkit#72, but client-level closed and restarted errors and the cross-event-loop close timeout warning do not.

Changes

  • Name hosted client lifecycle errors as MCP server <name> on host <host>, while preserving the existing standalone client text.
  • Log hosted close timeouts with server and host fields, while retaining client for standalone clients.
  • Cover both logging modes and pin the hosted reconnect and disconnect error messages.

@huangjeff5 huangjeff5 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified genkit-mcp client and host tests locally (107 passed). Hosted server lifecycle errors and close-timeout logs now consistently name both server and host while preserving standalone client messages. Looks good!

@huangjeff5
huangjeff5 enabled auto-merge (squash) November 30, 2026 21:29
@yumin2002

Copy link
Copy Markdown
Contributor Author

Thanks! Do you mind approving the 3 workflows when convenient? @huangjeff5

@huangjeff5
huangjeff5 merged commit a619bf6 into genkit-ai:main Dec 1, 2026
20 checks passed
@huangjeff5 huangjeff5 mentioned this pull request Dec 3, 2026
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