Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.24.1 Latest Latest
Warning

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

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

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 MCP client configuration extracted from Viant Agently Core.

SPDX-License-Identifier: Apache-2.0 MCP client configuration extracted from Viant Agently Core.

SPDX-License-Identifier: Apache-2.0 MCP client configuration extracted from Viant Agently Core.

SPDX-License-Identifier: Apache-2.0 MCP client configuration extracted from Viant Agently Core.

SPDX-License-Identifier: Apache-2.0 MCP client configuration extracted from Viant Agently Core.

Index

Constants

View Source
const (
	ToolsListVisibilityPublic  = "public"
	ToolsListVisibilityPrivate = "private"
)
View Source
const ResourceCacheConversation = "conversation"
View Source
const ResourceCachePublic = "public"
View Source
const ResourceCacheUser = "user"

Variables

This section is empty.

Functions

func OutputArtifactPointer

func OutputArtifactPointer(path string) ([]string, error)

OutputArtifactPointer accepts only bounded RFC 6901 pointers into the raw MCP result's content or structuredContent, with no expression syntax.

func Upstreams

func Upstreams(meta map[string]interface{}) map[string]Upstream

Upstreams extracts upstream definitions from metadata.

func ValidateResourceRoots

func ValidateResourceRoots(meta map[string]interface{}) []string

ValidateResourceRoots returns warnings for invalid resource root settings.

Types

type BrowserDescriptor

type BrowserDescriptor struct {
	Name              string                    `json:"name"`
	ExecutionLocation string                    `json:"executionLocation"`
	Transport         BrowserTransport          `json:"transport"`
	AllowedTools      []string                  `json:"allowedTools"`
	OutputArtifacts   map[string]OutputArtifact `json:"outputArtifacts,omitempty"`
}

type BrowserTransport

type BrowserTransport struct {
	Type             string `json:"type" yaml:"type"`
	ExtensionID      string `json:"extensionId" yaml:"extensionId"`
	PortName         string `json:"portName" yaml:"portName"`
	RequestTimeoutMs int    `json:"requestTimeoutMs,omitempty" yaml:"requestTimeoutMs,omitempty"`
}

BrowserTransport contains only public transport addressing. Auth, commands, cookies, headers and server-side credentials never belong in this descriptor.

type Group

type Group[T any] struct {
	URL   string `yaml:"url,omitempty" json:"url,omitempty"`
	Items []T    `yaml:"items,omitempty" json:"items,omitempty"`
}

Group is a simple list wrapper used by config with an optional URL root.

type MCPClient

