Skip to content

fix: Add explicit type checks for MCP servers (http/sse)#487

Merged
benbrandt merged 1 commit intoagentclientprotocol:mainfrom
czp3009:main
Mar 27, 2026
Merged

fix: Add explicit type checks for MCP servers (http/sse)#487
benbrandt merged 1 commit intoagentclientprotocol:mainfrom
czp3009:main

Conversation

@czp3009
Copy link
Copy Markdown
Contributor

@czp3009 czp3009 commented Mar 27, 2026

As mentioned in #468 (comment)

IDEA always explicitly passes the MCP server type; for example, even if the type is stdio, IDEA will still pass type: 'stdio'.

This causes the following code to enter the http or sse branch due to the presence of the 'type' field

Image

As part of defensive programming, change this line to a more robust check:

if ("type" in server && (server.type === "http" || server.type === "sse"))

Copy link
Copy Markdown
Member

@benbrandt benbrandt left a comment

Choose a reason for hiding this comment

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

THanks!

@benbrandt benbrandt changed the title Add explicit type checks for MCP servers (http/sse) fix: Add explicit type checks for MCP servers (http/sse) Mar 27, 2026
@benbrandt benbrandt enabled auto-merge (squash) March 27, 2026 11:24
@benbrandt benbrandt merged commit e00a439 into agentclientprotocol:main Mar 27, 2026
1 check passed
benbrandt pushed a commit that referenced this pull request Mar 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.24.2](v0.24.1...v0.24.2)
(2026-03-27)


### Bug Fixes

* Add explicit type checks for MCP servers (http/sse)
([#487](#487))
([e00a439](e00a439))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
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