fix: correct endpoint selection for streamable HTTP auto-registration#29
Open
ABruneel04 wants to merge 2 commits intocontextforge-org:mainfrom
Open
fix: correct endpoint selection for streamable HTTP auto-registration#29ABruneel04 wants to merge 2 commits intocontextforge-org:mainfrom
ABruneel04 wants to merge 2 commits intocontextforge-org:mainfrom
Conversation
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.
Description
Summary
Fixes auto-registration endpoint selection when using
--expose-streamable-httpflag. The system was incorrectly attempting to register at the/sseendpoint instead of/mcpfor Streamable HTTP connections.Problem
When running
cforge runwith the--expose-streamable-httpflag, auto-registration failed with a 404 error because the system attempted to register at the/sseendpoint, which doesn't exist for Streamable HTTP servers.Solution
Updated the boolean logic in
cforge/commands/server/run.pyto correctly determine the endpoint type:Before:
After:
This ensures:
--expose-streamable-httpis enabled → uses/mcpendpoint--expose-sseis enabled → uses/sseendpoint/sseendpoint (SSE takes priority)/sseendpointTesting
Added comprehensive test coverage for all endpoint selection scenarios:
test_run_registration_with_streamable_http_only- Verifies/mcpendpoint is used when only streamable HTTP is enabledtest_run_registration_with_both_protocols_defaults_to_sse- Verifies SSE takes priority when both protocols are enabledtest_run_registration_without_protocol_flags_defaults_to_sse- Verifies SSE is the default when no flags are specifiedLive Testing: Tested end-to-end with the original failing command to confirm the fix resolves the auto-registration issue.
Changes
cforge/commands/server/run.py- Fixed endpoint selection logictests/commands/server/test_run.pyCloses
Closes #27
Type of Change
Checklist
git commit -s)