mcpfed

package
v2.8.34 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcpfed implements the pure-CPU Outbound MCP Credential Vault (HKDF-SHA256 + AES-256-GCM), OAuth 2.1 PKCE metadata/state hygiene, Federated MCP untrusted output sanitizer, JSON Schema allowlist rebuilder, Streamable HTTP SSE JSON-RPC parser, and Dual-Source MCP Registry fusion engine.

WASM Dependency Invariant:

  • Zero imports of net/http, crypto/tls, crypto/x509, or host networking packages so cmd/edgefetch-wasm compiles cleanly under GOOS=wasip1 GOARCH=wasm with minimal binary footprint.
  • Cryptographic operations maintain 100% byte-for-byte wire compatibility with WebCrypto envelopes (v2 row-bound 5-field AAD, v2 origin-bound 2-field AAD, legacy v1 length-prefixed & v2.7.0 fallback, and pkce2 OAuth PKCE state blobs).

Index

Constants

View Source
const (
	AccessSubjectAll  = "*"
	AccessEffectAllow = "allow"
	AccessEffectDeny  = "deny"

	AccessKindTool      = "tool"
	AccessKindRoute     = "route"
	AccessKindMCPServer = "mcp_server"

	// MaxAccessPolicyRules bounds evaluation input.
	MaxAccessPolicyRules = 2000
	// MaxMCPServerShares bounds evaluation input.
	MaxMCPServerShares = 2000
)
View Source
const (
	// MaxCanonicalJSONDepth caps nesting depth for canonical JSON argument serialization.
	MaxCanonicalJSONDepth = 32
	// FederatedMCPCacheKeyPrefix versions length-prefixed private MCP call_tool cache key preimages.
	FederatedMCPCacheKeyPrefix = "mcpfed:v1"
)
View Source
const (
	// MaxRemoteMCPResponseBytes is the 4 MiB hard ceiling on downstream MCP responses.
	MaxRemoteMCPResponseBytes = 4 * 1024 * 1024
	// MaxMCPContentBlocks caps content[] blocks per downstream MCP response (H3).
	MaxMCPContentBlocks = 64
	// MaxMCPBlockTextChars caps raw per-block text BEFORE sanitizing (64 KiB, H3).
	MaxMCPBlockTextChars = 64 * 1024
	// MaxMCPLinkLabelChars caps Markdown link label length in linear dangerous-link stripping.
	MaxMCPLinkLabelChars = 512
	// MaxMCPLinkTargetChars caps Markdown link target length in linear dangerous-link stripping.
	MaxMCPLinkTargetChars = 2048
	// MaxMCPToolSchemaBytes is the 16 KiB ceiling on individual and total tools/list schemas (H3).
	MaxMCPToolSchemaBytes = 16 * 1024

	// MaxStructuredSanitizeDepth caps recursion depth on structuredContent / connector JSON trees.
	MaxStructuredSanitizeDepth = 12
	// MaxStructuredContainerEntries caps object keys / array items per container.
	MaxStructuredContainerEntries = 256
	// MaxStructuredNodeBudget caps total visited nodes across a structured connector JSON tree.
	MaxStructuredNodeBudget = 2048
	// MaxStructuredStringChars caps string leaf length (16 KiB).
	MaxStructuredStringChars = 16 * 1024

	// MaxMCPRPCErrorDataBytes caps JSON-RPC error.data serialized size (4 KiB).
	MaxMCPRPCErrorDataBytes = 4 * 1024
	// MaxMCPRPCErrorDataDepth caps JSON-RPC error.data nesting depth.
	MaxMCPRPCErrorDataDepth = 4
	// MaxMCPRPCErrorDataEntries caps JSON-RPC error.data entries per container.
	MaxMCPRPCErrorDataEntries = 16
	// MaxMCPRPCErrorDataNodes caps JSON-RPC error.data visited node count.
	MaxMCPRPCErrorDataNodes = 64
	// MaxMCPRPCErrorDataStringChars caps JSON-RPC error.data string leaf length.
	MaxMCPRPCErrorDataStringChars = 512
)
View Source
const (
	// HubSecretsValuePurposeV1 is the HKDF info purpose label for hub_secrets values.
	HubSecretsValuePurposeV1 = "hub_secrets:value:v1"
	// HubSecretsScopeUserID is the fixed pseudo-user every hub_secrets envelope is bound to.
	HubSecretsScopeUserID = "hub"
	// HubSecretsEnvelopeVersion prefixes sealed hub_secrets ciphertexts.
	HubSecretsEnvelopeVersion = "hs1"
	// MaxHubSecretValueBytes caps a single override value (UTF-8 bytes after trimming).
	MaxHubSecretValueBytes = 8 * 1024
	// MaxHubSecretCiphertextBytes bounds envelope parsing work on stored rows.
	MaxHubSecretCiphertextBytes = 16 * 1024
)
View Source
const (
	// OfficialMCPRegistryURL is the upstream Official Model Context Protocol Registry v0 endpoint.
	OfficialMCPRegistryURL = "https://registry.modelcontextprotocol.io/v0/servers"
	// GlamaMCPRegistryURL is the upstream Glama MCP Directory v1 endpoint.
	GlamaMCPRegistryURL = "https://glama.ai/api/mcp/v1/servers"
	// SmitheryMCPRegistryURL is the upstream Smithery MCP Registry servers endpoint.
	SmitheryMCPRegistryURL = "https://registry.smithery.ai/servers"
	// PulseMCPAPIRegistryURL is the upstream PulseMCP v0 JSON API servers endpoint.
	PulseMCPAPIRegistryURL = "https://api.pulsemcp.com/v0/servers"
	// PulseMCPWebDirectoryURL is the upstream PulseMCP public HTML directory endpoint.
	PulseMCPWebDirectoryURL = "https://www.pulsemcp.com/servers"
)
View Source
const (
	// MinVaultMasterKeyLength matches MIN_TOKEN_LENGTH (24) in hub/src/auth.ts.
	MinVaultMasterKeyLength = 24

	// VaultCredentialsPurposeV2 is the HKDF info purpose label for v2 user_mcp_servers credentials.
	VaultCredentialsPurposeV2 = "user_mcp_servers:credentials:v2"

	// VaultPKCEStatePurposeV2 is the HKDF info purpose label for pkce2 mcp_oauth_states blobs.
	VaultPKCEStatePurposeV2 = "mcp_oauth_states:pkce:v2"
)
View Source
const (
	// ClosedAPIRefusalGuidance is the standard remediation message for closed-API MCP refusals.
	ClosedAPIRefusalGuidance = "Use the official API or user-authorized MCP; Virtual OAuth MCP and cookie-based access are prohibited."
)
View Source
const FirstPartyMaxToolSchemaBytes = 128 * 1024

FirstPartyMaxToolSchemaBytes is the raw tools/list ceiling for verified first-party preset origins. Vendor-hosted servers such as Google's Maps MCP publish richer schemas than the 16 KiB default allows; sanitization still caps every stored description and rebuilds every input schema from the allowlist, so only parse work grows.

View Source
const GoogleMapsMCPSlug = "google-maps"

GoogleMapsMCPSlug is the slug the hub looks for when enriching company profiles with place data.

View Source
const GoogleMapsMCPURL = "https://mapstools.googleapis.com/mcp"

GoogleMapsMCPURL is Google Maps Platform's hosted MCP endpoint (Maps Grounding Lite / Maps agent tools).

Variables

This section is empty.

Functions

func BuildHubSecretAAD added in v2.8.19

func BuildHubSecretAAD(envelopeVersion, name string) string

BuildHubSecretAAD returns the length-prefixed AES-GCM AAD binding envelope version, scope user, and secret name.

func BuildHubSecretHKDFInfo added in v2.8.19

func BuildHubSecretHKDFInfo(name string) string

BuildHubSecretHKDFInfo returns the length-prefixed HKDF-SHA256 info binding scope user "hub" and the secret name.

func BuildOAuthBindMACInputs

func BuildOAuthBindMACInputs(vaultMasterKey, userID, state, sessionCSRF string) (macKey, macMessage string)

BuildOAuthBindMACInputs returns the canonical HMAC-SHA256 key and message strings for MCP OAuth bind cookies.

func BuildPerUserOriginHKDFInfo

func BuildPerUserOriginHKDFInfo(userID, remoteOrigin, purpose string) string

BuildPerUserOriginHKDFInfo returns the length-prefixed HKDF-SHA256 info string for a user/origin/purpose tuple.

func CanonicalizeJSONBytes added in v2.8.29

func CanonicalizeJSONBytes(raw []byte) ([]byte, error)

CanonicalizeJSONBytes parses raw JSON (up to depth 32) and emits compact deterministic canonical JSON.

func CanonicalizeJSONValue added in v2.8.29

func CanonicalizeJSONValue(v any) ([]byte, error)

CanonicalizeJSONValue serializes a Go/OrderedObject value into compact deterministic unescaped JSON with keys sorted lexicographically by UTF-16 code units, -0 normalized to 0, and depth capped at 32.

func ClassifyHubSecretName added in v2.8.19

func ClassifyHubSecretName(name string) string

ClassifyHubSecretName reports "managed", "bootstrap", or "unknown" for an exact (case-sensitive) name.

func ComputeMCPOAuthBindHMAC

func ComputeMCPOAuthBindHMAC(vaultMasterKey, userID, state, sessionCSRF string) string

ComputeMCPOAuthBindHMAC computes the HMAC-SHA256 bind cookie signature over userId|state|sessionCsrf.

func ExtractMarkdownFromQueryMCPBody

