You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current asgi_middleware: Sequence[tuple[type, dict[str, Any]]] parameter is loose-typed and forces adopters to wrap functional middleware in a class just to fit the tuple shape.
Accept callable factories alongside the tuple form. Branch on isinstance(entry, tuple) in _apply_asgi_middleware.
Acceptance Criteria
asgi_middleware accepts both tuple[type, dict] (current) and Callable[[ASGIApp], ASGIApp] factories
_apply_asgi_middleware branches on isinstance(entry, tuple)
Classification: Feature request Bucket(s): handlers Status: drafting-pr Milestone: (omitted — no target version specified)
What the experts said:
code-reviewer: approved — no blockers; noted stdio silent-drop (fixed with logger.warning) and that the commit title should reflect this is a net-new param
dx-expert: one blocker fixed — widened type → Callable[..., Any] in tuple annotation so functools.partial as the tuple's first element passes mypy; also exported ASGIMiddlewareEntry from adcp.server to mirror SkillMiddleware
My take: The feature is net-new on the current main (no pre-existing asgi_middleware param). The issue's acceptance criteria map cleanly to the implementation: _apply_asgi_middleware branches on isinstance(entry, tuple), both forms compose outermost-first, type signature uses a named ASGIMiddlewareEntry alias. Non-breaking and fully testable.
Drafting PR: add asgi_middleware: Sequence[ASGIMiddlewareEntry] | None to serve(), thread it through _serve_mcp → _run_mcp_http and _serve_a2a, add _apply_asgi_middleware helper, 6 new tests.
Activity
bokelley commentedon May 3, 2026
Triage
Classification: Feature request
Bucket(s): handlers
Status: drafting-pr
Milestone: (omitted — no target version specified)
What the experts said:
logger.warning) and that the commit title should reflect this is a net-new paramtype→Callable[..., Any]in tuple annotation sofunctools.partialas the tuple's first element passes mypy; also exportedASGIMiddlewareEntryfromadcp.serverto mirrorSkillMiddlewareMy take: The feature is net-new on the current
main(no pre-existingasgi_middlewareparam). The issue's acceptance criteria map cleanly to the implementation:_apply_asgi_middlewarebranches onisinstance(entry, tuple), both forms compose outermost-first, type signature uses a namedASGIMiddlewareEntryalias. Non-breaking and fully testable.Drafting PR: add
asgi_middleware: Sequence[ASGIMiddlewareEntry] | Nonetoserve(), thread it through_serve_mcp→_run_mcp_httpand_serve_a2a, add_apply_asgi_middlewarehelper, 6 new tests.→ Draft PR: #441
Triaged by Claude Code. Session: https://claude.ai/code/session_01GttQNCHuVSVUyRW5knbitw
Generated by Claude Code
feat(server): asgi_middleware accepts Callable factories alongside tu…
feat(server): add asgi_middleware param to serve() (#441)