mcp

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// URI schemes
	URIScheme = "complypack"

	// Resource types
	ResourceTypeCatalog   = "catalog"
	ResourceTypeMapping   = "mapping"
	ResourceTypeSchema    = "schema"
	ResourceTypeEvaluator = "evaluator"

	// MIME types
	MIMETypeYAML       = "application/yaml"
	MIMETypeJSON       = "application/json"
	MIMETypeJSONSchema = "application/schema+json"
	MIMETypeCUE        = "application/cue"
)

Variables

This section is empty.

Functions

func GetApplicabilityGroupsHandler added in v0.0.6

func GetApplicabilityGroupsHandler(store *ResourceStore) mcp.ToolHandler

GetApplicabilityGroupsHandler returns the handler (for testing).

func GetAssessmentRequirementsHandler

func GetAssessmentRequirementsHandler(store *ResourceStore) mcp.ToolHandler

GetAssessmentRequirementsHandler returns the handler (for testing).

func GetTestPolicyHandler

func GetTestPolicyHandler(s *Server) mcp.ToolHandler

GetTestPolicyHandler exposes handler for testing.

func GetValidatePolicyHandler

func GetValidatePolicyHandler(s *Server) mcp.ToolHandler

GetValidatePolicyHandler exposes handler for testing.

Types

type ResourceStore

type ResourceStore struct {
	// contains filtered or unexported fields
}

ResourceStore manages artifacts and schemas for MCP resource and tool handlers.

func NewResourceStore

func NewResourceStore(
	artifacts map[string]any,
	resolved map[string]*requirement.ResolvedPolicy,
	schemas map[string][]byte,
	cueSchemas map[string]cue.Value,
	evaluators *evaluator.Registry,
) *ResourceStore

NewResourceStore creates a ResourceStore.

func (*ResourceStore) CUESchema

func (rs *ResourceStore) CUESchema(platform string) (cue.Value, error)

CUESchema returns the compiled CUE schema for a platform. Returns an error if the platform has no CUE schema loaded.

func (*ResourceStore) ListResources

func (rs *ResourceStore) ListResources(ctx context.Context) ([]mcp.Resource, error)

ListResources returns all available catalog and schema resources.

func (*ResourceStore) ReadResource

func (rs *ResourceStore) ReadResource(ctx context.Context, uri string) ([]*mcp.ResourceContents, error)

ReadResource returns the content for a specific resource URI.

type Server

type Server struct {
	ResourceStore *ResourceStore
	// contains filtered or unexported fields
}

Server wraps the MCP SDK server with ComplyPack-specific state.

func NewServer

func NewServer(ctx context.Context, opts *ServerOptions) (*Server, error)

NewServer creates a ComplyPack MCP server. It loads the config, reads catalogs from local paths, loads platform schemas, validates the platform, and creates the MCP server with resource handlers.

Fails fast if: - Config file cannot be loaded or parsed - Any catalog file cannot be read - Platform is not supported - Duplicate catalog names are detected

func (*Server) Run

func (s *Server) Run(ctx context.Context, transport mcp.Transport) error

Run starts the MCP server on the given transport. It delegates to the underlying MCP SDK server's Run method.

type ServerOptions

type ServerOptions struct {
	// ConfigPath is the path to complypack.yaml.
	// Ignored when Config is set.
	ConfigPath string

	// Config provides configuration directly, bypassing file loading.
	// When set, ConfigPath is ignored.
	Config *config.ComplyPackConfig

	// OCIStore is the directory for OCI artifact caching.
	OCIStore string

	// CacheDir is the directory for MCP server caching.
	CacheDir string

	// EvaluatorRegistry provides available policy evaluators.
	// If nil, defaults to evaluator.DefaultRegistry().
	EvaluatorRegistry *evaluator.Registry
}

ServerOptions configures ComplyPack MCP server initialization.

Jump to

Keyboard shortcuts

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