Skip to content

Replace embedded JSON schemas with extensible schema index #30

@jpower432

Description

@jpower432

Summary

Replace the hardcoded embedded JSON schemas with a schema index that maps platform names to schema sources. Remove the pre-generated JSON files and BuiltInPlatforms list — the index becomes the single registry of known platforms.

Current Behavior

Five platforms are hardcoded in schemas/embed.go with pre-generated JSON schema files under schemas/json-schema/ and CUE sources under schemas/cue/. Adding a new platform requires writing CUE, generating JSON, modifying Go code, and cutting a release.

Desired Behavior

Ship a schema index (e.g. schemas/index.yaml) embedded in the binary that maps platform names to schema sources. Sources can be any supported scheme:

ci:
  source: cue://cue.dev/x/githubactions@v0#Workflow
kubernetes:
  source: https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/v3/apis__apps__v1_openapi.json
docker:
  source: file://schemas/docker.cue
custom-platform:
  source: oci://registry.example.com/schemas/custom:v1

The index is source-agnostic — each platform points at whatever schema source makes sense (CUE registry, HTTPS URL, file embedded in the container image, OCI artifact). The existing schema loading infrastructure already handles all these schemes.

When a user writes --schema ci, the MCP server resolves it through the index. Users can still override with explicit --schema ci=cue://... syntax, and can extend the index via config to register new platforms without code changes or a new release.

Adding platform support becomes a data problem (add a line to the index), not a code problem.

What gets removed

  • schemas/json-schema/*.json — pre-generated JSON schemas
  • schemas.BuiltInPlatforms hardcoded list
  • GetBuiltInSchema() and GetBuiltInCUESchema() functions

Context

Discovered during #24 (plugin distribution) design. The CUE definition fragment fix proves the CUE registry path works end-to-end from inside a container. With multiple schema source types already supported, the embedded JSON files are unnecessary scaffolding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions