Skip to content

Commit 4ca5291

Browse files
authored
Add YAML tags to registry types (#1358)
1 parent 4ebdb4e commit 4ca5291

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

pkg/registry/types.go

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -13,163 +13,163 @@ import (
1313
// Registry represents the top-level structure of the MCP registry
1414
type Registry struct {
1515
// Version is the schema version of the registry
16-
Version string `json:"version"`
16+
Version string `json:"version" yaml:"version"`
1717
// LastUpdated is the timestamp when the registry was last updated, in RFC3339 format
18-
LastUpdated string `json:"last_updated"`
18+
LastUpdated string `json:"last_updated" yaml:"last_updated"`
1919
// Servers is a map of server names to their corresponding server definitions
20-
Servers map[string]*ImageMetadata `json:"servers"`
20+
Servers map[string]*ImageMetadata `json:"servers" yaml:"servers"`
2121
// RemoteServers is a map of server names to their corresponding remote server definitions
2222
// These are MCP servers accessed via HTTP/HTTPS using the thv proxy command
23-
RemoteServers map[string]*RemoteServerMetadata `json:"remote_servers,omitempty"`
23+
RemoteServers map[string]*RemoteServerMetadata `json:"remote_servers,omitempty" yaml:"remote_servers,omitempty"`
2424
}
2525

2626
// BaseServerMetadata contains common fields shared between container and remote MCP servers
2727
type BaseServerMetadata struct {
2828
// Name is the identifier for the MCP server, used when referencing the server in commands
2929
// If not provided, it will be auto-generated from the registry key
30-
Name string `json:"name,omitempty"`
30+
Name string `json:"name,omitempty" yaml:"name,omitempty"`
3131
// Description is a human-readable description of the server's purpose and functionality
32-
Description string `json:"description"`
32+
Description string `json:"description" yaml:"description"`
3333
// Tier represents the tier classification level of the server, e.g., "Official" or "Community"
34-
Tier string `json:"tier"`
34+
Tier string `json:"tier" yaml:"tier"`
3535
// Status indicates whether the server is currently active or deprecated
36-
Status string `json:"status"`
36+
Status string `json:"status" yaml:"status"`
3737
// Transport defines the communication protocol for the server
3838
// For containers: stdio, sse, or streamable-http
3939
// For remote servers: sse or streamable-http (stdio not supported)
40-
Transport string `json:"transport"`
40+
Transport string `json:"transport" yaml:"transport"`
4141
// Tools is a list of tool names provided by this MCP server
42-
Tools []string `json:"tools"`
42+
Tools []string `json:"tools" yaml:"tools"`
4343
// Metadata contains additional information about the server such as popularity metrics
44-
Metadata *Metadata `json:"metadata,omitempty"`
44+
Metadata *Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
4545
// RepositoryURL is the URL to the source code repository for the server
46-
RepositoryURL string `json:"repository_url,omitempty"`
46+
RepositoryURL string `json:"repository_url,omitempty" yaml:"repository_url,omitempty"`
4747
// Tags are categorization labels for the server to aid in discovery and filtering
48-
Tags []string `json:"tags,omitempty"`
48+
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
4949
// CustomMetadata allows for additional user-defined metadata
50-
CustomMetadata map[string]any `json:"custom_metadata,omitempty"`
50+
CustomMetadata map[string]any `json:"custom_metadata,omitempty" yaml:"custom_metadata,omitempty"`
5151
}
5252

5353
// ImageMetadata represents the metadata for an MCP server image stored in our registry.
5454
type ImageMetadata struct {
5555
BaseServerMetadata
5656
// Image is the Docker image reference for the MCP server
57-
Image string `json:"image"`
57+
Image string `json:"image" yaml:"image"`
5858
// TargetPort is the port for the container to expose (only applicable to SSE and Streamable HTTP transports)
59-
TargetPort int `json:"target_port,omitempty"`
59+
TargetPort int `json:"target_port,omitempty" yaml:"target_port,omitempty"`
6060
// Permissions defines the security profile and access permissions for the server
61-
Permissions *permissions.Profile `json:"permissions,omitempty"`
61+
Permissions *permissions.Profile `json:"permissions,omitempty" yaml:"permissions,omitempty"`
6262
// EnvVars defines environment variables that can be passed to the server
63-
EnvVars []*EnvVar `json:"env_vars,omitempty"`
63+
EnvVars []*EnvVar `json:"env_vars,omitempty" yaml:"env_vars,omitempty"`
6464
// Args are the default command-line arguments to pass to the MCP server container.
6565
// These arguments will be used only if no command-line arguments are provided by the user.
6666
// If the user provides arguments, they will override these defaults.
67-
Args []string `json:"args,omitempty"`
67+
Args []string `json:"args,omitempty" yaml:"args,omitempty"`
6868
// DockerTags lists the available Docker tags for this server image
69-
DockerTags []string `json:"docker_tags,omitempty"`
69+
DockerTags []string `json:"docker_tags,omitempty" yaml:"docker_tags,omitempty"`
7070
// Provenance contains verification and signing metadata
71-
Provenance *Provenance `json:"provenance,omitempty"`
71+
Provenance *Provenance `json:"provenance,omitempty" yaml:"provenance,omitempty"`
7272
}
7373

7474
// Provenance contains metadata about the image's provenance and signing status
7575
type Provenance struct {
76-
SigstoreURL string `json:"sigstore_url"`
77-
RepositoryURI string `json:"repository_uri"`
78-
RepositoryRef string `json:"repository_ref"`
79-
SignerIdentity string `json:"signer_identity"`
80-
RunnerEnvironment string `json:"runner_environment"`
81-
CertIssuer string `json:"cert_issuer"`
82-
Attestation *VerifiedAttestation `json:"attestation,omitempty"`
76+
SigstoreURL string `json:"sigstore_url" yaml:"sigstore_url"`
77+
RepositoryURI string `json:"repository_uri" yaml:"repository_uri"`
78+
RepositoryRef string `json:"repository_ref" yaml:"repository_ref"`
79+
SignerIdentity string `json:"signer_identity" yaml:"signer_identity"`
80+
RunnerEnvironment string `json:"runner_environment" yaml:"runner_environment"`
81+
CertIssuer string `json:"cert_issuer" yaml:"cert_issuer"`
82+
Attestation *VerifiedAttestation `json:"attestation,omitempty" yaml:"attestation,omitempty"`
8383
}
8484

8585
// VerifiedAttestation represents the verified attestation information
8686
type VerifiedAttestation struct {
87-
PredicateType string `json:"predicate_type,omitempty"`
88-
Predicate any `json:"predicate,omitempty"`
87+
PredicateType string `json:"predicate_type,omitempty" yaml:"predicate_type,omitempty"`
88+
Predicate any `json:"predicate,omitempty" yaml:"predicate,omitempty"`
8989
}
9090

9191
// EnvVar represents an environment variable for an MCP server
9292
type EnvVar struct {
9393
// Name is the environment variable name (e.g., API_KEY)
94-
Name string `json:"name"`
94+
Name string `json:"name" yaml:"name"`
9595
// Description is a human-readable explanation of the variable's purpose
96-
Description string `json:"description"`
96+
Description string `json:"description" yaml:"description"`
9797
// Required indicates whether this environment variable must be provided
9898
// If true and not provided via command line or secrets, the user will be prompted for a value
99-
Required bool `json:"required"`
99+
Required bool `json:"required" yaml:"required"`
100100
// Default is the value to use if the environment variable is not explicitly provided
101101
// Only used for non-required variables
102-
Default string `json:"default,omitempty"`
102+
Default string `json:"default,omitempty" yaml:"default,omitempty"`
103103
// Secret indicates whether this environment variable contains sensitive information
104104
// If true, the value will be stored as a secret rather than as a plain environment variable
105-
Secret bool `json:"secret,omitempty"`
105+
Secret bool `json:"secret,omitempty" yaml:"secret,omitempty"`
106106
}
107107

108108
// Header represents an HTTP header for remote MCP server authentication
109109
type Header struct {
110110
// Name is the header name (e.g., X-API-Key, Authorization)
111-
Name string `json:"name"`
111+
Name string `json:"name" yaml:"name"`
112112
// Description is a human-readable explanation of the header's purpose
113-
Description string `json:"description"`
113+
Description string `json:"description" yaml:"description"`
114114
// Required indicates whether this header must be provided
115115
// If true and not provided via command line or secrets, the user will be prompted for a value
116-
Required bool `json:"required"`
116+
Required bool `json:"required" yaml:"required"`
117117
// Default is the value to use if the header is not explicitly provided
118118
// Only used for non-required headers
119-
Default string `json:"default,omitempty"`
119+
Default string `json:"default,omitempty" yaml:"default,omitempty"`
120120
// Secret indicates whether this header contains sensitive information
121121
// If true, the value will be stored as a secret rather than as plain text
122-
Secret bool `json:"secret,omitempty"`
122+
Secret bool `json:"secret,omitempty" yaml:"secret,omitempty"`
123123
// Choices provides a list of valid values for the header (optional)
124-
Choices []string `json:"choices,omitempty"`
124+
Choices []string `json:"choices,omitempty" yaml:"choices,omitempty"`
125125
}
126126

127127
// OAuthConfig represents OAuth/OIDC configuration for remote server authentication
128128
type OAuthConfig struct {
129129
// Issuer is the OAuth/OIDC issuer URL (e.g., https://accounts.google.com)
130130
// Used for OIDC discovery to find authorization and token endpoints
131-
Issuer string `json:"issuer,omitempty"`
131+
Issuer string `json:"issuer,omitempty" yaml:"issuer,omitempty"`
132132
// AuthorizeURL is the OAuth authorization endpoint URL
133133
// Used for non-OIDC OAuth flows when issuer is not provided
134-
AuthorizeURL string `json:"authorize_url,omitempty"`
134+
AuthorizeURL string `json:"authorize_url,omitempty" yaml:"authorize_url,omitempty"`
135135
// TokenURL is the OAuth token endpoint URL
136136
// Used for non-OIDC OAuth flows when issuer is not provided
137-
TokenURL string `json:"token_url,omitempty"`
137+
TokenURL string `json:"token_url,omitempty" yaml:"token_url,omitempty"`
138138
// ClientID is the OAuth client ID for authentication
139-
ClientID string `json:"client_id,omitempty"`
139+
ClientID string `json:"client_id,omitempty" yaml:"client_id,omitempty"`
140140
// Scopes are the OAuth scopes to request
141141
// If not specified, defaults to ["openid", "profile", "email"] for OIDC
142-
Scopes []string `json:"scopes,omitempty"`
142+
Scopes []string `json:"scopes,omitempty" yaml:"scopes,omitempty"`
143143
// UsePKCE indicates whether to use PKCE for the OAuth flow
144144
// Defaults to true for enhanced security
145-
UsePKCE bool `json:"use_pkce,omitempty"`
145+
UsePKCE bool `json:"use_pkce,omitempty" yaml:"use_pkce,omitempty"`
146146
}
147147

148148
// RemoteServerMetadata represents the metadata for a remote MCP server accessed via HTTP/HTTPS.
149149
// Remote servers are accessed through the thv proxy command which handles authentication and tunneling.
150150
type RemoteServerMetadata struct {
151151
BaseServerMetadata
152152
// URL is the endpoint URL for the remote MCP server (e.g., https://api.example.com/mcp)
153-
URL string `json:"url"`
153+
URL string `json:"url" yaml:"url"`
154154
// Headers defines HTTP headers that can be passed to the remote server for authentication
155155
// These are used with the thv proxy command's authentication features
156-
Headers []*Header `json:"headers,omitempty"`
156+
Headers []*Header `json:"headers,omitempty" yaml:"headers,omitempty"`
157157
// OAuthConfig provides OAuth/OIDC configuration for authentication to the remote server
158158
// Used with the thv proxy command's --remote-auth flags
159-
OAuthConfig *OAuthConfig `json:"oauth_config,omitempty"`
159+
OAuthConfig *OAuthConfig `json:"oauth_config,omitempty" yaml:"oauth_config,omitempty"`
160160
// EnvVars defines environment variables that can be passed to configure the client
161161
// These might be needed for client-side configuration when connecting to the remote server
162-
EnvVars []*EnvVar `json:"env_vars,omitempty"`
162+
EnvVars []*EnvVar `json:"env_vars,omitempty" yaml:"env_vars,omitempty"`
163163
}
164164

165165
// Metadata represents metadata about an MCP server
166166
type Metadata struct {
167167
// Stars represents the popularity rating or number of stars for the server
168-
Stars int `json:"stars"`
168+
Stars int `json:"stars" yaml:"stars"`
169169
// Pulls indicates how many times the server image has been downloaded
170-
Pulls int `json:"pulls"`
170+
Pulls int `json:"pulls" yaml:"pulls"`
171171
// LastUpdated is the timestamp when the server was last updated, in RFC3339 format
172-
LastUpdated string `json:"last_updated"`
172+
LastUpdated string `json:"last_updated" yaml:"last_updated"`
173173
}
174174

175175
// ParsedTime returns the LastUpdated field as a time.Time

0 commit comments

Comments
 (0)