mcpclient

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package mcpclient owns remote MCP discovery and invocation. It deliberately returns protocol-native JSON for tool results; the agent runtime separately derives model-facing and public projections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAuthenticationError

func IsAuthenticationError(err error) bool

Types

type AuthError

type AuthError struct {
	ServerName string
	Reason     string
}

AuthError identifies credential resolution and remote 401/403 failures.

func (*AuthError) Error

func (e *AuthError) Error() string

type AuthSource

type AuthSource = credentialruntime.AuthSource

type AuthenticatedClient

type AuthenticatedClient interface {
	DiscoverAuthenticated(context.Context, string, domain.MCPServer, AuthSource) ([]Tool, error)
	CallAuthenticated(context.Context, string, domain.MCPServer, string, map[string]any, AuthSource) (Result, error)
}

AuthenticatedClient is the optional authenticated extension used by the Temporal runtime. Keeping it separate preserves small test/client adapters.

type AuthenticatedRedirectError

type AuthenticatedRedirectError struct {
	From string
	To   string
}

AuthenticatedRedirectError prevents a bearer token and a replayable MCP request body from crossing an origin boundary.

func (*AuthenticatedRedirectError) Error

type BearerCredential

type BearerCredential = credentialruntime.BearerCredential

type Client

type Client interface {
	Discover(ctx context.Context, server domain.MCPServer) ([]Tool, error)
	Call(
		ctx context.Context,
		server domain.MCPServer,
		toolName string,
		input map[string]any,
	) (Result, error)
}

type Remote

type Remote struct {
	// contains filtered or unexported fields
}

func NewRemote

func NewRemote(httpClient *http.Client) *Remote

func (*Remote) Call

func (r *Remote) Call(
	ctx context.Context,
	server domain.MCPServer,
	toolName string,
	input map[string]any,
) (Result, error)

func (*Remote) CallAuthenticated

func (r *Remote) CallAuthenticated(
	ctx context.Context,
	sessionID string,
	server domain.MCPServer,
	toolName string,
	input map[string]any,
	authSource AuthSource,
) (Result, error)

func (*Remote) Discover

func (r *Remote) Discover(
	ctx context.Context,
	server domain.MCPServer,
) ([]Tool, error)

func (*Remote) DiscoverAuthenticated

func (r *Remote) DiscoverAuthenticated(
	ctx context.Context,
	sessionID string,
	server domain.MCPServer,
	authSource AuthSource,
) ([]Tool, error)

func (*Remote) ValidateBearer

func (r *Remote) ValidateBearer(
	ctx context.Context,
	mcpServerURL string,
	bearer string,
) (credentialruntime.MCPProbeResult, error)

ValidateBearer performs the same initialize and tools/list handshake used by runtime discovery while retaining a bounded, scrubbed projection of the response that failed. It never returns the bearer in a result or error.

type Result

type Result struct {
	Raw     json.RawMessage
	IsError bool
}

type Tool

type Tool struct {
	Name         string
	Description  string
	InputSchema  map[string]any
	OutputSchema any
}

Jump to

Keyboard shortcuts

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