-
Notifications
You must be signed in to change notification settings - Fork 9
Invalid MCP Server instantiation fails poorly #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
#4 is likely related to this as well |
In this case, the first message from the server is an invalid one (not JSON), I am a bit surprised we aren't seeing some other sort of error bubble up here. |
Ok, so json_rpc_2 automatically handles invalid messages by sending a notification message back to the server that it had sent an invalid request. So, the client never sees this message and it sends an initialize request. The server then exits, and then we get the error about the connection closing with the pending initialize request. We don't really have a good opportunity to see the actual bad output at all because it's intercepted by the json_rpc_2 package, we may want to add something to that package to allow you to see these. I did recently resolve #4 which allows you to see all protocol traffic which should help generally resolve this, but you have to explicitly pass a sink on which to emit these messages. |
Related to #96 - Tests the current behavior, ensures we aren't leaking exceptions beyond what is expected. - Also documents explicitly the behavior in initialize to encourage exception handling, and helping you to debug.
Silly question, what happens with |
Related to dart-lang#96 - Tests the current behavior, ensures we aren't leaking exceptions beyond what is expected. - Also documents explicitly the behavior in initialize to encourage exception handling, and helping you to debug.
I was attempting to run an MCP server incorrectly. It exited with an error message. This error message was not surfaced by the MCP Client sample code.
The simplified code is as follows. For context, the
mcp_server
requires a command line argument that is not supplied here.For context, attempting to run the server incorrectly failed as follows:
Can we please expose this error text as part of the bad state exception?
The text was updated successfully, but these errors were encountered: