mcpcontext

package
v1.78.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthToken added in v1.78.0

func GetAuthToken(ctx context.Context) string

GetAuthToken retrieves the inbound authentication token from the context, or "" when none was set.

func GetProgressToken

func GetProgressToken(ctx context.Context) any

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

func WithAuthToken(ctx context.Context, token string) context.Context

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

func WithProgressToken(ctx context.Context, token any) context.Context

WithProgressToken adds a progress token to the context.

func WithServerSession

func WithServerSession(ctx context.Context, ss *mcp.ServerSession) context.Context

WithServerSession adds a ServerSession to the context.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL