Documentation
¶
Overview ¶
Package mcpcontext provides context helpers for MCP session state. These are in a separate package to avoid import cycles between middleware and toolkit packages.
Index ¶
- func GetAuthToken(ctx context.Context) string
- func GetProgressToken(ctx context.Context) any
- func GetServerSession(ctx context.Context) *mcp.ServerSession
- func WithAuthToken(ctx context.Context, token string) context.Context
- func WithProgressToken(ctx context.Context, token any) context.Context
- func WithServerSession(ctx context.Context, ss *mcp.ServerSession) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthToken ¶ added in v1.78.0
GetAuthToken retrieves the inbound authentication token from the context, or "" when none was set.
func GetProgressToken ¶
GetProgressToken retrieves the progress token from the context.
func GetServerSession ¶
func GetServerSession(ctx context.Context) *mcp.ServerSession
GetServerSession retrieves the ServerSession from the context.
func WithAuthToken ¶ added in v1.78.0
WithAuthToken stores the inbound authentication token (the bearer or API key that authenticated the MCP session) on the context. It lives here, rather than in pkg/middleware, so toolkit packages can read it without importing middleware (which would form an import cycle). The auth middleware writes it; the api-gateway toolkit reads it to forward the acting caller's identity on identity-passthrough connections.
func WithProgressToken ¶
WithProgressToken adds a progress token to the context.
func WithServerSession ¶
WithServerSession adds a ServerSession to the context.
Types ¶
This section is empty.