type MCPClient struct {
	// MetadataCacheIgnoredCookies lists explicitly known routing-only cookies.
	// They are still sent normally; only metadata cache identity ignores them.
	// Never include authentication or application-session cookies. Empty tracks all cookies.
	MetadataCacheIgnoredCookies []string `json:"metadataCacheIgnoredCookies,omitempty" yaml:"metadataCacheIgnoredCookies,omitempty"`

	ResolvedIdentity  *ResolvedServiceIdentity `json:"-" yaml:"-"`
	ExecutionLocation string                   `json:"executionLocation,omitempty" yaml:"executionLocation,omitempty"`
	BrowserTransport  *BrowserTransport        `json:"browserTransport,omitempty" yaml:"browserTransport,omitempty"`
	BrowserTools      []string                 `json:"browserTools,omitempty" yaml:"browserTools,omitempty"`
	// PrimitiveNamespaces optionally narrows discovered provider namespaces.
	// An empty list accepts the namespaces authorized by the provider.
	PrimitiveNamespaces []string `yaml:"primitiveNamespaces,omitempty" json:"primitiveNamespaces,omitempty"`
	// PrimitiveProviderIdentity optionally pins a provider instance. Replacing
	// an observed instance on an existing connection requires this declaration.
	PrimitiveProviderIdentity string `yaml:"primitiveProviderIdentity,omitempty" json:"primitiveProviderIdentity,omitempty"`
	*mcp.ClientOptions        `yaml:",inline" json:",inline"`
	SkillDiscovery            *SkillDiscovery        `yaml:"skillDiscovery,omitempty" json:"skillDiscovery,omitempty"`
	Async                     []*asynccfg.Config     `yaml:"async,omitempty" json:"async,omitempty"`
	Descriptions              map[string]string      `yaml:"descriptions,omitempty" json:"descriptions,omitempty"`
	Metadata                  map[string]interface{} `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	// OutputArtifacts captures configured binary outputs before tool results
	// reach model context. Keys are exact, literal MCP tool names.
	OutputArtifacts map[string]OutputArtifact `yaml:"outputArtifacts,omitempty" json:"outputArtifacts,omitempty"`
	// Cacheable marks specific tools on this MCP server as eligible for
	// prompt-history supersession. Keys are tool names (exact match);
	// values indicate cacheability.
	Cacheable map[string]bool `yaml:"cacheable,omitempty" json:"cacheable,omitempty"`
	// ToolTimeoutSec overrides the default tool execution timeout when invoking
	// tools on this MCP server. When zero, a system default applies.
	ToolTimeoutSec int `yaml:"toolTimeoutSec,omitempty" json:"toolTimeoutSec,omitempty"`
	// DisableDelegatedAuth is the MCP-level delegated-auth kill switch. When
	// set on a server whose auth.mode is oauth, client creation fails with a
	// typed provider-disabled error; it never silently falls back to
	// workspace credentials.
	DisableDelegatedAuth bool `yaml:"disableDelegatedAuth,omitempty" json:"disableDelegatedAuth,omitempty"`
	// EagerLink asks an interactive Agently client to establish delegated OAuth
	// when this MCP server is first selected for use, before calling it remotely.
	// Discovery and workspace startup must not initiate the authorization flow.
	EagerLink bool `yaml:"eagerLink,omitempty" json:"eagerLink,omitempty"`
	// ToolsListVisibility declares whether tools/list is public workspace
	// metadata or private principal-scoped metadata. Remote servers default to
	// private when omitted. Public catalogs are warmed in the background and
	// reused from the shared registry; private catalogs are discovered lazily
	// and cached under the authenticated principal identity.
	ToolsListVisibility string `yaml:"toolsListVisibility,omitempty" json:"toolsListVisibility,omitempty"`
	// ResourceCacheScopes is explicit managing metadata classification by namespace.
	// Omitted namespaces remain user/credential/conversation scoped.
	ResourceCacheScopes map[string]string `yaml:"resourceCacheScopes,omitempty" json:"resourceCacheScopes,omitempty"`
	// ProtectedResourceMetadataURL pins a path-specific RFC 9728 document
	// when the origin-wide document describes a different MCP resource.
	ProtectedResourceMetadataURL string `yaml:"protectedResourceMetadataURL,omitempty" json:"protectedResourceMetadataURL,omitempty"`
}

func (*MCPClient) BrowserDescriptor

func (c *MCPClient) BrowserDescriptor(name string) (BrowserDescriptor, error)

func (*MCPClient) IsBrowserExecution

func (c *MCPClient) IsBrowserExecution() bool

func (*MCPClient) IsDelegatedAuth

func (c *MCPClient) IsDelegatedAuth() bool

IsDelegatedAuth reports whether this MCP definition selects the delegated OAuth path (auth.mode=oauth with providerRef/inlineProvider).

func (*MCPClient) IsToolsListPublic

func (c *MCPClient) IsToolsListPublic() bool

func (*MCPClient) NormalizeDelegatedAuth

func (c *MCPClient) NormalizeDelegatedAuth() error

NormalizeDelegatedAuth applies backward-compatible flag handling for delegated configs before viant/mcp requirement compilation: a legacy useIdToken=true with an empty tokenType normalizes to tokenType=idToken; an explicit conflicting tokenType (accessToken) combined with useIdToken=true fails validation. Non-delegated configs are untouched — legacy useIdToken behaviour stays unchanged for them.

func (*MCPClient) ResourceCacheScope

func (c *MCPClient) ResourceCacheScope(namespace string, kind ...string) (string, error)

func (*MCPClient) ValidateExecutionLocation

func (c *MCPClient) ValidateExecutionLocation() error

type OutputArtifact

type OutputArtifact struct {
	// Role is trusted workspace policy, never inferred from a MIME type or name.
	Role         string `json:"role,omitempty" yaml:"role,omitempty"`
	Name         string `json:"name,omitempty" yaml:"name,omitempty"`
	NamePath     string `json:"namePath,omitempty" yaml:"namePath,omitempty"`
	BytesPath    string `json:"bytesPath,omitempty" yaml:"bytesPath,omitempty"`
	MimeTypePath string `json:"mimeTypePath,omitempty" yaml:"mimeTypePath,omitempty"`
	MimeType     string `json:"mimeType,omitempty" yaml:"mimeType,omitempty"`
	Encoding     string `json:"encoding,omitempty" yaml:"encoding,omitempty"`
}

OutputArtifact is an explicit client policy for binary MCP output capture. Name and MimeType provide defaults when optional metadata paths are missing or empty. BytesPath requires base64 encoding and never falls back to model text. Paths are JSON Pointers into raw MCP content/structuredContent; remote URIs are never interpreted as paths or public provenance.

func (OutputArtifact) Validate

func (p OutputArtifact) Validate() error

type ResolvedServiceIdentity

type ResolvedServiceIdentity struct {
	ServiceName      string
	ResourceURI      string
	ProviderIdentity string
}

MCPClient augments mcp.ClientOptions with optional discovery descriptions and metadata. ResolvedServiceIdentity is trusted reader provenance, never authored/wire data.

type ResourceMetadata

type ResourceMetadata struct {
	Extractor string            `json:"extractor,omitempty" yaml:"extractor,omitempty"`
	Fields    map[string]string `json:"fields,omitempty" yaml:"fields,omitempty"`
}

ResourceMetadata declares resource extraction options without depending on an indexer or application runtime. Consumers adapt this configuration locally.

type ResourceRoot

type ResourceRoot struct {
	ID           string
	URI          string
	Description  string
	Include      []string
	Exclude      []string
	MaxSizeBytes int64
	Vectorize    bool
	Snapshot     bool
	SnapshotMD5  bool
	AllowGrep    bool
	UpstreamRef  string
	SnapshotURI  string
	SnapshotRoot string
	Metadata     ResourceMetadata
}

ResourceRoot describes a root entry under MCP client metadata.resources.roots.

func ResourceRoots

func ResourceRoots(meta map[string]interface{}) []ResourceRoot

ResourceRoots extracts resource root metadata from a generic metadata map.

type SkillDiscovery

type SkillDiscovery struct {
	Tools   *SkillToolBridge `yaml:"tools,omitempty" json:"tools,omitempty"`
	Enabled bool             `yaml:"enabled" json:"enabled"`
	// CatalogID is required when the configured server name is not URI-safe.
	CatalogID        string `yaml:"catalogId,omitempty" json:"catalogId,omitempty"`
	MaxPages         int    `yaml:"maxPages,omitempty" json:"maxPages,omitempty"`
	MaxScannedItems  int    `yaml:"maxScannedItems,omitempty" json:"maxScannedItems,omitempty"`
	MaxSkills        int    `yaml:"maxSkills,omitempty" json:"maxSkills,omitempty"`
	MaxMetadataBytes int    `yaml:"maxMetadataBytes,omitempty" json:"maxMetadataBytes,omitempty"`
	MaxSkillBytes    int    `yaml:"maxSkillBytes,omitempty" json:"maxSkillBytes,omitempty"`
	TimeoutSec       int    `yaml:"timeoutSec,omitempty" json:"timeoutSec,omitempty"`
}

SkillDiscovery enables on-demand federation. No remote documents are loaded during runtime construction or local skill watching.

type SkillToolBridge

type SkillToolBridge struct {
	List string `yaml:"list" json:"list"`
	Get  string `yaml:"get" json:"get"`
}

SkillToolBridge explicitly maps legacy tools to skill metadata operations. Results must contain SEP-2640 entries; this does not advertise an extension.

type Upstream

type Upstream struct {
	Name               string
	Driver             string
	DSN                string
	Secret             *scy.Resource
	Shadow             string
	Batch              int
	Force              bool
	Enabled            bool
	MinIntervalSeconds int
}

Upstream describes an upstream database used for embedius sync/bootstrap.

func ResolveUpstream

func ResolveUpstream(meta map[string]interface{}, root ResourceRoot) (*Upstream, bool)

ResolveUpstream returns the upstream referenced by a root, if any.

Directories

Path Synopsis
SPDX-License-Identifier: Apache-2.0 MCP async tool configuration extracted from Viant Agently Core.
SPDX-License-Identifier: Apache-2.0 MCP async tool configuration extracted from Viant Agently Core.

Jump to

Keyboard shortcuts

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