Skip to content

Commit f4657e5

Browse files
committed
Migrate publisher to pkg.ServerJSON
Signed-off-by: Radoslav Dimitrov <[email protected]>
1 parent e3b43f4 commit f4657e5

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

tools/publisher/main.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,6 @@ const (
2929

3030
// Server structure types for JSON generation
3131

32-
33-
34-
type ServerJSON struct {
35-
Schema string `json:"$schema"`
36-
Name string `json:"name"`
37-
Description string `json:"description"`
38-
Status string `json:"status,omitempty"`
39-
Repository model.Repository `json:"repository"`
40-
VersionDetail model.VersionDetail `json:"version_detail"`
41-
Packages []model.Package `json:"packages"`
42-
}
43-
4432
func main() {
4533
if len(os.Args) < 2 {
4634
printUsage()
@@ -486,7 +474,7 @@ func createServerStructure(
486474
name, description, version, repoURL, repoSource, registryName,
487475
packageName, packageVersion, runtimeHint, execute string,
488476
envVars []string, packageArgs []string, status string,
489-
) ServerJSON {
477+
) model.ServerJSON {
490478
// Parse environment variables
491479
environmentVariables := parseEnvironmentVariables(envVars)
492480

@@ -552,12 +540,23 @@ func createServerStructure(
552540
EnvironmentVariables: environmentVariables,
553541
}
554542

543+
// Convert string status to model.Status type
544+
var statusValue model.Status
545+
switch status {
546+
case "active":
547+
statusValue = model.StatusActive
548+
case "deprecated":
549+
statusValue = model.StatusDeprecated
550+
default:
551+
statusValue = model.StatusActive // fallback to active
552+
}
553+
555554
// Create server structure
556-
return ServerJSON{
555+
return model.ServerJSON{
557556
Schema: "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
558557
Name: name,
559558
Description: description,
560-
Status: status,
559+
Status: statusValue,
561560
Repository: model.Repository{
562561
URL: repoURL,
563562
Source: repoSource,

0 commit comments

Comments
 (0)