Documentation
¶
Overview ¶
Package platformmode is the single source of truth for the MCP Runtime platform-mode selector (tenant/org/public) and the catalog namespace rules derived from it. The CLI, the API service, and the UI service all consume these helpers so they agree on environment-variable precedence and on which namespaces are considered the active shared catalog.
Index ¶
Constants ¶
const ( // DefaultOrgCatalogNamespace is the default namespace for ModeOrg. DefaultOrgCatalogNamespace = "mcp-servers-org" // DefaultPublicCatalogNamespace is the default namespace for ModePublic. DefaultPublicCatalogNamespace = "mcp-servers-public" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode string
Mode is the canonical lower-case representation of a platform mode.
const ( // ModeTenant scopes signed-in users to their own user/team namespaces. // No shared catalog is exposed; anonymous browsing is disabled. ModeTenant Mode = "tenant" // ModeOrg exposes a shared organization catalog that signed-in users may // publish into. Tenant namespaces remain reachable to their owners. ModeOrg Mode = "org" // ModePublic exposes a public catalog readable by anonymous clients and // writable by signed-in users. Tenant namespaces remain reachable to // their owners. ModePublic Mode = "public" )
func FromEnv ¶
func FromEnv() Mode
FromEnv reads the current platform mode from PLATFORM_MODE, falling back to MCP_PLATFORM_MODE. Unknown values resolve to ModeTenant.
func Normalize ¶
Normalize returns the canonical mode for raw. The second return value is true when raw was empty or matched a known mode; unknown values fall back to ModeTenant and return false.
func (Mode) CatalogNamespaces ¶
CatalogNamespaces returns the ordered list of catalog namespaces for the active mode. The first element is the namespace returned by DefaultCatalogNamespace; additional entries come from PLATFORM_CATALOG_NAMESPACES (with PLATFORM_PUBLIC_NAMESPACES as a public-mode-only fallback).
Extra-namespace precedence is the same in every caller — the CLI, API, and UI all share this logic to avoid drift.
func (Mode) DefaultCatalogNamespace ¶
DefaultCatalogNamespace returns the primary catalog namespace for the active mode. ModeTenant returns "" because there is no shared catalog.
Override precedence (first non-empty wins):
- PLATFORM_CATALOG_NAMESPACE
- MCP_PLATFORM_CATALOG_NAMESPACE
- mode-specific override (PLATFORM_ORG_NAMESPACE / PLATFORM_PUBLIC_NAMESPACE)
- built-in default (DefaultOrgCatalogNamespace / DefaultPublicCatalogNamespace)
func (Mode) IsCatalogNamespace ¶
IsCatalogNamespace reports whether namespace is one of the active mode's catalog namespaces.
func (Mode) PublicCatalogEnabled ¶
PublicCatalogEnabled reports whether anonymous clients may browse the catalog (true only for ModePublic).
func (Mode) SharedCatalogWritable ¶
SharedCatalogWritable reports whether signed-in users may publish into the active catalog namespace (true for ModeOrg and ModePublic).