René's URL Explorer Experiment


Title: BearerTokenAuthMiddleware × serve(transport="both") — needs A2A sibling + serve(auth=...) shortcut · Issue #558 · adcontextprotocol/adcp-client-python · GitHub

Open Graph Title: BearerTokenAuthMiddleware × serve(transport="both") — needs A2A sibling + serve(auth=...) shortcut · Issue #558 · adcontextprotocol/adcp-client-python

X Title: BearerTokenAuthMiddleware × serve(transport="both") — needs A2A sibling + serve(auth=...) shortcut · Issue #558 · adcontextprotocol/adcp-client-python

Description: What BearerTokenAuthMiddleware is documented MCP-only (src/adcp/server/auth.py:62-65): "A2A uses a different transport; wire a2a-sdk's ServerCallContext.user via a2a-sdk auth middleware on that side." But adopters wiring a unified seller...

Open Graph Description: What BearerTokenAuthMiddleware is documented MCP-only (src/adcp/server/auth.py:62-65): "A2A uses a different transport; wire a2a-sdk's ServerCallContext.user via a2a-sdk auth middleware on that sid...

X Description: What BearerTokenAuthMiddleware is documented MCP-only (src/adcp/server/auth.py:62-65): "A2A uses a different transport; wire a2a-sdk's ServerCallContext.user via a2a-sdk auth middleware on...

Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/558

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BearerTokenAuthMiddleware × serve(transport=\"both\") — needs A2A sibling + serve(auth=...) shortcut","articleBody":"## What\n\n`BearerTokenAuthMiddleware` is documented MCP-only ([`src/adcp/server/auth.py:62-65`](https://github.com/adcontextprotocol/adcp-client-python/blob/main/src/adcp/server/auth.py#L62-L65)):\n\n> \"A2A uses a different transport; wire a2a-sdk's `ServerCallContext.user` via a2a-sdk auth middleware on that side.\"\n\nBut adopters wiring a unified seller via `serve(transport=\"both\")` only get the one ASGI middleware list — there's no first-class way to wire matching auth on the A2A leg through the framework.\n\nConcrete blast: when `BearerTokenAuthMiddleware` is passed via `asgi_middleware=[...]` on `serve(transport=\"both\")`, it wraps the whole binary including A2A's public `/.well-known/agent-card.json` discovery endpoint, so unauthenticated discovery requests get rejected with 401, breaking A2A buyer auto-discovery entirely.\n\n## Repro (production-shape, not toy)\n\nsalesagent's [`core/main.py`](https://github.com/prebid/salesagent/blob/main/core/main.py): one binary serving MCP + A2A from the same handler/router, one Principal table, one token validates both transports. Buyer just picks a protocol. We hit the same gap.\n\n## Workaround we shipped (with a real security cost)\n\nWe wrote a 30-line [`ScopedAuthMiddleware`](https://github.com/prebid/salesagent/blob/main/core/middleware/scoped_auth.py) that runs `BearerTokenAuthMiddleware` only on `/mcp/*` paths. **A2A is currently unauthenticated in our build.** That's a regression we accepted because the framework didn't give us a clean way to wire auth on both legs simultaneously, and we needed `/.well-known/agent-card.json` reachable for discovery. Filing this so we can drop the workaround.\n\n## What we'd want\n\n**Option (b) from a chat with @bokelley:** add an `A2ABearerAuthMiddleware` sibling (validates the same token shape but populates `ServerCallContext.user` rather than reading an HTTP header inline) plus a `serve(auth=...)` shortcut that wires both legs with one config:\n\n```python\nserve(\n    handler,\n    transport=\"both\",\n    auth=BearerTokenAuth(validate_token=_validate_token, header_name=\"x-adcp-auth\"),\n    ...,\n)\n```\n\nInternally `serve` mounts `BearerTokenAuthMiddleware` on the MCP leg and `A2ABearerAuthMiddleware` on the A2A leg from the single `auth=` config. Adopters who need transport-specific auth keep the lower-level path (separate middlewares per leg).\n\nConsidered alternatives:\n- **(a) Make `BearerTokenAuthMiddleware` transport-aware** — awkward, A2A's auth model is different in shape (a2a-sdk reads `ServerCallContext.user` populated upstream, not an HTTP header re-validated on every request). A transport-aware mux either reimplements both auth styles or shells out to two underlying middlewares — at which point you've reinvented (b) inside a wrapper.\n- **(c) Fail-fast if BearerTokenAuthMiddleware is used as outer ASGI middleware on `transport=\"both\"`** — punts; doesn't actually solve the problem.\n\n## Filed by\n\nsalesagent kill-nginx/M2 spike — surfaced in [`core/SDK_FEEDBACK.md`](https://github.com/prebid/salesagent/blob/main/core/SDK_FEEDBACK.md) round 3.","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-04T09:58:58Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/558"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3bf2da36-07a1-431c-feac-069f794ff464
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id803E:3D8CBB:C99803:10B6062:6B00F516
html-safe-noncebfe16c2542ca0220a7592e1a6725a49ad4d6f2ea650ab2245d1fede3f3d9e443
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDNFOjNEOENCQjpDOTk4MDM6MTBCNjA2Mjo2QjAwRjUxNiIsInZpc2l0b3JfaWQiOiI3Mzg5NzU0ODAzODIxMjc4NDg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac365704c5153f637b4a3699d9e1570d093acdcb5103860fe591639a9157996410
hovercard-subject-tagissue:4375598294
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/558/issue_layout
twitter:imagehttps://opengraph.githubassets.com/951e9d7c24cb71a587932677ae8f81004f3109ff637b12c46facdd0aface8288/adcontextprotocol/adcp-client-python/issues/558
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/951e9d7c24cb71a587932677ae8f81004f3109ff637b12c46facdd0aface8288/adcontextprotocol/adcp-client-python/issues/558
og:image:altWhat BearerTokenAuthMiddleware is documented MCP-only (src/adcp/server/auth.py:62-65): "A2A uses a different transport; wire a2a-sdk's ServerCallContext.user via a2a-sdk auth middleware on that sid...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebokelley
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
go-importgithub.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git
octolytics-dimension-user_id221690821
octolytics-dimension-user_loginadcontextprotocol
octolytics-dimension-repository_id1090305973
octolytics-dimension-repository_nwoadcontextprotocol/adcp-client-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1090305973
octolytics-dimension-repository_network_root_nwoadcontextprotocol/adcp-client-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/adcontextprotocol/adcp-client-python/issues/558#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F558
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F558
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=adcontextprotocol%2Fadcp-client-python
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/558
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/558
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/558
adcontextprotocolhttps://github.com/adcontextprotocol
adcp-client-pythonhttps://github.com/adcontextprotocol/adcp-client-python
Codehttps://github.com/adcontextprotocol/adcp-client-python
Issues44 (44)https://github.com/adcontextprotocol/adcp-client-python/issues
Pull requests13 (13)https://github.com/adcontextprotocol/adcp-client-python/pulls
Actionshttps://github.com/adcontextprotocol/adcp-client-python/actions
Projectshttps://github.com/adcontextprotocol/adcp-client-python/projects
Security and qualityhttps://github.com/adcontextprotocol/adcp-client-python/security
Insightshttps://github.com/adcontextprotocol/adcp-client-python/insights
https://github.com/adcontextprotocol/adcp-client-python
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/558
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/558
#566https://github.com/adcontextprotocol/adcp-client-python/pull/566
BearerTokenAuthMiddleware × serve(transport="both") — needs A2A sibling + serve(auth=...) shortcuthttps://github.com/adcontextprotocol/adcp-client-python/issues/558#top
#566https://github.com/adcontextprotocol/adcp-client-python/pull/566
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on May 4, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/558#issue-4375598294
src/adcp/server/auth.py:62-65https://github.com/adcontextprotocol/adcp-client-python/blob/main/src/adcp/server/auth.py#L62-L65
core/main.pyhttps://github.com/prebid/salesagent/blob/main/core/main.py
ScopedAuthMiddlewarehttps://github.com/prebid/salesagent/blob/main/core/middleware/scoped_auth.py
@bokelleyhttps://github.com/bokelley
core/SDK_FEEDBACK.mdhttps://github.com/prebid/salesagent/blob/main/core/SDK_FEEDBACK.md
bokelleyhttps://github.com/bokelley
claude-triagingTriage routine is actively working on this issue (1-3 min)https://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaging%22
on May 4, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/558#event-25126895601
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on May 4, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/558#issuecomment-4370153959
@bokelleyhttps://github.com/bokelley
https://claude.ai/code/session_01JjzyxPr67tTopkvA2VT4Xqhttps://claude.ai/code/session_01JjzyxPr67tTopkvA2VT4Xq
Claude Codehttps://claude.ai/code
bokelleyhttps://github.com/bokelley
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
claude-triagingTriage routine is actively working on this issue (1-3 min)https://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaging%22
on May 4, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/558#event-25127017681
bokelleyhttps://github.com/bokelley
completedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#566https://github.com/adcontextprotocol/adcp-client-python/pull/566
on May 4, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/558#event-25129784387
KonstantinMirinhttps://github.com/KonstantinMirin
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/558#event-25486670557
feat(auth): serve(auth=BearerTokenAuth(...)) — A2A sibling + cross-tr…https://github.com/KonstantinMirin/adcp-client-python/commit/4ead607712b2671569322bcdde4a9bfe34e31f06
https://docs.github.com/articles/closing-issues-via-commit-messages
4ead607https://github.com/KonstantinMirin/adcp-client-python/commit/4ead607712b2671569322bcdde4a9bfe34e31f06
Sign up for freehttps://github.com/signup?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/558
Sign in to commenthttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/558
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.