mcproutes

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package mcproutes defines AppTheory's versioned MCP route algebra.

Index

Constants

View Source
const (
	// ContractVersion is the MCP route-algebra contract implemented by this package.
	ContractVersion = "m17.mcp-route-algebra/v1"
	// ParamClientNamespace is the canonical client-namespace route parameter name.
	ParamClientNamespace = "client_namespace"
	// ParamPartnerID is the canonical partner route parameter name.
	ParamPartnerID = "partner_id"
	// ParamAgentID is the canonical agent route parameter name.
	ParamAgentID = "agent_id"

	// ProtectedResourcePrefix is the RFC 9728 protected-resource metadata prefix.
	ProtectedResourcePrefix = "/.well-known/oauth-protected-resource"
	// AuthorizationServerPrefix is the RFC 8414 authorization-server metadata prefix.
	AuthorizationServerPrefix = "/.well-known/oauth-authorization-server"
)
View Source
const (
	// NamespaceMCPPattern is the canonical namespace MCP route pattern.
	NamespaceMCPPattern = "/{client_namespace}/mcp"
	// PartnerNamespaceMCPPattern is the canonical partner-scoped namespace MCP route pattern.
	PartnerNamespaceMCPPattern = "/{client_namespace}/partners/{partner_id}/mcp"
	// AgentMCPPattern is the canonical agent MCP route pattern.
	AgentMCPPattern = "/{client_namespace}/agents/{agent_id}/mcp"
	// PartnerAgentMCPPattern is the canonical partner-scoped agent MCP route pattern.
	PartnerAgentMCPPattern = "/{client_namespace}/partners/{partner_id}/agents/{agent_id}/mcp"
)

Variables

This section is empty.

Functions

func AuthorizationAuthorizePathForResourcePath

func AuthorizationAuthorizePathForResourcePath(resourcePath string) string

AuthorizationAuthorizePathForResourcePath derives the authorization facade path.

func AuthorizationServerPathForResourcePath

func AuthorizationServerPathForResourcePath(resourcePath string) string

AuthorizationServerPathForResourcePath derives the canonical RFC 8414 discovery path.

func AuthorizationServerSuffixPathForResourcePath

func AuthorizationServerSuffixPathForResourcePath(resourcePath string) string

AuthorizationServerSuffixPathForResourcePath derives the suffix-compatible RFC 8414 discovery path.

func AuthorizationTokenPathForResourcePath

func AuthorizationTokenPathForResourcePath(resourcePath string) string

AuthorizationTokenPathForResourcePath derives the token facade path.

func ProtectedResourcePathForResourcePath

func ProtectedResourcePathForResourcePath(resourcePath string) string

ProtectedResourcePathForResourcePath derives an RFC 9728 protected-resource path.

func ProtectedResourcePathFromMCPPath

func ProtectedResourcePathFromMCPPath(mcpPath string) string

ProtectedResourcePathFromMCPPath derives the protected-resource path for an MCP path.

func ResourcePathFromProtectedResourcePath

func ResourcePathFromProtectedResourcePath(protectedResourcePath string) (string, error)

ResourcePathFromProtectedResourcePath recovers a resource path from its RFC 9728 metadata path.

Types

type EndpointKind

type EndpointKind string

EndpointKind identifies a canonical MCP endpoint shape.

const (
	// EndpointKindNamespace identifies a namespace MCP endpoint.
	EndpointKindNamespace EndpointKind = "namespace"
	// EndpointKindPartnerNamespace identifies a partner-scoped namespace MCP endpoint.
	EndpointKindPartnerNamespace EndpointKind = "partner_namespace"
	// EndpointKindAgent identifies an agent MCP endpoint.
	EndpointKindAgent EndpointKind = "agent"
	// EndpointKindPartnerAgent identifies a partner-scoped agent MCP endpoint.
	EndpointKindPartnerAgent EndpointKind = "partner_agent"
)

type EndpointPath

type EndpointPath struct {
	Kind            EndpointKind
	ClientNamespace string
	PartnerID       string
	AgentID         string
}

EndpointPath is a concrete canonical MCP endpoint.

func ParseMCPPath

func ParseMCPPath(rawPath string) (EndpointPath, error)

ParseMCPPath parses a concrete MCP path after contract normalization.

func (EndpointPath) MCPPath

func (e EndpointPath) MCPPath() (string, error)

MCPPath builds the concrete MCP path for the endpoint.

func (EndpointPath) OAuthAuthorizationServerPath

func (e EndpointPath) OAuthAuthorizationServerPath() (string, error)

OAuthAuthorizationServerPath builds the endpoint's canonical RFC 8414 discovery path.

func (EndpointPath) OAuthAuthorizationServerSuffixPath

func (e EndpointPath) OAuthAuthorizationServerSuffixPath() (string, error)

OAuthAuthorizationServerSuffixPath builds the endpoint's suffix-compatible RFC 8414 discovery path.

func (EndpointPath) OAuthAuthorizePath

func (e EndpointPath) OAuthAuthorizePath() (string, error)

OAuthAuthorizePath builds the endpoint's authorization facade path.

func (EndpointPath) OAuthTokenPath

func (e EndpointPath) OAuthTokenPath() (string, error)

OAuthTokenPath builds the endpoint's token facade path.

func (EndpointPath) ProtectedResourcePath

func (e EndpointPath) ProtectedResourcePath() (string, error)

ProtectedResourcePath builds the endpoint's RFC 9728 protected-resource path.

func (EndpointPath) Validate

func (e EndpointPath) Validate() error

Validate verifies kind-to-identifier consistency and path-segment safety.

type EndpointTemplate

type EndpointTemplate struct {
	Kind                  EndpointKind
	MCPPattern            string
	ProtectedResourcePath string
}

EndpointTemplate describes a canonical MCP route pattern and its protected-resource route.

func SupportedEndpointTemplates

func SupportedEndpointTemplates() []EndpointTemplate

SupportedEndpointTemplates returns every canonical MCP endpoint template in contract order.

type OAuthDiscoveryTemplate

type OAuthDiscoveryTemplate struct {
	Kind             EndpointKind
	CanonicalPattern string
	SuffixPattern    string
}

OAuthDiscoveryTemplate describes canonical and suffix-compatible discovery routes.

func SupportedOAuthDiscoveryTemplates

func SupportedOAuthDiscoveryTemplates() []OAuthDiscoveryTemplate

SupportedOAuthDiscoveryTemplates returns every canonical OAuth discovery template in contract order.

type OAuthFacadeTemplate

type OAuthFacadeTemplate struct {
	Kind             EndpointKind
	AuthorizePattern string
	TokenPattern     string
}

OAuthFacadeTemplate describes the authorization facade routes for an MCP endpoint kind.

func SupportedOAuthFacadeTemplates

func SupportedOAuthFacadeTemplates() []OAuthFacadeTemplate

SupportedOAuthFacadeTemplates returns every canonical OAuth facade template in contract order.

Jump to

Keyboard shortcuts

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