MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / stampAuth

Method stampAuth

internal/mcp/server.go:149–157  ·  view source on GitHub ↗

stampAuth attaches the configured bearer and authorizer URL to the outgoing gRPC call. A no-op when neither is set. This is the bridge that lets gRPC handlers see "who is calling" (security audit H1) and which host minted the token (issuer validation) when invoked from MCP.

(ctx context.Context)

Source from the content-addressed store, hash-verified

147// lets gRPC handlers see "who is calling" (security audit H1) and which
148// host minted the token (issuer validation) when invoked from MCP.
149func (s *Server) stampAuth(ctx context.Context) context.Context {
150 if s.bearer != "" {
151 ctx = metadata.AppendToOutgoingContext(ctx, "authorization", "Bearer "+s.bearer)
152 }
153 if s.authorizerURL != "" {
154 ctx = metadata.AppendToOutgoingContext(ctx, "x-authorizer-url", s.authorizerURL)
155 }
156 return ctx
157}
158
159// registerTool wires one ToolBinding into the MCP server. The handler:
160// 1. Constructs a fresh proto.Message of the right type via dynamicpb

Callers 2

registerToolMethod · 0.95
TestStampAuthFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestStampAuthFunction · 0.76