π Bug Summary
The ssl context is created explicitly even for non-ssl tools
π§© Affected Component
Select the area of the project impacted:
π Steps to Reproduce
- Run with compose-up or serve (single worker)
- Run sudo uv py-spy --pid
- Run tool call multiple times
- Collect the output (svg or speedscope format)
Check the "heavy left" or "sandwich": create_default_context takes 49% (depends on the test, 1000 tool call requests)
π€ Expected Behavior
The 49% is too much, should be less.
π Logs / Error Output
Paste any relevant stack traces or logs here.
β οΈ Do not paste secrets, credentials, or tokens.
π§ Environment Info
You can retrieve most of this from the /version endpoint.
| Key |
Value |
| Version or commit |
commit a02ac5e |
| Runtime |
Python 3.12, Uvicorn` |
| Platform / OS |
Fedora 43 |
| Container |
make dev |
π§© Additional Context (optional)
tool_service.py creates ssl context on every tool call and for plain http connections as well.
The MCP_SESSION_POOL_ENABLED=true does not help, it seems.
The probable fix is to avoid creating context at least for plain http, ideally use pooled connection.
The line: async def connect_to_sse_server(server_url: str, headers: dict = headers) looks like anti-pattern with possible data leak - shared headers the suggested fix is to use None as default and create copy of headers in function body.
π Bug Summary
The ssl context is created explicitly even for non-ssl tools
π§© Affected Component
Select the area of the project impacted:
mcpgateway- APImcpgateway- UI (admin panel)mcpgateway.wrapper- stdio wrapperπ Steps to Reproduce
Check the "heavy left" or "sandwich": create_default_context takes 49% (depends on the test, 1000 tool call requests)
π€ Expected Behavior
The 49% is too much, should be less.
π Logs / Error Output
Paste any relevant stack traces or logs here.
β οΈ Do not paste secrets, credentials, or tokens.
π§ Environment Info
You can retrieve most of this from the
/versionendpoint.π§© Additional Context (optional)
tool_service.py creates ssl context on every tool call and for plain http connections as well.
The MCP_SESSION_POOL_ENABLED=true does not help, it seems.
The probable fix is to avoid creating context at least for plain http, ideally use pooled connection.
The line: async def connect_to_sse_server(server_url: str, headers: dict = headers) looks like anti-pattern with possible data leak - shared headers the suggested fix is to use None as default and create copy of headers in function body.