Remove Forwarding Methods & Fix SSE Parsing#2647
Merged
crivetimihai merged 2 commits intomainfrom Feb 11, 2026
Merged
Conversation
Member
|
Good cleanup — removing the silent LGTM — ready to merge. |
Remove deprecated forward_request, _forward_request_to_gateway, and _forward_request_to_all methods from gateway_service.py. Replace forwarding fallbacks in main.py with proper JSON-RPC error responses. Fix SSE parser in llm_proxy_service.py and translate.py to handle data: lines with or without a space after the colon, per the SSE spec. Closes #1595 Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Simplify except (ValueError, Exception) to except Exception since ValueError is a subclass of Exception. Update SSE data: line parsing in integration and e2e tests to match the spec-correct pattern used in production code. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
d09179d to
055e7c3
Compare
Member
Rebase & Review NotesRebased onto current Issues found and fixed
Review assessment
|
crivetimihai
approved these changes
Feb 11, 2026
ja8zyjits
pushed a commit
that referenced
this pull request
Feb 13, 2026
* fix: remove deprecated forwarding methods and fix SSE data parsing Remove deprecated forward_request, _forward_request_to_gateway, and _forward_request_to_all methods from gateway_service.py. Replace forwarding fallbacks in main.py with proper JSON-RPC error responses. Fix SSE parser in llm_proxy_service.py and translate.py to handle data: lines with or without a space after the colon, per the SSE spec. Closes #1595 Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * fix: clean up redundant except clause and align SSE parsing in tests Simplify except (ValueError, Exception) to except Exception since ValueError is a subclass of Exception. Update SSE data: line parsing in integration and e2e tests to match the spec-correct pattern used in production code. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
vishu-bh
pushed a commit
that referenced
this pull request
Feb 18, 2026
* fix: remove deprecated forwarding methods and fix SSE data parsing Remove deprecated forward_request, _forward_request_to_gateway, and _forward_request_to_all methods from gateway_service.py. Replace forwarding fallbacks in main.py with proper JSON-RPC error responses. Fix SSE parser in llm_proxy_service.py and translate.py to handle data: lines with or without a space after the colon, per the SSE spec. Closes #1595 Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * fix: clean up redundant except clause and align SSE parsing in tests Simplify except (ValueError, Exception) to except Exception since ValueError is a subclass of Exception. Update SSE data: line parsing in integration and e2e tests to match the spec-correct pattern used in production code. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com> Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
* fix: remove deprecated forwarding methods and fix SSE data parsing Remove deprecated forward_request, _forward_request_to_gateway, and _forward_request_to_all methods from gateway_service.py. Replace forwarding fallbacks in main.py with proper JSON-RPC error responses. Fix SSE parser in llm_proxy_service.py and translate.py to handle data: lines with or without a space after the colon, per the SSE spec. Closes IBM#1595 Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * fix: clean up redundant except clause and align SSE parsing in tests Simplify except (ValueError, Exception) to except Exception since ValueError is a subclass of Exception. Update SSE data: line parsing in integration and e2e tests to match the spec-correct pattern used in production code. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐛 Bug-fix PR
Closes #1595
📌 Summary
Addressed two distinct items:
Federation Cleanup: Removes the deprecated
forward_request,_forward_request_to_gateway, and_forward_request_to_allmethods from gateway_service.py. This finalizes the removal of the unused "Federation" logic as tracked in Issue:[CHORE]: Cleanup unused Federation module and duplicate Forwarding logic #1912.
SSE Parsing Fix: Updates the SSE parser in llm_proxy_service.py to correctly handle data: lines that are missing a space after the colon (e.g., data:{"key": "value"}).
🔁 Reproduction Steps
1. Federation/Forwarding Removal:
mcpgateway/services/gateway_service.pyto see the methods are removed.2. SSE Parsing Bug:
🐞 Root Cause
1. Forwarding: The forwarding logic was legacy code from the "Federation" module which has been deprecated. It was duplicating logic handled by ToolService and was no longer wired correctly into the application lifecycle. This federation/forwarding logic is removed but some functions still existed in gateway_service.py for forwarding to other gateways (this feature is deprecated now.)
2. SSE Parsing: The existing parser assumed a strict data: prefix (with space). While the spec recommended a space, some providers/implementations omit it, causing orjson.loads to fail on the malformed string.
💡 Fix Description
References:
🧪 Verification
make lintmake testmake coverage📐 MCP Compliance (if relevant)
✅ Checklist
make black isort pre-commit)