Simplify error response when accessing MCP without session ID
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start at HttpServletStreamableServerTransportProvider.java around line 264 and inspect the GET handling for requests without an mcp-session-id header. Reproduce the request described in the issue, then verify the response gives a simple request or session-ID message without exposing the exception stack trace.
Written by the indexing model from the issue text.
Description
Description:
Currently, when accessing the MCP Streamable HTTP server at https://host:port/mcp without providing a session ID, the server responds with the full exception stack trace and detailed error information.
Issue:
Returning the complete stack trace in the response is not user-friendly and may expose internal details unnecessarily.
Suggestion:
Instead of returning the full error, return a simple, clear message indicating there is an issue with the request headers or the session ID
stack trace
{
"cause": null,
"stackTrace": [
{
"moduleName": null,
"moduleVersion": null,
"classLoaderName": null,
"methodName": "doGet",
"fileName": "HttpServletStreamableServerTransportProvider.java",
"lineNumber": 268,
"className": "com.ibm.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider",
"nativeMethod": false
},
{
"moduleName": null,
"moduleVersion": null,
"classLoaderName": null,
"methodName": "service",
"fileName": "HttpServlet.java",
"lineNumber": 527,
"className": "jakarta.servlet.http.HttpServlet",
"nativeMethod": false
},
{
"moduleName": null,
"moduleVersion": null,
"classLoaderName": null,
"methodName": "service",
"fileName": "HttpServlet.java",
"lineNumber": 614,
"className": "jakarta.servlet.http.HttpServlet",
"nativeMethod": false
}
],
"jsonRpcError": null,
"message": "text/event-stream required in Accept header; Session ID required in mcp-session-id header",
"localizedMessage": "text/event-stream required in Accept header; Session ID required in mcp-session-id header",
"suppressed": []
}
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 1.1k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/java-sdk
-
area/transport bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
modelcontextprotocol/java-sdk#1136 ·
-
area/client bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/java-sdk#1124 · 1 comment ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities Openbug P2 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/java-sdk#1086 · 1 comment ·
-
enhancement good first issue P3
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
modelcontextprotocol/java-sdk#898 · 1 comment ·
All issues in modelcontextprotocol/java-sdk
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
puj-course/FIS_2630_1204_G1#294 ·