Skip to content

Commit 85451ea

Browse files
committed
Reorganise model/types.go
Signed-off-by: Radoslav Dimitrov <[email protected]>
1 parent 28244e6 commit 85451ea

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

internal/service/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package service
22

33
import apiv1 "github.com/modelcontextprotocol/registry/pkg/api/v1"
44

5-
// RegistryService defines the interface for registry operations with extension wrapper architecture
5+
// RegistryService defines the interface for registry operations
66
type RegistryService interface {
77
// List retrieves servers with unified format
88
List(cursor string, limit int) ([]apiv1.ServerRecord, string, error)

pkg/model/types.go

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,41 @@ const (
99
StatusDeleted Status = "deleted"
1010
)
1111

12+
// ServerJSON represents complete server information as defined in the MCP spec (pure, no registry metadata)
13+
type ServerJSON struct {
14+
Schema string `json:"$schema,omitempty" bson:"$schema,omitempty"`
15+
Name string `json:"name" minLength:"1" maxLength:"200" bson:"name"`
16+
Description string `json:"description" minLength:"1" maxLength:"100" bson:"description"`
17+
Status Status `json:"status,omitempty" minLength:"1" bson:"status,omitempty"`
18+
Repository Repository `json:"repository,omitempty" bson:"repository"`
19+
VersionDetail VersionDetail `json:"version_detail" bson:"version_detail"`
20+
Packages []Package `json:"packages,omitempty" bson:"packages,omitempty"`
21+
Remotes []Remote `json:"remotes,omitempty" bson:"remotes,omitempty"`
22+
}
23+
24+
// Package represents a package configuration
25+
type Package struct {
26+
// RegistryType indicates how to download packages (e.g., "npm", "pypi", "docker-hub", "mcpb")
27+
RegistryType string `json:"registry_type,omitempty" bson:"registry_type,omitempty"`
28+
// RegistryBaseURL is the base URL of the package registry
29+
RegistryBaseURL string `json:"registry_base_url,omitempty" bson:"registry_base_url,omitempty"`
30+
// Identifier is the package identifier - either a package name (for registries) or URL (for direct downloads)
31+
Identifier string `json:"identifier,omitempty" bson:"identifier,omitempty"`
32+
Version string `json:"version,omitempty" bson:"version,omitempty"`
33+
FileSHA256 string `json:"file_sha256,omitempty" bson:"file_sha256,omitempty"`
34+
RunTimeHint string `json:"runtime_hint,omitempty" bson:"runtime_hint,omitempty"`
35+
RuntimeArguments []Argument `json:"runtime_arguments,omitempty" bson:"runtime_arguments,omitempty"`
36+
PackageArguments []Argument `json:"package_arguments,omitempty" bson:"package_arguments,omitempty"`
37+
EnvironmentVariables []KeyValueInput `json:"environment_variables,omitempty" bson:"environment_variables,omitempty"`
38+
}
39+
40+
// Remote represents a remote connection endpoint
41+
type Remote struct {
42+
TransportType string `json:"transport_type" bson:"transport_type"`
43+
URL string `json:"url" format:"uri" bson:"url"`
44+
Headers []KeyValueInput `json:"headers,omitempty" bson:"headers,omitempty"`
45+
}
46+
1247
// Repository represents a source code repository as defined in the spec
1348
type Repository struct {
1449
URL string `json:"url" bson:"url"`
@@ -66,42 +101,7 @@ type Argument struct {
66101
ValueHint string `json:"value_hint,omitempty" bson:"value_hint,omitempty"`
67102
}
68103

69-
// Package represents a package configuration
70-
type Package struct {
71-
// RegistryType indicates how to download packages (e.g., "npm", "pypi", "docker-hub", "mcpb")
72-
RegistryType string `json:"registry_type,omitempty" bson:"registry_type,omitempty"`
73-
// RegistryBaseURL is the base URL of the package registry
74-
RegistryBaseURL string `json:"registry_base_url,omitempty" bson:"registry_base_url,omitempty"`
75-
// Identifier is the package identifier - either a package name (for registries) or URL (for direct downloads)
76-
Identifier string `json:"identifier,omitempty" bson:"identifier,omitempty"`
77-
Version string `json:"version,omitempty" bson:"version,omitempty"`
78-
FileSHA256 string `json:"file_sha256,omitempty" bson:"file_sha256,omitempty"`
79-
RunTimeHint string `json:"runtime_hint,omitempty" bson:"runtime_hint,omitempty"`
80-
RuntimeArguments []Argument `json:"runtime_arguments,omitempty" bson:"runtime_arguments,omitempty"`
81-
PackageArguments []Argument `json:"package_arguments,omitempty" bson:"package_arguments,omitempty"`
82-
EnvironmentVariables []KeyValueInput `json:"environment_variables,omitempty" bson:"environment_variables,omitempty"`
83-
}
84-
85-
// Remote represents a remote connection endpoint
86-
type Remote struct {
87-
TransportType string `json:"transport_type" bson:"transport_type"`
88-
URL string `json:"url" format:"uri" bson:"url"`
89-
Headers []KeyValueInput `json:"headers,omitempty" bson:"headers,omitempty"`
90-
}
91-
92104
// VersionDetail represents the version details of a server (pure MCP spec, no registry metadata)
93105
type VersionDetail struct {
94106
Version string `json:"version" bson:"version"`
95107
}
96-
97-
// ServerJSON represents complete server information as defined in the MCP spec (pure, no registry metadata)
98-
type ServerJSON struct {
99-
Schema string `json:"$schema,omitempty" bson:"$schema,omitempty"`
100-
Name string `json:"name" minLength:"1" maxLength:"200" bson:"name"`
101-
Description string `json:"description" minLength:"1" maxLength:"100" bson:"description"`
102-
Status Status `json:"status,omitempty" minLength:"1" bson:"status,omitempty"`
103-
Repository Repository `json:"repository,omitempty" bson:"repository"`
104-
VersionDetail VersionDetail `json:"version_detail" bson:"version_detail"`
105-
Packages []Package `json:"packages,omitempty" bson:"packages,omitempty"`
106-
Remotes []Remote `json:"remotes,omitempty" bson:"remotes,omitempty"`
107-
}

0 commit comments

Comments
 (0)