π Promote develop β main (@maxhealth.tech/mcp-http) - #22
Merged
Conversation
Closes #21, and the adoptable half of #18. #21 β the spec requires servers to validate Origin on all incoming connections and answer 403 when it is present and invalid, as a DNS-rebinding defence. We only omitted Access-Control-Allow-Origin, which stops the browser reading the response but not the server executing the request: the tool call had already run, which is the attack. isOriginAllowed() is separate from resolveOrigin() because that one answers what header to emit, not whether to serve at all. A test asserts the server factory is never invoked for a refused origin. Gated only at the MCP endpoint, and only when cors.origin is explicit. The "*" default and an absent Origin (non-browser caller) are unchanged, and the well-known routes stay publicly fetchable. #18 β the 401 challenge now comes from bearerAuthChallengeResponse. It adds error="invalid_token" and error_description, which RFC 6750 wants and the hand-rolled version omitted, plus an OAuth error body where there was none. Three tests asserted the exact WWW-Authenticate string and now match on substrings; that ordering was never part of the contract. #18's oauthMetadataResponse half stays open: it requires a full RFC 8414 document and this package holds only an issuer URL.
#5 asked for an integration test passing a request through server/discover plus a tool call. The tool call was covered when the delegation landed; this adds the discovery half, so the criterion is met rather than assumed.
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.
Automated PR β merging
developintomain.Merging publishes to npm: release.yml stamps the changelog, tags, and publishes.
Commits ahead of main: 2
Updated: 2026-08-07 16:43:13 UTC