func ExtractMarkdownFromQueryMCPBody(rawBody json.RawMessage) string

ExtractMarkdownFromQueryMCPBody extracts joined Markdown/text from a query_mcp response body.

func ExtractRegistrableDomain

func ExtractRegistrableDomain(hostname string) string

ExtractRegistrableDomain returns the eTLD+1 registrable domain (or "" when unregistrable / bare suffix / IP).

func FilterAllowedToolNames added in v2.8.19

func FilterAllowedToolNames(rules []AccessRule, caller AccessCaller, names []string) []string

FilterAllowedToolNames returns the subset of names the caller may see/call, preserving order.

func FormatFenceSafeUntrustedMCPEnvelope

func FormatFenceSafeUntrustedMCPEnvelope(tag string, attrs OrderedObject, content string, maxChars int) string

FormatFenceSafeUntrustedMCPEnvelope wraps untrusted text in a fence-safe + boundary-tag-safe XML envelope.

func HubBootstrapSecretNames added in v2.8.19

func HubBootstrapSecretNames() []string

HubBootstrapSecretNames returns a copy of the read-only bootstrap secret names.

func HubManagedSecretNames added in v2.8.19

func HubManagedSecretNames() []string

HubManagedSecretNames returns a copy of the managed (overridable) secret allowlist.

func HubPlainConfigNames added in v2.8.19

func HubPlainConfigNames() []string

HubPlainConfigNames returns the sorted plain-config managed names.

func HubSecretFingerprint added in v2.8.19

func HubSecretFingerprint(value string) string

HubSecretFingerprint returns the first 8 lowercase hex chars of SHA-256(value): enough to tell two values apart in /admin without revealing the value itself.

func HubSecretURLNames added in v2.8.19

func HubSecretURLNames() []string

HubSecretURLNames returns the sorted URL-typed managed names.

func InferAssociatedDomains

func InferAssociatedDomains() []string

InferAssociatedDomains enforces Security Invariant H1: never infer foreign domains from untrusted manifests.

func IsCachedMCPToolPermitted

func IsCachedMCPToolPermitted(serverSlug string, tool CachedMCPToolSchema, allowedSet map[string]bool) bool

IsCachedMCPToolPermitted enforces catalog/virtual/S6 readOnlyHint/destructiveHint gating unless explicitly allowlisted as "<slug>/<tool>".

func IsCommunityDirectoryMcpBlocked added in v2.8.29

func IsCommunityDirectoryMcpBlocked(slug, name, remoteURL, remoteOrigin, trustTier string, untrusted bool, source string) bool

IsCommunityDirectoryMcpBlocked checks stored metadata (trustTier, untrusted, source) as well as slug/name/origin/URL for community/third-party MCP directories (Smithery, Glama, PulseMCP, run.tools, mcp.run).

func IsCommunityDirectoryMcpOriginOrSlug added in v2.8.29

func IsCommunityDirectoryMcpOriginOrSlug(slug, remoteURL string) bool

IsCommunityDirectoryMcpOriginOrSlug reports whether a slug or remoteUrl belongs to a community/third-party MCP directory (Smithery, *.run.tools, mcp.run, Glama, PulseMCP) that must never access Vault credentials.

func IsFirstPartyMCPOrigin added in v2.8.21

func IsFirstPartyMCPOrigin(origin string) bool

