[Bug] [BanyanDB] MCP HTTP server rejects a lowercase "bearer" Authorization scheme

Đang mở
#14,199 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@UchihaIthachi đang làm issue này rồi.

Từ ngày 6/11/2026.

  • #1462 của @UchihaIthachi — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug database
Search before asking
  • I had searched in the issues and found no similar issues.
Apache SkyWalking Component

BanyanDB (apache/skywalking-banyandb)

What happened

While looking at the MCP server after #14194, I tried HTTP mode with a token and noticed that Authorization: bearer <token> (lowercase) gets a 401 even when the token is right. Only the exact Bearer prefix works, because getAuthorizationToken in mcp/src/server/http.ts uses startsWith('Bearer ').

What you expected to happen

The auth scheme name is case-insensitive (RFC 9110 section 11.1, which RFC 6750 uses for Bearer), so bearer or BEARER with the right token should be accepted. Some HTTP clients and proxies send it in lowercase, and a 401 there is confusing because the token itself is correct.

How to reproduce

On main (27349fdf), in mcp/ (BanyanDB doesn't need to be running for this):

TRANSPORT=http MCP_AUTH_TOKEN=secret MCP_PORT=3999 npx tsx src/index.ts &
curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:3999/mcp \
  -H 'Authorization: bearer secret' -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"ping"}'
# 401
curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:3999/mcp \
  -H 'Authorization: Bearer secret' -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"ping"}'
# 200
Anything else

Canopy in the same repo already handles this: bearerCredential in canopy/server/src/lib/tokens.ts matches the scheme case-insensitively. So the fix is to do the same in the MCP server, with unit tests for the header parsing. I have it ready and will link the PR here.

Are you willing to submit a pull request to fix on your own?
  • Yes I am willing to submit a pull request on my own!
Code of Conduct
Ngôn ngữ chính
Java
Star
25k
Fork
6.6k
Merge trung bình
12 giờ 57 phút
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/skywalking

Tất cả issue của apache/skywalking

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.