Documentation
¶
Index ¶
- Variables
- func ConvertToMap(v any) any
- func GetDependencyVersion(modulePath string) string
- func InitDiagnostics(projectID string, disabled bool, integration, mcpSDKPath string)
- func InitPublisher(redactFn RedactFunc, apiBaseURL string) func(evt *Event)
- func LogSetupComplete(projectID string, opts *Options)
- func LogSetupFailed(reason string)
- func NewEventID() string
- func NewSessionID() string
- func Ptr[T any](v T) *T
- func RedactEvent(evt *Event, redactFn RedactFunc) error
- func RegisterServer(server any, instance *MCPcatInstance)
- func ResetDiagnosticsForTest()
- func ResolveAPIBaseURL(optionURL string) string
- func SetDebug(debug bool)
- func Shutdown(ctx context.Context) error
- func UnregisterServer(server any)
- type Event
- type Exporter
- type ExporterConfig
- type IDPrefix
- type MCPcatInstance
- type Options
- type ProtectedSession
- type RedactFunc
- type Session
- type SessionMap
- type UserIdentity
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilServer = errors.New("mcpcat: server must not be nil") ErrEmptyProjectID = errors.New("mcpcat: projectID must not be empty") )
Sentinel errors for Track validation.
Functions ¶
func ConvertToMap ¶
ConvertToMap converts any value to map[string]any or []any via JSON round-trip.
func GetDependencyVersion ¶
GetDependencyVersion returns the version of the given module from build info, or "dev" if the module is not found.
func InitDiagnostics ¶
InitDiagnostics initializes internal SDK diagnostics and emits the setup-start beacon. Call it early in Track — before validation — so setup failures are captured. Idempotent across the process.
func InitPublisher ¶
func InitPublisher(redactFn RedactFunc, apiBaseURL string) func(evt *Event)
InitPublisher initializes the global event publisher and returns a publish function. The returned function can be called to publish events asynchronously. If apiBaseURL is empty, the default MCPCat API URL is used.
func LogSetupComplete ¶
LogSetupComplete emits the setup-complete beacon (metadata only).
func LogSetupFailed ¶
func LogSetupFailed(reason string)
LogSetupFailed logs a setup failure as ERROR so it surfaces in diagnostics.
func NewEventID ¶
func NewEventID() string
NewEventID generates a new unique event ID with the MCPCat prefix.
func NewSessionID ¶
func NewSessionID() string
NewSessionID generates a new unique session ID with the MCPCat prefix.
func Ptr ¶
func Ptr[T any](v T) *T
Ptr returns a pointer to the given value. Convenience helper for integration modules.
func RedactEvent ¶
func RedactEvent(evt *Event, redactFn RedactFunc) error
RedactEvent applies the redaction function to sensitive fields in the event.
func RegisterServer ¶
func RegisterServer(server any, instance *MCPcatInstance)
RegisterServer stores the MCPcat instance for a given server in the global registry.
func ResetDiagnosticsForTest ¶
func ResetDiagnosticsForTest()
ResetDiagnosticsForTest resets internal diagnostics + logging sink state. For tests.
func ResolveAPIBaseURL ¶
ResolveAPIBaseURL returns the API base URL to use, applying the priority: code option > MCPCAT_API_URL env var > empty string (publisher uses default).
func Shutdown ¶
Shutdown gracefully shuts down the global event publisher. This should be called when the application is shutting down to ensure all queued events are published before exit. The provided context controls the shutdown deadline; if no deadline is set, a default 5-second timeout is applied.
func UnregisterServer ¶
func UnregisterServer(server any)
UnregisterServer removes a server from the global registry.
Types ¶
type Event ¶
func CreateIdentifyEvent ¶
CreateIdentifyEvent creates an Event for mcpcat:identify event type.
type ExporterConfig ¶
type ExporterConfig = core.ExporterConfig
type IDPrefix ¶
const ( PrefixSession IDPrefix = core.PrefixSession PrefixEvent IDPrefix = core.PrefixEvent )
type MCPcatInstance ¶
type MCPcatInstance = core.MCPcatInstance
func GetInstance ¶
func GetInstance(server any) *MCPcatInstance
GetInstance retrieves the MCPcat instance for a given server from the global registry.
type ProtectedSession ¶
type ProtectedSession = sessionmap.ProtectedSession
type RedactFunc ¶
type RedactFunc = core.RedactFunc
type SessionMap ¶
type SessionMap = sessionmap.SessionMap
func NewSessionMap ¶
func NewSessionMap(ttl time.Duration) *SessionMap
NewSessionMap creates a session map with TTL-based eviction. If ttl is 0, a 30-minute default is used.
type UserIdentity ¶
type UserIdentity = core.UserIdentity
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
diagnostics
Package diagnostics mirrors the SDK's internal operational logs to MCPCat's monitoring as OTLP/HTTP log records.
|
Package diagnostics mirrors the SDK's internal operational logs to MCPCat's monitoring as OTLP/HTTP log records. |
|
logging
Package logging provides internal logging utilities for MCPCat.
|
Package logging provides internal logging utilities for MCPCat. |
|
sessionmap
Package sessionmap provides a TTL-based session store that both adapters use.
|
Package sessionmap provides a TTL-based session store that both adapters use. |
|
testutil
Package testutil provides common testing utilities shared across test files
|
Package testutil provides common testing utilities shared across test files |
|
mcpgo
module
|
|
|
officialsdk
module
|