IsFirstPartyMCPOrigin reports whether origin (scheme://host[:port]) is the remote origin of a first-party preset.

func IsHubPlainConfigName added in v2.8.19

func IsHubPlainConfigName(name string) bool

IsHubPlainConfigName reports whether a managed name is non-secret plain config.

func IsInternalOnlyDealerPortalTarget added in v2.8.29

func IsInternalOnlyDealerPortalTarget(slugOrOriginOrText string) bool

IsInternalOnlyDealerPortalTarget reports whether slugOrOriginOrText references the internal-only dealer portal hook (`dealer-portal-internal`, `qbp`, `jbi`, `hlc`, `qbp.com`, `b2b.qbp.com`, `jbi.bike`, `hlc.bike`).

func IsJSONDepthWithinLimit

func IsJSONDepthWithinLimit(rawJSON string, maxDepth int) bool

IsJSONDepthWithinLimit verifies in O(N) time that bracket/brace nesting never exceeds maxDepth.

func IsSafeAccessUserID added in v2.8.19

func IsSafeAccessUserID(raw string) bool

IsSafeAccessUserID accepts hub user ids (e.g. "owner", "gh_12345"): 1..128 of [A-Za-z0-9_.:@-], first char alphanumeric. "/" and "*" are excluded so ids can't collide with resource separators or the wildcard.

func IsSafeMCPIdentifier

func IsSafeMCPIdentifier(raw string) bool

IsSafeMCPIdentifier validates tool/property names against prototype pollution, "__", and prompt-injection verbs.

func IsSafePublicHostname

func IsSafePublicHostname(rawHost, selfHost string) bool

IsSafePublicHostname validates that rawHost is a public DNS name (no IP literals, loopback/LAN/metadata, rebinding, or self-hub).

func IsSharedHostingHostname

func IsSharedHostingHostname(hostname string) bool

IsSharedHostingHostname delegates to extract.HasPrivateSharedHostingSuffix for PSL PRIVATE DOMAINS isolation.

func IsValidMCPConnectorSlug

func IsValidMCPConnectorSlug(raw string) bool

IsValidMCPConnectorSlug validates lowercase connector slugs (1..48 chars, no "__").

func MarshalUnescapedJSON

func MarshalUnescapedJSON(v any) ([]byte, error)

MarshalUnescapedJSON marshals v to compact JSON without escaping <, >, or &.

func MeasureOrderedJSONSizeCapped

func MeasureOrderedJSONSizeCapped(rawValue any, maxBytes int) int

MeasureOrderedJSONSizeCapped estimates serialized JSON size in UTF-16 code units, aborting as soon as acc > maxBytes.

func NeutralizeUntrustedMCPBoundaryTags

func NeutralizeUntrustedMCPBoundaryTags(input string) string

NeutralizeUntrustedMCPBoundaryTags escapes <untrusted_... and </untrusted_... tags inside untrusted text.

func NormalizeAccessRoutePath added in v2.8.19

func NormalizeAccessRoutePath(raw string) (string, bool)

NormalizeAccessRoutePath strips query/fragment and trailing slashes from a /v1 path. ok is false when the path is not under /v1/ or contains unsafe characters / dot segments.

func NormalizeAccessRule added in v2.8.19

func NormalizeAccessRule(r AccessRule) (AccessRule, *AccessPolicyError)

NormalizeAccessRule validates and canonicalizes a rule for storage.

func NormalizeConfirmedAuthOrigin

func NormalizeConfirmedAuthOrigin(raw, selfHost string) (origin string, ok bool, reason string)

NormalizeConfirmedAuthOrigin validates an optional https:// origin without path or query.

func NormalizeMCPConnectorSlug

func NormalizeMCPConnectorSlug(rawName string) string

NormalizeMCPConnectorSlug derives a safe lowercase connector slug from an arbitrary server name.

func NormalizeMCPServerShare added in v2.8.19

func NormalizeMCPServerShare(s MCPServerShare) (MCPServerShare, *AccessPolicyError)

NormalizeMCPServerShare validates a share row for storage.

func ParseAllowedMCPTools

func ParseAllowedMCPTools(raw json.RawMessage) (allowed []string, ok bool, errCode string, message string)

ParseAllowedMCPTools validates exact "<slug>/<tool>" allowlist entries (<= 128 items, no wildcards or "__").

func ParseOrderedJSON

func ParseOrderedJSON(data []byte, maxDepth int) (any, error)

ParseOrderedJSON parses arbitrary JSON into OrderedObject, []any, string, json.Number, bool, or nil, enforcing maxDepth and converting bridged JS sentinels into SpecialSentinel values.

func ParseSharedServerRef added in v2.8.19

func ParseSharedServerRef(raw string) (owner, slug string, ok bool)

ParseSharedServerRef splits "<ownerUserId>/<slug>" (slug lowercased) and validates both parts.

func PreparePKCEStateSeal

func PreparePKCEStateSeal(userID, remoteOrigin string, blob OrderedObject) (hkdfInfo, aad, plaintext string, err error)

PreparePKCEStateSeal builds the canonical HKDF info, AAD, and JSON plaintext for pkce2 state blobs.

func PreparePKCEStateUnseal

func PreparePKCEStateUnseal(userID, remoteOrigin, ciphertext string) (hkdfInfo, aad, saltB64, ivB64, ctB64 string, salt, iv, ct []byte, ok bool)

PreparePKCEStateUnseal validates a pkce2 ciphertext header and returns HKDF info, AAD, and decoded byte slices.

func RandomBase64URL

func RandomBase64URL(byteLen int) (string, error)

RandomBase64URL generates byteLen CSPRNG bytes encoded as unpadded base64url.

func RedactVaultSecretsFromText

func RedactVaultSecretsFromText(raw string, secret *VaultSecretPayload) string

RedactVaultSecretsFromText scrubs Bearer/Basic tokens, query-param secrets, VAULT_MASTER_KEY assignments, vendor token prefixes, and decrypted vault header/OAuth secrets (including URL-encoded forms) from untrusted text.

func RedactVaultSecretsWithExtra added in v2.8.29

func RedactVaultSecretsWithExtra(text string, secret *VaultSecretPayload, extraSecrets ...string) string

RedactVaultSecretsWithExtra scrubs vault secrets, common secret patterns, and explicit extraSecrets from untrusted text.

func RegisterInternalDealerPortalProvider added in v2.8.29

func RegisterInternalDealerPortalProvider(provider DealerPortalProvider) error

RegisterInternalDealerPortalProvider registers an internal-only dealer portal provider by its ProviderID.

func ResolveCallerUserID

func ResolveCallerUserID(userID, principal string) string

ResolveCallerUserID resolves the isolated tenant user_id per the Pillar 1 shared interface contract.

func ResolveSharedServerRef added in v2.8.19

func ResolveSharedServerRef(rules []AccessRule, shares []MCPServerShare, callerUserID, ref string) (SharedServerRef, *AccessPolicyError)

ResolveSharedServerRef maps a caller-supplied ref to a shared (owner, slug). The host resolves the caller's OWN servers first; this is only consulted when that lookup misses. Accepted forms:

"<ownerUserId>/<slug>"  explicit; must be shared with (and not policy-denied to) the caller
"<slug>"                 resolves only when exactly one allowed share has that slug (409 when ambiguous)

func SHA256Base64URL

func SHA256Base64URL(input string) string

SHA256Base64URL computes unpadded base64url(SHA-256(UTF8(input))) for RFC 7636 S256 PKCE challenges and state hashes.

func SanitizeMCPMarkdownOutput

func SanitizeMCPMarkdownOutput(rawMarkdown, baseURL string, maxChars int) string

SanitizeMCPMarkdownOutput sanitizes untrusted Markdown/HTML returned by a downstream MCP server.

func SanitizeManifestString

func SanitizeManifestString(raw string, maxLen int) string

SanitizeManifestString strips smuggling runes and redacts prompt-injection directives in third-party registry manifests.

func SanitizeTargetURLForMCPForwarding

func SanitizeTargetURLForMCPForwarding(rawURL, selfHost string) (safeForwardURL string, normalizedTarget string, ok bool)

SanitizeTargetURLForMCPForwarding validates targetURL as safe public HTTPS and strips credentials, hash, and sensitive query params.

func SealPKCEStateBlob

func SealPKCEStateBlob(vaultMasterKey, userID, remoteOrigin string, blob OrderedObject) (string, error)

SealPKCEStateBlob encrypts a downstream OAuth 2.1 PKCE verifier blob using the pkce2 envelope.

func SlugifyMCPServerName

func SlugifyMCPServerName(rawName string) string

SlugifyMCPServerName converts a registry server name (including reverse-DNS / @scope prefixes) into a safe slug.

func StripMCPSmugglingChars

func StripMCPSmugglingChars(s string) string

StripMCPSmugglingChars strips invisible Unicode Tag/Variation Selector smuggling, Bidi controls, zero-width characters, ANSI CSI sequences, and raw ASCII C0/DEL control bytes.

func ToolSchemaLimitForOrigin added in v2.8.21

func ToolSchemaLimitForOrigin(origin string) int

ToolSchemaLimitForOrigin is the raw tools/list byte ceiling for a remote origin: FirstPartyMaxToolSchemaBytes for verified first-party presets, MaxMCPToolSchemaBytes (16 KiB, H3) for every other server.

func UnregisterInternalDealerPortalProvider added in v2.8.29

func UnregisterInternalDealerPortalProvider(providerID string)

UnregisterInternalDealerPortalProvider removes a previously registered internal dealer portal provider.

func ValidateConnectorDomains

func ValidateConnectorDomains(rawDomains json.RawMessage, remoteOrigin string, allowUnrelatedDomains bool) ([]string, bool, string)

ValidateConnectorDomains validates operator-supplied connector domains against PSL suffixes, shared-hosting sibling tenants, and origin matching.

func ValidateVaultMasterKey

func ValidateVaultMasterKey(vaultMasterKey string) (clean string, ok bool, message string)

ValidateVaultMasterKey enforces VAULT_MASTER_KEY >= 24 trimmed UTF-16 characters.

func VerifyHubSecretPlaintext added in v2.8.19

func VerifyHubSecretPlaintext(name string, plain []byte) (string, bool)

VerifyHubSecretPlaintext checks the decrypted JSON is a hub_secrets value for exactly this name.

func VerifyMCPOAuthBindHMAC

func VerifyMCPOAuthBindHMAC(presented, vaultMasterKey, userID, state, sessionCSRF string) bool

VerifyMCPOAuthBindHMAC compares presented cookie HMAC in constant time.

Types

type AccessCaller added in v2.8.19

type AccessCaller struct {
	UserID string `json:"userId"`
	Role   string `json:"role"`
}

AccessCaller is the authenticated identity being evaluated.

type AccessDecision added in v2.8.19

type AccessDecision struct {
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason"`
	// MatchedRule is the deciding rule (nil for defaults/bypass). Share grants appear as allow rules.
	MatchedRule *AccessRule `json:"matchedRule,omitempty"`
}

AccessDecision is the evaluation outcome.

func EvaluateAccess added in v2.8.19

func EvaluateAccess(rules []AccessRule, caller AccessCaller, resource string) AccessDecision

EvaluateAccess decides a concrete tool:/route: resource (mcp_server: resources go through EvaluateSharedServerAccess so shares are considered).

func EvaluateSharedServerAccess added in v2.8.19

func EvaluateSharedServerAccess(rules []AccessRule, shares []MCPServerShare, callerUserID, ownerUserID, slug string) AccessDecision

EvaluateSharedServerAccess decides whether callerUserID may use ownerUserID's server slug.

type AccessPolicyError added in v2.8.19

type AccessPolicyError struct {
	Status  int    `json:"status"`
	Error   string `json:"error"`
	Message string `json:"message"`
}

AccessPolicyError is a structured validation/resolution failure.

type AccessRule added in v2.8.19

type AccessRule struct {
	Subject  string `json:"subject"`
	Resource string `json:"resource"`
	Effect   string `json:"effect"`
}

AccessRule is one stored policy rule.

type CachedMCPToolSchema

type CachedMCPToolSchema struct {
	Name            string        `json:"name"`
	Title           string        `json:"title,omitempty"`
	Description     string        `json:"description,omitempty"`
	InputSchema     OrderedObject `json:"inputSchema"`
	ReadOnlyHint    *bool         `json:"readOnlyHint,omitempty"`
	DestructiveHint *bool         `json:"destructiveHint,omitempty"`
}

CachedMCPToolSchema describes a sanitized tool cached on a connected MCP server row.

func FilterSafeCachedMCPTools

func FilterSafeCachedMCPTools(rawTools json.RawMessage) []CachedMCPToolSchema

FilterSafeCachedMCPTools filters persisted cached_tools_json rows (<= 64 tools, safe names & schema keys).

type ClosedAPIRefusalResult added in v2.8.29

type ClosedAPIRefusalResult struct {
	Refused  bool   `json:"refused"`
	Status   int    `json:"status,omitempty"`
	Error    string `json:"error,omitempty"`
	Target   string `json:"target,omitempty"`
	Guidance string `json:"guidance,omitempty"`
	Reason   string `json:"reason,omitempty"`
}

ClosedAPIRefusalResult captures explicit closed-API refusals for Virtual OAuth MCPs and federation.

func CheckClosedAPIMCPTarget added in v2.8.29

func CheckClosedAPIMCPTarget(slug, name, remoteURL string) ClosedAPIRefusalResult

CheckClosedAPIMCPTarget enforces explicit Part 2 refusals for closed-API targets (`linkedin`, `indeed`, `glassdoor`, `zillow`).

type DealerPortalProvider added in v2.8.29

type DealerPortalProvider interface {
	ProviderID() string
	Domains() []string
	Query(req DealerPortalQueryRequest) (DealerPortalQueryResponse, error)
}

DealerPortalProvider defines the internal-only hook interface for dealer portal integrations (qbp, jbi, hlc). Implementations are internal-only and must never be surfaced in public discovery endpoints.

func LookupInternalDealerPortalProvider added in v2.8.29

func LookupInternalDealerPortalProvider(providerIDOrDomain string) (DealerPortalProvider, bool)

LookupInternalDealerPortalProvider looks up an internal-only dealer portal provider by ID or domain.

type DealerPortalQueryRequest added in v2.8.29

type DealerPortalQueryRequest struct {
	Provider  string        `json:"provider"`
	Operation string        `json:"operation"`
	SKU       string        `json:"sku,omitempty"`
	Query     string        `json:"query,omitempty"`
	Arguments OrderedObject `json:"arguments,omitempty"`
}

DealerPortalQueryRequest describes an internal dealer-portal query payload.

type DealerPortalQueryResponse added in v2.8.29

type DealerPortalQueryResponse struct {
	Provider string        `json:"provider"`
	OK       bool          `json:"ok"`
	Data     OrderedObject `json:"data,omitempty"`
	Error    string        `json:"error,omitempty"`
}

DealerPortalQueryResponse describes an internal dealer-portal query response.

type DiscoveredRemoteOAuthMetadata

type DiscoveredRemoteOAuthMetadata struct {
	Supported                      bool     `json:"supported"`
	RequiresAuthOriginConfirmation bool     `json:"requiresAuthOriginConfirmation,omitempty"`
	Error                          string   `json:"error,omitempty"`
	AuthOrigin                     string   `json:"authOrigin,omitempty"`
	ConnectorOrigin                string   `json:"connectorOrigin,omitempty"`
	Resource                       string   `json:"resource,omitempty"`
	Issuer                         string   `json:"issuer,omitempty"`
	AuthorizationEndpoint          string   `json:"authorizationEndpoint,omitempty"`
	TokenEndpoint                  string   `json:"tokenEndpoint,omitempty"`
	RegistrationEndpoint           string   `json:"registrationEndpoint,omitempty"`
	ScopesSupported                []string `json:"scopesSupported,omitempty"`
	CodeChallengeMethods           []string `json:"codeChallengeMethods,omitempty"`
}

DiscoveredRemoteOAuthMetadata describes validated RFC 9728 / RFC 8414 OAuth 2.1 endpoints.

func ValidateOAuthAuthorizationServer

func ValidateOAuthAuthorizationServer(
	asRaw json.RawMessage,
	expectedIssuerURL, allowedAuthOrigin, connectorOrigin, resourceURI string,
	prScopes []string,
	selfHost string,
) (meta DiscoveredRemoteOAuthMetadata, abort bool)

ValidateOAuthAuthorizationServer enforces RFC 8414 issuer & endpoint same-origin pinning and S256 PKCE support.

type FederatedMCPCacheKey added in v2.8.29

type FederatedMCPCacheKey struct {
	UserID        string `json:"userId"`
	ServerSlug    string `json:"serverSlug"`
	ToolName      string `json:"toolName"`
	CanonicalArgs string `json:"canonicalArgs"`
	Preimage      string `json:"preimage"`
	Visibility    string `json:"visibility"`
}

FederatedMCPCacheKey represents a strictly per-user private cache key and canonical preimage.

func BuildFederatedMCPCacheKey added in v2.8.29

func BuildFederatedMCPCacheKey(userID, serverSlug, toolName string, rawArgs json.RawMessage) (FederatedMCPCacheKey, error)

BuildFederatedMCPCacheKey validates caller identity and builds a strictly private length-prefixed cache key preimage (userId, server, tool, canonicalArgs) without importing crypto/*.

type HubSecretEnvProbe added in v2.8.19

type HubSecretEnvProbe struct {
	Name        string `json:"name"`
	Fingerprint string `json:"fingerprint"`
	// PlainValue is honoured only for plain-config names (see PlainValue on HubSecretOverrideMeta).
	PlainValue string `json:"plainValue,omitempty"`
}

HubSecretEnvProbe reports whether the deployment env sets a name, with the host-computed fingerprint.

type HubSecretError added in v2.8.19

type HubSecretError struct {
	Status  int    `json:"status"`
	Error   string `json:"error"`
	Message string `json:"message"`
}

HubSecretError is a structured validation failure for hub_secrets operations.

func NormalizeHubSecretValue added in v2.8.19

func NormalizeHubSecretValue(name, raw string) (string, *HubSecretError)

NormalizeHubSecretValue trims and validates a value for a managed name.

func SealHubSecret added in v2.8.19

func SealHubSecret(vaultMasterKey, name, value string) (ciphertext, fingerprint string, failure *HubSecretError)

SealHubSecret encrypts a managed hub secret value into an "hs1" envelope (native Go hub + test parity with the hub/src/hub-secrets.ts WebCrypto path, which consumes PrepareHubSecretSeal via WASM).

func UnsealHubSecret added in v2.8.19

func UnsealHubSecret(vaultMasterKey, name, ciphertext string) (string, *HubSecretError)

UnsealHubSecret decrypts an "hs1" envelope stored under name. A ciphertext sealed for another name fails.

func ValidateHubSecretName added in v2.8.19

func ValidateHubSecretName(rawName string) (string, *HubSecretError)

ValidateHubSecretName accepts only managed names; bootstrap and unknown names are rejected.

type HubSecretOverrideMeta added in v2.8.19

type HubSecretOverrideMeta struct {
	Name        string `json:"name"`
	Fingerprint string `json:"fingerprint"`
	UpdatedAt   int64  `json:"updatedAt"`
	UpdatedBy   string `json:"updatedBy"`
	// PlainValue is the decrypted value, supplied by the host ONLY for plain-config names; it is dropped for
	// secret names regardless.
	PlainValue string `json:"plainValue,omitempty"`
}

HubSecretOverrideMeta is the non-secret metadata of one stored override row.

type HubSecretStatus added in v2.8.19

type HubSecretStatus struct {
	Name    string `json:"name"`
	Managed bool   `json:"managed"`
	// Secret is false for plain-config names, whose effective Value may be displayed in full.
	Secret      bool    `json:"secret"`
	Value       *string `json:"value"`
	Source      string  `json:"source"`
	Fingerprint *string `json:"fingerprint"`
	EnvSet      bool    `json:"envSet"`
	UpdatedAt   *int64  `json:"updatedAt"`
	UpdatedBy   *string `json:"updatedBy"`
}

HubSecretStatus is one admin-facing row. It never carries the value.

func BuildHubSecretStatus added in v2.8.19

func BuildHubSecretStatus(env []HubSecretEnvProbe, overrides []HubSecretOverrideMeta) []HubSecretStatus

BuildHubSecretStatus merges env presence and override metadata into the ordered status list (managed names first, then bootstrap). Bootstrap rows never report a fingerprint or an override source; unknown names in either input are ignored.

type MCPEnvVarSpec

type MCPEnvVarSpec struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	IsRequired  bool   `json:"isRequired"`
	IsSecret    bool   `json:"isSecret"`
	Default     string `json:"default,omitempty"`
}

MCPEnvVarSpec describes an environment variable advertised by an MCP package manifest.

type MCPPackageSpec

type MCPPackageSpec struct {
	RegistryType         string          `json:"registryType,omitempty"`
	Identifier           string          `json:"identifier"`
	Version              string          `json:"version,omitempty"`
	Transport            string          `json:"transport,omitempty"`
	EnvironmentVariables []MCPEnvVarSpec `json:"environmentVariables"`
}

MCPPackageSpec describes a local package manifest entry for an MCP server.

type MCPRemoteEndpointSpec

type MCPRemoteEndpointSpec struct {
	Type    string                `json:"type"`
	URL     string                `json:"url"`
	Headers []MCPRemoteHeaderSpec `json:"headers"`
}

MCPRemoteEndpointSpec describes a validated public HTTPS remote endpoint for an MCP server.

type MCPRemoteHeaderSpec

type MCPRemoteHeaderSpec struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	IsRequired  bool   `json:"isRequired"`
	IsSecret    bool   `json:"isSecret"`
	Default     string `json:"default,omitempty"`
	Placeholder string `json:"placeholder,omitempty"`
}

MCPRemoteHeaderSpec describes a manifest header advertised by a remote MCP server.

type MCPServerShare added in v2.8.19

type MCPServerShare struct {
	OwnerUserID string `json:"ownerUserId"`
	Slug        string `json:"slug"`
	Subject     string `json:"subject"`
	CreatedAt   int64  `json:"createdAt,omitempty"`
}

MCPServerShare is one share grant row.

type MaskedAuthSummary

type MaskedAuthSummary struct {
	AuthMode        string   `json:"authMode"`
	HeaderNames     []string `json:"headerNames"`
	MaskedBadge     string   `json:"maskedBadge"`
	HasRefreshToken *bool    `json:"hasRefreshToken,omitempty"`
	TokenExpiresAt  *int64   `json:"tokenExpiresAt,omitempty"`
}

MaskedAuthSummary is the write-only public badge describing connector authentication without secrets.

func BuildMaskedAuthSummary

func BuildMaskedAuthSummary(payload VaultSecretPayload) MaskedAuthSummary

BuildMaskedAuthSummary builds a public MaskedAuthSummary without exposing secret values.

type MatchedConnectedMCP

type MatchedConnectedMCP struct {
	Server         PublicMCPServerSummary `json:"server"`
	MatchedDomains []string               `json:"matchedDomains"`
	Score          int                    `json:"score"`
}

MatchedConnectedMCP ranks an enabled connected MCP server against target URLs and query text.

func MatchConnectedMCPsForContext

func MatchConnectedMCPsForContext(servers []StoredMCPServerRow, query string, urls []string) []MatchedConnectedMCP

MatchConnectedMCPsForContext ranks a user's enabled connected MCP servers against URLs and query text.

type NormalizedMCPRegistryEntry

type NormalizedMCPRegistryEntry struct {
	ID            string `json:"id"`
	Slug          string `json:"slug"`
	Name          string `json:"name"`
	Title         string `json:"title"`
	Description   string `json:"description"`
	Version       string `json:"version,omitempty"`
	WebsiteURL    string `json:"websiteUrl,omitempty"`
	RepositoryURL string `json:"repositoryUrl,omitempty"`
	// GlamaURL is the record's Glama listing. The Glama API Data License requires linking to it wherever the
	// record is presented, so it is kept separately from WebsiteURL (which never points at glama.ai).
	GlamaURL string `json:"glamaUrl,omitempty"`
	// Sponsored marks a Glama listing with an active Boost; Glama requires promoted placements to be labelled.
	Sponsored bool                    `json:"sponsored,omitempty"`
	Sources   []string                `json:"sources"`
	TrustTier string                  `json:"trustTier,omitempty"`
	Untrusted bool                    `json:"untrusted"`
	HasRemote bool                    `json:"hasRemote"`
	Remotes   []MCPRemoteEndpointSpec `json:"remotes"`
	Packages  []MCPPackageSpec        `json:"packages"`
	Domains   []string                `json:"domains"`
}

NormalizedMCPRegistryEntry is a normalized, sanitized, deduplicated MCP server listing.

func FirstPartyRegistryEntries added in v2.8.19

func FirstPartyRegistryEntries() []NormalizedMCPRegistryEntry

FirstPartyRegistryEntries returns every first-party preset (for listings and tests).

func FuseRegistryEntries

func FuseRegistryEntries(officialEntries, glamaEntries, smitheryEntries, pulsemcpEntries []NormalizedMCPRegistryEntry) []NormalizedMCPRegistryEntry

FuseRegistryEntries deduplicates, merges, and ranks Official MCP Registry, Glama, Smithery, and PulseMCP entries.

func ParseGlamaRegistryPayload

func ParseGlamaRegistryPayload(rawJSON json.RawMessage, selfHost string) ([]NormalizedMCPRegistryEntry, error)

ParseGlamaRegistryPayload normalizes and sanitizes entries from glama.ai/api/mcp/v1/servers.

func ParseOfficialRegistryPayload

func ParseOfficialRegistryPayload(rawJSON json.RawMessage, selfHost string) ([]NormalizedMCPRegistryEntry, error)

ParseOfficialRegistryPayload normalizes and sanitizes entries from registry.modelcontextprotocol.io.

func ParsePulseMCPRegistryPayload added in v2.8.29

func ParsePulseMCPRegistryPayload(rawBody string, selfHost string) ([]NormalizedMCPRegistryEntry, error)

ParsePulseMCPRegistryPayload normalizes and sanitizes entries from PulseMCP JSON or www.pulsemcp.com/servers HTML.

func ParseSmitheryRegistryPayload added in v2.8.29

func ParseSmitheryRegistryPayload(rawJSON json.RawMessage, selfHost string) ([]NormalizedMCPRegistryEntry, error)

ParseSmitheryRegistryPayload normalizes and sanitizes entries from registry.smithery.ai/servers.

func PrependFirstPartyPresets added in v2.8.19

func PrependFirstPartyPresets(entries []NormalizedMCPRegistryEntry, query string) []NormalizedMCPRegistryEntry

PrependFirstPartyPresets puts presets whose keywords match query ahead of the fused registry entries, replacing any community entry that points at the same remote URL. An empty query returns entries unchanged.

type OAuthPRMCheckResult

type OAuthPRMCheckResult struct {
	Valid                          bool     `json:"valid"`
	RequiresAuthOriginConfirmation bool     `json:"requiresAuthOriginConfirmation,omitempty"`
	Error                          string   `json:"error,omitempty"`
	AuthOrigin                     string   `json:"authOrigin,omitempty"`
	ConnectorOrigin                string   `json:"connectorOrigin,omitempty"`
	ResourceURI                    string   `json:"resourceUri,omitempty"`
	AuthIssuerURL                  string   `json:"authIssuerUrl,omitempty"`
	AllowedAuthOrigin              string   `json:"allowedAuthOrigin,omitempty"`
	ASCandidates                   []string `json:"asCandidates,omitempty"`
	ScopesSupported                []string `json:"scopesSupported,omitempty"`
}

OAuthPRMCheckResult is the result of validating an HTTP 200 RFC 9728 Protected Resource Metadata JSON payload.

func ValidateOAuthProtectedResource

func ValidateOAuthProtectedResource(prRaw json.RawMessage, remoteURL, confirmedAuthOrigin, selfHost string) OAuthPRMCheckResult

ValidateOAuthProtectedResource enforces RFC 9728 §3.3 resource pinning, shared-hosting sibling tenant isolation, and cross-origin authorization server confirmation.

type OAuthProbePlan

type OAuthProbePlan struct {
	OK                 bool     `json:"ok"`
	Reason             string   `json:"reason,omitempty"`
	NormalizedRemote   string   `json:"normalizedRemote,omitempty"`
	ConnectorOrigin    string   `json:"connectorOrigin,omitempty"`
	ConfirmedOrigin    string   `json:"confirmedOrigin,omitempty"`
	PRCandidates       []string `json:"prCandidates,omitempty"`
	FallbackCandidates []string `json:"fallbackCandidates,omitempty"`
}

OAuthProbePlan holds candidate RFC 9728 Protected Resource Metadata URLs for a remote MCP endpoint.

func PrepareOAuthProbe

func PrepareOAuthProbe(remoteURL, confirmedAuthOrigin, selfHost string) OAuthProbePlan

PrepareOAuthProbe validates remoteURL + confirmedAuthOrigin and computes RFC 9728 / RFC 8414 candidate URLs.

type OAuthTokenEndpointCheck

type OAuthTokenEndpointCheck struct {
	OK            bool   `json:"ok"`
	NormalizedURL string `json:"normalizedUrl,omitempty"`
	Status        int    `json:"status,omitempty"`
	Error         string `json:"error,omitempty"`
	Message       string `json:"message,omitempty"`
}

OAuthTokenEndpointCheck holds the result of validating an OAuth token_endpoint before code exchange or refresh.

func ValidateOAuthTokenEndpoint

func ValidateOAuthTokenEndpoint(tokenEndpoint, expectedIssuer, confirmedAuthOrigin, remoteOrigin, selfHost string) OAuthTokenEndpointCheck

ValidateOAuthTokenEndpoint validates tokenEndpoint + expectedIssuer against allowedAuthOrigin and SSRF rules.

type OfficialVendorMCPEntry added in v2.8.29

type OfficialVendorMCPEntry struct {
	RowNumber            int               `json:"rowNumber"`
	ServerID             string            `json:"serverId"`
	Aliases              []string          `json:"aliases,omitempty"`
	SubVendors           []VendorSubVendor `json:"subVendors,omitempty"`
	DisplayName          string            `json:"displayName"`
	Category             string            `json:"category"`
	Endpoint             string            `json:"endpoint"`
	Transport            string            `json:"transport"`
	AuthMethod           string            `json:"authMethod"`
	Domains              []string          `json:"domains"`
	ReadOnlyTools        []string          `json:"readOnlyTools"`
	WriteTools           []string          `json:"writeTools"`
	ReadOnlyOnly         bool              `json:"readOnlyOnly"`
	EndpointConfigurable bool              `json:"endpointConfigurable"`
	Notes                string            `json:"notes,omitempty"`
}

OfficialVendorMCPEntry describes one row of the 26-row Official Vendor Remote MCP catalog.

func LookupOfficialVendorMCP added in v2.8.29

func LookupOfficialVendorMCP(slugOrOriginOrAlias string) (OfficialVendorMCPEntry, bool)

LookupOfficialVendorMCP resolves a catalog entry by serverId, alias, subVendor ID, or HTTPS origin.

func OfficialVendorMCPCatalog added in v2.8.29

func OfficialVendorMCPCatalog() []OfficialVendorMCPEntry

OfficialVendorMCPCatalog returns a copy of all 26 Official Vendor Remote MCP catalog rows.

type OrderedEntry

type OrderedEntry struct {
	Key   string
	Value any
}

OrderedEntry represents a single key-value pair in a JSON object preserving wire order.

type OrderedObject

type OrderedObject []OrderedEntry

OrderedObject is an insertion-order-preserving JSON object slice.

func BuildPKCEAuthorizationInit

func BuildPKCEAuthorizationInit(
	authorizationEndpoint, tokenEndpoint, clientID, clientSecret, redirectURI, scope string,
	scopesSupported []string,
	resource, confirmedAuthOrigin, issuer, codeVerifier, codeChallenge, state string,
) (blob OrderedObject, authorizationURL string, err error)

BuildPKCEAuthorizationInit constructs the PKCE OrderedObject state blob and RFC 7636 S256 authorization URL.

func BuildPinnedOutboundHeaders

func BuildPinnedOutboundHeaders(secret *VaultSecretPayload, targetOrigin, sessionID string) (OrderedObject, bool, string)

BuildPinnedOutboundHeaders verifies secret.pinnedOrigin === targetOrigin and constructs outbound JSON-RPC headers.

func ParseRemoteJSONRPCBody

func ParseRemoteJSONRPCBody(bodyText, contentType string, expected RPCID) (rpc OrderedObject, depthExceeded bool, found bool)

ParseRemoteJSONRPCBody parses either application/json or text/event-stream JSON-RPC responses matching expected.

func ParseSSEJSONRPCResponse

func ParseSSEJSONRPCResponse(sseText string, expected RPCID) (OrderedObject, bool)

ParseSSEJSONRPCResponse parses a Streamable HTTP text/event-stream SSE payload and extracts the JSON-RPC 2.0 response matching expected.

func RebuildSafeMCPInputSchema

func RebuildSafeMCPInputSchema(rawNode any, depth int) (OrderedObject, bool)

RebuildSafeMCPInputSchema rebuilds a downstream MCP tool inputSchema via a strict recursive allowlist walker (H3).

func SanitizeCallToolRPCResponse

func SanitizeCallToolRPCResponse(
	rpcObj OrderedObject,
	serverSlug, serverName, remoteOrigin, toolName, sanitizeBaseURL, selfHost string,
	tokenRefreshed bool,
	activeSecret *VaultSecretPayload,
) (status int, body OrderedObject)

SanitizeCallToolRPCResponse sanitizes a complete downstream JSON-RPC tools/call response (result or error) in a single Go pass, enforcing H3/M10 block, byte, depth, and secret-redaction budgets.

func SanitizeCallToolRPCResponseWithExtra added in v2.8.29

func SanitizeCallToolRPCResponseWithExtra(
	rpcObj OrderedObject,
	serverSlug, serverName, remoteOrigin, toolName, sanitizeBaseURL, selfHost string,
	tokenRefreshed bool,
	activeSecret *VaultSecretPayload,
	extraSecrets ...string,
) (status int, body OrderedObject)

SanitizeCallToolRPCResponseWithExtra sanitizes a downstream JSON-RPC tools/call response while scrubbing both vault credentials and explicit extraSecrets (such as VAULT_MASTER_KEY) from all text and structured fields.

func SanitizeSecretHeadersInput

func SanitizeSecretHeadersInput(bearerToken *string, rawHeaders json.RawMessage, hasHeaders bool) (OrderedObject, bool, string)

SanitizeSecretHeadersInput validates custom secret headers and optional bearerToken against smuggling/hop-by-hop headers.

func UnsealPKCEStateBlob

func UnsealPKCEStateBlob(vaultMasterKey, userID, remoteOrigin, ciphertext string) (OrderedObject, bool)

UnsealPKCEStateBlob authenticates and decrypts a pkce2 OAuth state blob.

func VerifyPKCEStatePlaintext

func VerifyPKCEStatePlaintext(plain []byte) (OrderedObject, bool)

VerifyPKCEStatePlaintext validates decrypted pkce2 state JSON.

func (OrderedObject) Clone

func (o OrderedObject) Clone() OrderedObject

Clone shallow-copies the OrderedObject slice.

func (*OrderedObject) Delete

func (o *OrderedObject) Delete(key string)

Delete removes key if present.

func (OrderedObject) Get

func (o OrderedObject) Get(key string) (any, bool)

Get returns the value for key if present.

func (OrderedObject) GetArray

func (o OrderedObject) GetArray(key string) ([]any, bool)

GetArray returns a nested []any if present.

func (OrderedObject) GetBool

func (o OrderedObject) GetBool(key string) (bool, bool)

GetBool returns a boolean field if present and typed as bool.

func (OrderedObject) GetObject

func (o OrderedObject) GetObject(key string) (OrderedObject, bool)

GetObject returns a nested OrderedObject if present.

func (OrderedObject) GetString

func (o OrderedObject) GetString(key string) (string, bool)

GetString returns a string field if present and typed as string.

func (OrderedObject) MarshalJSON

func (o OrderedObject) MarshalJSON() ([]byte, error)

MarshalJSON serializes OrderedObject as a JSON object without HTML escaping.

func (*OrderedObject) Set

func (o *OrderedObject) Set(key string, val any)

Set inserts or updates key in place while preserving initial insertion order.

func (*OrderedObject) UnmarshalJSON

func (o *OrderedObject) UnmarshalJSON(data []byte) error

UnmarshalJSON parses a JSON object into OrderedObject preserving wire order.

type ParsedAccessResource added in v2.8.19

type ParsedAccessResource struct {
	Kind string
	// Target is the part after "<kind>:" without any trailing "*".
	Target string
	Prefix bool
	// Canonical is the normalized resource string as stored.
	Canonical string
}

ParsedAccessResource is a validated resource string.

func ParseAccessResource added in v2.8.19

func ParseAccessResource(raw string, allowWildcard bool) (ParsedAccessResource, bool)

ParseAccessResource validates a rule resource (allowWildcard) or a concrete evaluated resource.

type PreparedHubSecretSeal added in v2.8.19

type PreparedHubSecretSeal struct {
	OK              bool   `json:"ok"`
	Name            string `json:"name,omitempty"`
	CleanKey        string `json:"cleanKey,omitempty"`
	HKDFInfo        string `json:"hkdfInfo,omitempty"`
	AAD             string `json:"aad,omitempty"`
	Plaintext       string `json:"plaintext,omitempty"`
	EnvelopeVersion string `json:"envelopeVersion,omitempty"`
	// NormalizedValue is the trimmed value the host fingerprints (SHA-256, first 8 hex) for status display.
	NormalizedValue string `json:"normalizedValue,omitempty"`
	Status          int    `json:"status,omitempty"`
	Error           string `json:"error,omitempty"`
	Message         string `json:"message,omitempty"`
}

PreparedHubSecretSeal holds Go-computed key material inputs for the host AEAD seal.

func PrepareHubSecretSeal added in v2.8.19

func PrepareHubSecretSeal(vaultMasterKey, rawName, rawValue string) PreparedHubSecretSeal

PrepareHubSecretSeal validates the master key, name, and value, then builds HKDF info, AAD, and plaintext.

type PreparedHubSecretUnseal added in v2.8.19

type PreparedHubSecretUnseal struct {
	OK        bool   `json:"ok"`
	CleanKey  string `json:"cleanKey,omitempty"`
	HKDFInfo  string `json:"hkdfInfo,omitempty"`
	AAD       string `json:"aad,omitempty"`
	SaltB64   string `json:"saltB64,omitempty"`
	IVB64     string `json:"ivB64,omitempty"`
	CTB64     string `json:"ctB64,omitempty"`
	SaltBytes []byte `json:"-"`
	IVBytes   []byte `json:"-"`
	CTBytes   []byte `json:"-"`
	Status    int    `json:"status,omitempty"`
	Error     string `json:"error,omitempty"`
	Message   string `json:"message,omitempty"`
}

PreparedHubSecretUnseal holds validated envelope parts for the host AEAD open.

func PrepareHubSecretUnseal added in v2.8.19

func PrepareHubSecretUnseal(vaultMasterKey, name, ciphertext string) PreparedHubSecretUnseal

PrepareHubSecretUnseal validates an "hs1" envelope for a stored row name (managed names only).

type PreparedVaultSeal

type PreparedVaultSeal struct {
	OK              bool   `json:"ok"`
	CleanKey        string `json:"cleanKey,omitempty"`
	HKDFInfo        string `json:"hkdfInfo,omitempty"`
	AAD             string `json:"aad,omitempty"`
	Plaintext       string `json:"plaintext,omitempty"`
	EnvelopeVersion string `json:"envelopeVersion,omitempty"`
	SecretVersion   int    `json:"secretVersion,omitempty"`
	Status          int    `json:"status,omitempty"`
	Error           string `json:"error,omitempty"`
	Message         string `json:"message,omitempty"`
}

PreparedVaultSeal holds Go-computed HKDF info, AAD, and canonical JSON plaintext for AEAD sealing.

func PrepareSealVaultEnvelope

func PrepareSealVaultEnvelope(params SealVaultParams) PreparedVaultSeal

PrepareSealVaultEnvelope validates parameters and constructs the canonical HKDF info, AAD, and JSON plaintext.

type PreparedVaultUnseal

type PreparedVaultUnseal struct {
	OK        bool                 `json:"ok"`
	CleanKey  string               `json:"cleanKey,omitempty"`
	SaltB64   string               `json:"saltB64,omitempty"`
	IVB64     string               `json:"ivB64,omitempty"`
	CTB64     string               `json:"ctB64,omitempty"`
	SaltBytes []byte               `json:"-"`
	IVBytes   []byte               `json:"-"`
	CTBytes   []byte               `json:"-"`
	Attempts  []VaultUnsealAttempt `json:"attempts,omitempty"`
	Error     string               `json:"error,omitempty"`
	Message   string               `json:"message,omitempty"`
}

PreparedVaultUnseal holds validated envelope components and ordered AEAD attempts.

func PrepareUnsealVaultEnvelope

func PrepareUnsealVaultEnvelope(params UnsealVaultParams) PreparedVaultUnseal

PrepareUnsealVaultEnvelope validates envelope headers, P6/M8 downgrade rules, and builds ordered AEAD attempts.

type PublicMCPServerSummary

type PublicMCPServerSummary struct {
	ID              string                `json:"id"`
	UserID          string                `json:"userId"`
	Slug            string                `json:"slug"`
	Name            string                `json:"name"`
	RemoteURL       string                `json:"remoteUrl"`
	RemoteOrigin    string                `json:"remoteOrigin"`
	Transport       string                `json:"transport"`
	AuthType        string                `json:"authType"`
	AuthSummary     MaskedAuthSummary     `json:"authSummary"`
	Domains         []string              `json:"domains"`
	AutoRouteScrape bool                  `json:"autoRouteScrape"`
	Tools           []CachedMCPToolSchema `json:"tools"`
	ToolCount       int                   `json:"toolCount"`
	Enabled         bool                  `json:"enabled"`
	LastVerifiedAt  *int64                `json:"lastVerifiedAt"`
	LastError       *string               `json:"lastError"`
	CreatedAt       int64                 `json:"createdAt"`
	UpdatedAt       int64                 `json:"updatedAt"`
}

PublicMCPServerSummary is the secret-free projection returned to /admin and query_mcp(list_connected).

func ToPublicMCPServerSummary

func ToPublicMCPServerSummary(row StoredMCPServerRow) PublicMCPServerSummary

ToPublicMCPServerSummary strips ciphertext and secretVersion for safe /admin and query_mcp exposure.

type RPCID

type RPCID struct {
	Present bool
	IsNum   bool
	Str     string
	Num     float64
}

RPCID represents an optional string or numeric JSON-RPC 2.0 request ID.

func (*RPCID) UnmarshalJSON

func (id *RPCID) UnmarshalJSON(data []byte) error

UnmarshalJSON parses an optional string or number JSON-RPC ID.

type SafeHTTPSURLResult

type SafeHTTPSURLResult struct {
	OK         bool   `json:"ok"`
	Normalized string `json:"normalized,omitempty"`
	Origin     string `json:"origin,omitempty"`
	Hostname   string `json:"hostname,omitempty"`
	Pathname   string `json:"pathname,omitempty"`
	Search     string `json:"search,omitempty"`
	Reason     string `json:"reason,omitempty"`
}

SafeHTTPSURLResult holds the outcome of IsSafePublicHTTPSURL.

func IsSafePublicHTTPSURL

func IsSafePublicHTTPSURL(rawURL, selfHost string) SafeHTTPSURLResult

IsSafePublicHTTPSURL validates that rawURL is a safe public https:// URL on port 443 with no credentials or fragments.

type SanitizedConnectorStructuredResult

type SanitizedConnectorStructuredResult struct {
	Value          any      `json:"value"`
	Sanitized      bool     `json:"sanitized"`
	FullySanitized bool     `json:"fullySanitized"`
	Truncated      bool     `json:"truncated"`
	Detected       bool     `json:"detected"`
	Scrubbed       bool     `json:"scrubbed"`
	Triggers       []string `json:"triggers"`
}

SanitizedConnectorStructuredResult reports recursive structured JSON sanitization results.

func SanitizeConnectorStructuredValue

func SanitizeConnectorStructuredValue(rawValue any, opts StructuredSanitizeOptions) SanitizedConnectorStructuredResult

SanitizeConnectorStructuredValue recursively sanitizes arbitrary connector JSON trees under strict depth/node/entry/char caps.

type SanitizedConnectorTextResult

type SanitizedConnectorTextResult struct {
	Text           string   `json:"text"`
	Sanitized      bool     `json:"sanitized"`
	FullySanitized bool     `json:"fullySanitized"`
	Truncated      bool     `json:"truncated"`
	Detected       bool     `json:"detected"`
	Scrubbed       bool     `json:"scrubbed"`
	Triggers       []string `json:"triggers"`
}

SanitizedConnectorTextResult reports full Markdown + link + injection sanitization on a string.

func SanitizeConnectorText

func SanitizeConnectorText(
	raw string,
	maxChars int,
	baseURL string,
	applyRedact bool,
	redactSecret *VaultSecretPayload,
) SanitizedConnectorTextResult

SanitizeConnectorText runs secret redaction -> prompt-injection scrubbing -> Markdown/HTML/link sanitization + post-verify.

func SanitizeConnectorTextWithExtra added in v2.8.29

func SanitizeConnectorTextWithExtra(
	raw string,
	maxChars int,
	baseURL string,
	applyRedact bool,
	redactSecret *VaultSecretPayload,
	extraSecrets ...string,
) SanitizedConnectorTextResult

SanitizeConnectorTextWithExtra runs secret redaction (including extraSecrets) -> prompt-injection scrubbing -> Markdown sanitization.

type SanitizedTextResult

type SanitizedTextResult struct {
	Text     string   `json:"text"`
	Detected bool     `json:"detected"`
	Scrubbed bool     `json:"scrubbed"`
	Triggers []string `json:"triggers"`
}

SanitizedTextResult reports prompt-injection scrubbing results from SanitizeRemoteMCPText.

func SanitizeRemoteMCPText

func SanitizeRemoteMCPText(raw string, maxChars int) SanitizedTextResult

SanitizeRemoteMCPText strips smuggling chars and scrubs indirect prompt-injection instructions.

type SanitizedToolDefsResult

type SanitizedToolDefsResult struct {
	Tools                   []CachedMCPToolSchema `json:"tools"`
	PromptInjectionScrubbed bool                  `json:"promptInjectionScrubbed"`
	OversizedRejected       bool                  `json:"oversizedRejected,omitempty"`
}

SanitizedToolDefsResult holds sanitized downstream MCP tools/list schemas.

func SanitizeRemoteMCPToolDefs

func SanitizeRemoteMCPToolDefs(rawToolsJSON []byte) SanitizedToolDefsResult

SanitizeRemoteMCPToolDefs validates and sanitizes a downstream tools/list array under a 16 KiB raw schema ceiling (H3).

func SanitizeRemoteMCPToolDefsForOrigin added in v2.8.21

func SanitizeRemoteMCPToolDefsForOrigin(rawToolsJSON []byte, origin string) SanitizedToolDefsResult

SanitizeRemoteMCPToolDefsForOrigin is SanitizeRemoteMCPToolDefs with the raw ceiling chosen by ToolSchemaLimitForOrigin: 16 KiB (H3) for every server except verified first-party preset origins.

type ScrapeMCPPlan

type ScrapeMCPPlan struct {
	Matched          bool          `json:"matched"`
	NormalizedTarget string        `json:"normalizedTarget,omitempty"`
	SafeForwardURL   string        `json:"safeForwardUrl,omitempty"`
	ServerSlug       string        `json:"serverSlug,omitempty"`
	ToolName         string        `json:"toolName,omitempty"`
	ToolArguments    OrderedObject `json:"toolArguments,omitempty"`
}

ScrapeMCPPlan describes the selected MCP connector & read-only URL tool for tryScrapeViaConnectedMcp.

func SelectScrapeMCPCandidate

func SelectScrapeMCPCandidate(
	allRows []StoredMCPServerRow,
	targetURL string,
	query string,
	preferMCP bool,
	hasAllowedServerIDs bool,
	allowedServerIDs map[string]bool,
	allowedTools map[string]bool,
	requireExplicitReadOnlyHint bool,
	selfHost string,
) ScrapeMCPPlan

SelectScrapeMCPCandidate evaluates H1/S6 opt-in scrape routing rules and selects a permitted read-oriented URL tool.

type SealVaultParams

type SealVaultParams struct {
	VaultMasterKey string
	UserID         string
	RemoteOrigin   string
	ID             *string
	ServerID       *string
	Slug           *string
	AuthType       *string
	Payload        OrderedObject
}

SealVaultParams configures SealVaultCredentials / PrepareSealVaultEnvelope.

type SealVaultResult

type SealVaultResult struct {
	OK            bool   `json:"ok"`
	Ciphertext    string `json:"ciphertext,omitempty"`
	SecretVersion int    `json:"secretVersion,omitempty"`
	Status        int    `json:"status,omitempty"`
	Error         string `json:"error,omitempty"`
	Message       string `json:"message,omitempty"`
}

SealVaultResult is the outcome of SealVaultCredentials.

func SealVaultCredentials

func SealVaultCredentials(params SealVaultParams) SealVaultResult

SealVaultCredentials encrypts a VaultSecretPayload with HKDF-SHA256 + AES-256-GCM (v2 envelope).

type SharedServerRef added in v2.8.19

type SharedServerRef struct {
	OwnerUserID string `json:"ownerUserId"`
	Slug        string `json:"slug"`
	Ref         string `json:"ref"`
}

SharedServerRef identifies a server the caller may use through a share.

func ListSharedServersFor added in v2.8.19

func ListSharedServersFor(rules []AccessRule, shares []MCPServerShare, callerUserID string) []SharedServerRef

ListSharedServersFor returns the distinct (owner, slug) pairs shared with callerUserID that policy still allows, excluding the caller's own servers, sorted by owner then slug.

type SpecialSentinel

type SpecialSentinel struct {
	Kind string
	Raw  string
}

SpecialSentinel represents non-JSON JS values (functions/symbols, BigInt, circular refs) bridged over JSON.

type StoredMCPServerRow

type StoredMCPServerRow struct {
	ID                   string                `json:"id"`
	UserID               string                `json:"userId"`
	Slug                 string                `json:"slug"`
	Name                 string                `json:"name"`
	RemoteURL            string                `json:"remoteUrl"`
	RemoteOrigin         string                `json:"remoteOrigin"`
	Transport            string                `json:"transport"`
	AuthType             string                `json:"authType"`
	EncryptedCredentials *string               `json:"encryptedCredentials"`
	SecretVersion        *int                  `json:"secretVersion,omitempty"`
	AuthSummary          MaskedAuthSummary     `json:"authSummary"`
	Domains              []string              `json:"domains"`
	AutoRouteScrape      bool                  `json:"autoRouteScrape,omitempty"`
	CachedTools          []CachedMCPToolSchema `json:"cachedTools"`
	ToolCount            int                   `json:"toolCount"`
	Enabled              bool                  `json:"enabled"`
	LastVerifiedAt       *int64                `json:"lastVerifiedAt"`
	LastError            *string               `json:"lastError"`
	CreatedAt            int64                 `json:"createdAt"`
	UpdatedAt            int64                 `json:"updatedAt"`
}

StoredMCPServerRow represents a user_mcp_servers persistence row.

type StructuredSanitizeOptions

type StructuredSanitizeOptions struct {
	BaseURL                string
	ApplyRedact            bool
	RedactSecret           *VaultSecretPayload
	ExtraSecrets           []string
	MaxDepth               int
	MaxEntriesPerContainer int
	MaxNodeBudget          int
	MaxStringChars         int
	MaxTotalChars          *int
}

StructuredSanitizeOptions configures SanitizeConnectorStructuredValue.

type UnsealVaultParams

type UnsealVaultParams struct {
	VaultMasterKey string
	UserID         string
	RemoteOrigin   string
	RemoteURL      string
	ID             *string
	ServerID       *string
	Slug           *string
	AuthType       *string
	SecretVersion  *int
	Ciphertext     string
}

UnsealVaultParams configures UnsealVaultCredentials / PrepareUnsealVaultEnvelope.

type UnsealVaultResult

type UnsealVaultResult struct {
	OK                    bool          `json:"ok"`
	Payload               OrderedObject `json:"payload,omitempty"`
	ResealedCiphertext    string        `json:"resealedCiphertext,omitempty"`
	ResealedSecretVersion *int          `json:"resealedSecretVersion,omitempty"`
	NeedsReseal           bool          `json:"needsReseal,omitempty"`
	Error                 string        `json:"error,omitempty"`
	Message               string        `json:"message,omitempty"`
}

UnsealVaultResult is the outcome of UnsealVaultCredentials.

func UnsealVaultCredentials

func UnsealVaultCredentials(params UnsealVaultParams) UnsealVaultResult

UnsealVaultCredentials authenticates and decrypts an AES-256-GCM vault envelope with P6/M8 downgrade prevention and automatic reseal-on-read for legacy v1 / 2-field v2 rows.

func VerifyUnsealedVaultPlaintext

func VerifyUnsealedVaultPlaintext(params UnsealVaultParams, plainBuf []byte, attemptShouldReseal bool) UnsealVaultResult

VerifyUnsealedVaultPlaintext validates decrypted JSON credentials against pinned origin, URL, purpose, and row bindings.

type VaultSecretOAuth

type VaultSecretOAuth struct {
	AccessToken         string `json:"accessToken"`
	RefreshToken        string `json:"refreshToken,omitempty"`
	TokenType           string `json:"tokenType,omitempty"`
	ExpiresAt           *int64 `json:"expiresAt,omitempty"`
	Scope               string `json:"scope,omitempty"`
	Issuer              string `json:"issuer,omitempty"`
	Resource            string `json:"resource,omitempty"`
	TokenEndpoint       string `json:"tokenEndpoint"`
	ConfirmedAuthOrigin string `json:"confirmedAuthOrigin,omitempty"`
	ClientID            string `json:"clientId"`
	ClientSecret        string `json:"clientSecret,omitempty"`
}

VaultSecretOAuth holds downstream OAuth 2.1 tokens inside VaultSecretPayload.

type VaultSecretPayload

type VaultSecretPayload struct {
	Kind         string            `json:"kind"`
	PinnedOrigin string            `json:"pinnedOrigin"`
	PinnedURL    string            `json:"pinnedUrl,omitempty"`
	Purpose      string            `json:"purpose,omitempty"`
	ServerID     string            `json:"serverId,omitempty"`
	Slug         string            `json:"slug,omitempty"`
	AuthType     string            `json:"authType,omitempty"`
	Headers      OrderedObject     `json:"headers,omitempty"`
	OAuth        *VaultSecretOAuth `json:"oauth,omitempty"`
}

VaultSecretPayload represents the plaintext credential payload sealed inside user_mcp_servers.

func ParseVaultSecretPayloadObject

func ParseVaultSecretPayloadObject(obj OrderedObject) (VaultSecretPayload, error)

ParseVaultSecretPayloadObject extracts structured fields from an OrderedObject VaultSecretPayload.

type VaultUnsealAttempt

type VaultUnsealAttempt struct {
	HKDFInfo     string `json:"hkdfInfo"`
	AAD          string `json:"aad"`
	ShouldReseal bool   `json:"shouldReseal"`
	FailMessage  string `json:"failMessage"`
}

VaultUnsealAttempt describes one ordered AEAD decryption candidate (primary v2 5-field, legacy v2 2-field, or v1).

type VendorSubVendor added in v2.8.29

type VendorSubVendor struct {
	ServerID string `json:"serverId"`
	Endpoint string `json:"endpoint"`
	Domain   string `json:"domain"`
}

VendorSubVendor describes an individual vendor endpoint inside a grouped Official Vendor MCP catalog row.

type VendorToolPolicyResult added in v2.8.29

type VendorToolPolicyResult struct {
	Permitted            bool   `json:"permitted"`
	ErrorCode            string `json:"errorCode,omitempty"`
	Reason               string `json:"reason,omitempty"`
	RequiresWriteConsent bool   `json:"requiresWriteConsent,omitempty"`
	ReadOnlyOnlyBlocked  bool   `json:"readOnlyOnlyBlocked,omitempty"`
	MatchedVendor        string `json:"matchedVendor,omitempty"`
}

VendorToolPolicyResult reports the outcome of EvaluateVendorToolPolicy.

func EvaluateMCPToolPermission added in v2.8.29

func EvaluateMCPToolPermission(
	slug, remoteOrigin string,
	tool CachedMCPToolSchema,
	allowedSet map[string]bool,
	writeConsent bool,
	includeInternal bool,
) VendorToolPolicyResult

EvaluateMCPToolPermission combines Official Vendor Catalog policy (incl. stripe/mapbox ReadOnlyOnly lock), Virtual OAuth MCP facade policy, closed-API/internal-dealer guards, and custom connector S6 fallback.

func EvaluateVendorToolPolicy added in v2.8.29

func EvaluateVendorToolPolicy(
	slug, remoteOrigin string,
	tool CachedMCPToolSchema,
	allowedSet map[string]bool,
	writeConsent bool,
) VendorToolPolicyResult

EvaluateVendorToolPolicy enforces per-vendor read-only allowlists, unconditional ReadOnlyOnly locks (stripe, mapbox), and explicit per-call write consent without wildcards.

type VirtualMCPFacadeSpec added in v2.8.29

type VirtualMCPFacadeSpec struct {
	ServerID          string               `json:"serverId"`
	DisplayName       string               `json:"displayName"`
	Kind              string               `json:"kind"`
	MCPEndpoint       string               `json:"mcpEndpoint,omitempty"`
	RESTBaseURL       string               `json:"restBaseUrl,omitempty"`
	Transport         string               `json:"transport,omitempty"`
	AuthMethod        string               `json:"authMethod"`
	OAuthAuthorizeURL string               `json:"oauthAuthorizeUrl,omitempty"`
	OAuthTokenURL     string               `json:"oauthTokenUrl,omitempty"`
	Domains           []string             `json:"domains"`
	BridgeAdapter     string               `json:"bridgeAdapter,omitempty"`
	InternalOnly      bool                 `json:"internalOnly,omitempty"`
	ExposedPublicly   bool                 `json:"exposedPublicly"`
	ReadOnlyTools     []string             `json:"readOnlyTools"`
	WriteTools        []string             `json:"writeTools"`
	Tools             []VirtualMCPToolSpec `json:"tools"`
}

VirtualMCPFacadeSpec describes a Virtual OAuth MCP facade (or internal-only hook when explicitly requested).

func ListVirtualMCPFacades added in v2.8.29

func ListVirtualMCPFacades(includeInternal bool) []VirtualMCPFacadeSpec

ListVirtualMCPFacades returns Virtual OAuth MCP facade specs. Public callers (includeInternal == false) NEVER receive internal-only dealer portal hooks.

func LookupVirtualMCPFacade added in v2.8.29

func LookupVirtualMCPFacade(slugOrOrigin string, includeInternal bool) (VirtualMCPFacadeSpec, bool)

LookupVirtualMCPFacade resolves a Virtual OAuth MCP facade by canonical slug, bridge adapter, endpoint, or domain. When includeInternal is false, internal-only dealer portal targets always return (zero, false).

type VirtualMCPRESTMapping added in v2.8.29

type VirtualMCPRESTMapping struct {
	Matched     bool     `json:"matched"`
	ServerID    string   `json:"serverId,omitempty"`
	ToolName    string   `json:"toolName,omitempty"`
	Method      string   `json:"method,omitempty"`
	RESTBaseURL string   `json:"restBaseUrl,omitempty"`
	Path        string   `json:"path,omitempty"`
	FullPath    string   `json:"fullPath,omitempty"`
	PathParams  []string `json:"pathParams,omitempty"`
	QueryParams []string `json:"queryParams,omitempty"`
	BodyParams  []string `json:"bodyParams,omitempty"`
	ReadOnly    bool     `json:"readOnly"`
}

VirtualMCPRESTMapping describes the downstream REST API path/method/query mapping for a Virtual MCP tool.

func ResolveVirtualMCPRESTMapping added in v2.8.29

func ResolveVirtualMCPRESTMapping(slugOrOrigin, toolName string) (VirtualMCPRESTMapping, bool)

ResolveVirtualMCPRESTMapping returns the REST API method/path/query/body mapping for a public Virtual MCP tool, enabling direct REST API base connections without a prior tools/list round-trip.

type VirtualMCPToolPolicyResult added in v2.8.29

type VirtualMCPToolPolicyResult struct {
	Permitted            bool   `json:"permitted"`
	FacadeSlug           string `json:"facadeSlug,omitempty"`
	ToolName             string `json:"toolName,omitempty"`
	IsReadOnly           bool   `json:"isReadOnly"`
	RequiresWriteConsent bool   `json:"requiresWriteConsent"`
	InternalOnlyBlocked  bool   `json:"internalOnlyBlocked,omitempty"`
	ErrorCode            string `json:"errorCode,omitempty"`
	Reason               string `json:"reason,omitempty"`
}

VirtualMCPToolPolicyResult captures tool-level allowlist and write-consent evaluation for a Virtual MCP facade.

func EvaluateVirtualMCPToolPolicy added in v2.8.29

func EvaluateVirtualMCPToolPolicy(slugOrOrigin, toolName string, allowedSet map[string]bool, writeConsent bool, includeInternal bool) VirtualMCPToolPolicyResult

EvaluateVirtualMCPToolPolicy enforces closed-API refusal, internal-only non-exposure, curated read-only default allowlists, and explicit per-call write consent for Virtual OAuth MCP tools.

type VirtualMCPToolSpec added in v2.8.29

type VirtualMCPToolSpec struct {
	Name        string        `json:"name"`
	Title       string        `json:"title,omitempty"`
	Description string        `json:"description,omitempty"`
	ReadOnly    bool          `json:"readOnly"`
	Destructive bool          `json:"destructive,omitempty"`
	InputSchema OrderedObject `json:"inputSchema"`
}

VirtualMCPToolSpec describes a curated tool exposed by a Virtual OAuth MCP facade.

func (VirtualMCPToolSpec) ToCachedToolSchema added in v2.8.29

func (t VirtualMCPToolSpec) ToCachedToolSchema() CachedMCPToolSchema

ToCachedToolSchema converts a VirtualMCPToolSpec into a CachedMCPToolSchema with readOnlyHint/destructiveHint.

Jump to

Keyboard shortcuts

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