-
Notifications
You must be signed in to change notification settings - Fork 138
Closed
Description
var withValidate = func(h mcp.MethodHandler[*mcp.ServerSession]) mcp.MethodHandler[*mcp.ServerSession] {
return func(ctx context.Context, s *mcp.ServerSession, method string, params mcp.Params) (result mcp.Result, err error) {
if method != "tools/call" {
return h(ctx, s, method, params)
}
token := request.Header.Get(AuthorizationHeader)
golib.Log("info", "token:%s added to ctx, seesionId: %s", token, s.ID())
ctx = context.WithValue(ctx, "token", token)
return h(ctx, s, method, params)
}
}
o.svr.AddReceivingMiddleware(withValidate)
return o.svr
}, nil)
when several requests from different process with dfferent token sent to the server , finally if i send a toolcall request, the middleware log happened 12 times, and the token has been covered many times?
is this a bug?
Or may be i can't do something like this.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working