-
Notifications
You must be signed in to change notification settings - Fork 815
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersready for workThe goal is clear and work towards it can be commencedThe goal is clear and work towards it can be commenced
Description
Bug description
It appears the implementation for StdioServerTransportProvider could potentially mismatch encodings between input and output.
The startOutboundProcessing method will always force the encoding to be UTF-8:
synchronized (outputStream) {
outputStream.write(jsonMessage.getBytes(StandardCharsets.UTF_8));
outputStream.write("\n".getBytes(StandardCharsets.UTF_8));
outputStream.flush();
}However, the startInboundProcessing method doesn't appear to specify an encoding when creating the InputStreamReader object, and so it could be subject to the default charset selected by the JRE:
reader = new BufferedReader(new InputStreamReader(inputStream));Environment
Testing with 0.10.0
Steps to reproduce
Running a STDIO-based MCP server with the JRE default charset set to something other than UTF-8.
Expected behavior
I'd expect charset/encoding handling should be consistent between input and output.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersready for workThe goal is clear and work towards it can be commencedThe goal is clear and work towards it can be commenced