Skip to content

Docs MCP URL normalization retains query strings and fragments #1618

Closed

Description

@betegon

Full docs URLs containing a query string or fragment can bypass the Markdown export. normalizeDocPath preserves ? and #, then fetchDocPage appends .md to the whole string.

For example, https://docs.sentry.io/platforms/javascript/#tracing produces a request with pathname /platforms/javascript/ and fragment #tracing.md. A query string similarly receives the suffix instead of the pathname. The fetcher accepts a successful HTML response and can cache it as Markdown for one hour.

Verified against the actual fetcher with mocked fetch/cache and no network calls. This is inherited from the original Worker, rather than introduced by the URL prefix-boundary correction in the port PR #1597.

Follow-up scope:

  • Strip query strings and fragments before suffix/trailing-slash normalization and use the resulting pathname for the .md request.
  • Cover full docs URLs and relative paths with query strings/fragments, including the outbound pathname and canonical citation URL.
  • Preserve the exact-origin boundary and existing supported path forms.

Keep this behavior change outside the migration PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MCPbug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions