Documentation
¶
Overview ¶
Package mcproutes defines AppTheory's versioned MCP route algebra.
Index ¶
- Constants
- func AuthorizationAuthorizePathForResourcePath(resourcePath string) string
- func AuthorizationServerPathForResourcePath(resourcePath string) string
- func AuthorizationServerSuffixPathForResourcePath(resourcePath string) string
- func AuthorizationTokenPathForResourcePath(resourcePath string) string
- func ProtectedResourcePathForResourcePath(resourcePath string) string
- func ProtectedResourcePathFromMCPPath(mcpPath string) string
- func ResourcePathFromProtectedResourcePath(protectedResourcePath string) (string, error)
- type EndpointKind
- type EndpointPath
- func (e EndpointPath) MCPPath() (string, error)
- func (e EndpointPath) OAuthAuthorizationServerPath() (string, error)
- func (e EndpointPath) OAuthAuthorizationServerSuffixPath() (string, error)
- func (e EndpointPath) OAuthAuthorizePath() (string, error)
- func (e EndpointPath) OAuthTokenPath() (string, error)
- func (e EndpointPath) ProtectedResourcePath() (string, error)
- func (e EndpointPath) Validate() error
- type EndpointTemplate
- type OAuthDiscoveryTemplate
- type OAuthFacadeTemplate
Constants ¶
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" )
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 ¶
AuthorizationAuthorizePathForResourcePath derives the authorization facade path.
func AuthorizationServerPathForResourcePath ¶
AuthorizationServerPathForResourcePath derives the canonical RFC 8414 discovery path.
func AuthorizationServerSuffixPathForResourcePath ¶
AuthorizationServerSuffixPathForResourcePath derives the suffix-compatible RFC 8414 discovery path.
func AuthorizationTokenPathForResourcePath ¶
AuthorizationTokenPathForResourcePath derives the token facade path.
func ProtectedResourcePathForResourcePath ¶
ProtectedResourcePathForResourcePath derives an RFC 9728 protected-resource path.
func ProtectedResourcePathFromMCPPath ¶
ProtectedResourcePathFromMCPPath derives the protected-resource path for an MCP 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.