Hello, I run an MCP server that proxies an internal HTTP API: every tool forwards the caller's bearer token upstream, so the token is both the gate and an input to each tool.
prependSecurity handles the gate well. But per docs/server/transport.md#security:
The result of the security logic does not reach the tool logic. If a tool needs data from the caller, read the request headers with handleWithHeaders (or serverLogic with headers).
So each tool re-reads the Authorization header and re-handles the missing-token case the gate already rejected (unreachable branch in every tool), and header parsing lives in two places that can drift apart.
Tapir's serverSecurityLogic covers this by deriving a typed principal once and handing it to the main logic. Do you think it would make sense to add an equivalent for Chimp, or is there a recommended pattern I've missed?
Hello, I run an MCP server that proxies an internal HTTP API: every tool forwards the caller's bearer token upstream, so the token is both the gate and an input to each tool.
prependSecurityhandles the gate well. But per docs/server/transport.md#security:So each tool re-reads the Authorization header and re-handles the missing-token case the gate already rejected (unreachable branch in every tool), and header parsing lives in two places that can drift apart.
Tapir's
serverSecurityLogiccovers this by deriving a typed principal once and handing it to the main logic. Do you think it would make sense to add an equivalent for Chimp, or is there a recommended pattern I've missed?