@@ -30,31 +30,6 @@ const (
30
30
// Server structure types for JSON generation
31
31
32
32
33
- type EnvironmentVariable struct {
34
- Name string `json:"name"`
35
- Description string `json:"description"`
36
- }
37
-
38
- type RuntimeArgument struct {
39
- Description string `json:"description"`
40
- IsRequired bool `json:"is_required"`
41
- Format string `json:"format"`
42
- Value string `json:"value"`
43
- Default string `json:"default"`
44
- Type string `json:"type"`
45
- ValueHint string `json:"value_hint"`
46
- }
47
-
48
- type Package struct {
49
- RegistryType string `json:"registry_type,omitempty"`
50
- RegistryBaseURL string `json:"registry_base_url,omitempty"`
51
- Identifier string `json:"identifier,omitempty"`
52
- Version string `json:"version,omitempty"`
53
- RuntimeHint string `json:"runtime_hint,omitempty"`
54
- RuntimeArguments []RuntimeArgument `json:"runtime_arguments,omitempty"`
55
- PackageArguments []RuntimeArgument `json:"package_arguments,omitempty"`
56
- EnvironmentVariables []EnvironmentVariable `json:"environment_variables,omitempty"`
57
- }
58
33
59
34
type ServerJSON struct {
60
35
Schema string `json:"$schema"`
@@ -63,7 +38,7 @@ type ServerJSON struct {
63
38
Status string `json:"status,omitempty"`
64
39
Repository model.Repository `json:"repository"`
65
40
VersionDetail model.VersionDetail `json:"version_detail"`
66
- Packages []Package `json:"packages"`
41
+ Packages []model. Package `json:"packages"`
67
42
}
68
43
69
44
func main () {
@@ -404,29 +379,31 @@ func publishToRegistry(registryURL string, mcpData []byte, token string) error {
404
379
}
405
380
406
381
// parseEnvironmentVariables parses environment variable specifications
407
- func parseEnvironmentVariables (envVars []string ) []EnvironmentVariable {
408
- var environmentVariables []EnvironmentVariable
382
+ func parseEnvironmentVariables (envVars []string ) []model. KeyValueInput {
383
+ var environmentVariables []model. KeyValueInput
409
384
for _ , envVar := range envVars {
410
385
parts := strings .SplitN (envVar , ":" , 2 )
386
+ description := fmt .Sprintf ("Environment variable for %s" , parts [0 ])
411
387
if len (parts ) == 2 {
412
- environmentVariables = append (environmentVariables , EnvironmentVariable {
413
- Name : parts [0 ],
414
- Description : parts [1 ],
415
- })
416
- } else {
417
- // If no description provided, use a default
418
- environmentVariables = append (environmentVariables , EnvironmentVariable {
419
- Name : parts [0 ],
420
- Description : fmt .Sprintf ("Environment variable for %s" , parts [0 ]),
421
- })
388
+ description = parts [1 ]
422
389
}
390
+
391
+ environmentVariables = append (environmentVariables , model.KeyValueInput {
392
+ Name : parts [0 ],
393
+ InputWithVariables : model.InputWithVariables {
394
+ Input : model.Input {
395
+ Description : description ,
396
+ Format : model .FormatString ,
397
+ },
398
+ },
399
+ })
423
400
}
424
401
return environmentVariables
425
402
}
426
403
427
404
// parsePackageArguments parses package argument specifications
428
- func parsePackageArguments (packageArgs []string ) []RuntimeArgument {
429
- var packageArguments []RuntimeArgument
405
+ func parsePackageArguments (packageArgs []string ) []model. Argument {
406
+ var packageArguments []model. Argument
430
407
for i , pkgArg := range packageArgs {
431
408
parts := strings .SplitN (pkgArg , ":" , 2 )
432
409
value := parts [0 ]
@@ -435,22 +412,26 @@ func parsePackageArguments(packageArgs []string) []RuntimeArgument {
435
412
description = parts [1 ]
436
413
}
437
414
438
- packageArguments = append (packageArguments , RuntimeArgument {
439
- Description : description ,
440
- IsRequired : true , // Package arguments are typically required
441
- Format : "string" ,
442
- Value : value ,
443
- Default : value ,
444
- Type : "positional" ,
445
- ValueHint : value ,
415
+ packageArguments = append (packageArguments , model.Argument {
416
+ Type : model .ArgumentTypePositional ,
417
+ ValueHint : value ,
418
+ InputWithVariables : model.InputWithVariables {
419
+ Input : model.Input {
420
+ Description : description ,
421
+ IsRequired : true , // Package arguments are typically required
422
+ Format : model .FormatString ,
423
+ Value : value ,
424
+ Default : value ,
425
+ },
426
+ },
446
427
})
447
428
}
448
429
return packageArguments
449
430
}
450
431
451
432
// parseRuntimeArguments parses the execute command to create runtime arguments
452
- func parseRuntimeArguments (execute string ) []RuntimeArgument {
453
- var runtimeArguments []RuntimeArgument
433
+ func parseRuntimeArguments (execute string ) []model. Argument {
434
+ var runtimeArguments []model. Argument
454
435
if execute == "" {
455
436
return runtimeArguments
456
437
}
@@ -464,14 +445,18 @@ func parseRuntimeArguments(execute string) []RuntimeArgument {
464
445
// Skip the first part (command) and add each argument as a runtime argument
465
446
for i , arg := range parts [1 :] {
466
447
description := getArgumentDescription (arg , i , parts )
467
- runtimeArguments = append (runtimeArguments , RuntimeArgument {
468
- Description : description ,
469
- IsRequired : false ,
470
- Format : "string" ,
471
- Value : arg ,
472
- Default : arg ,
473
- Type : "positional" ,
474
- ValueHint : arg ,
448
+ runtimeArguments = append (runtimeArguments , model.Argument {
449
+ Type : model .ArgumentTypePositional ,
450
+ ValueHint : arg ,
451
+ InputWithVariables : model.InputWithVariables {
452
+ Input : model.Input {
453
+ Description : description ,
454
+ IsRequired : false ,
455
+ Format : model .FormatString ,
456
+ Value : arg ,
457
+ Default : arg ,
458
+ },
459
+ },
475
460
})
476
461
}
477
462
@@ -556,12 +541,12 @@ func createServerStructure(
556
541
}
557
542
558
543
// Create package with new structured fields
559
- pkg := Package {
544
+ pkg := model. Package {
560
545
RegistryType : registryTypeValue ,
561
546
RegistryBaseURL : registryBaseURLValue ,
562
547
Identifier : identifier ,
563
548
Version : packageVersion ,
564
- RuntimeHint : runtimeHint ,
549
+ RunTimeHint : runtimeHint ,
565
550
RuntimeArguments : runtimeArguments ,
566
551
PackageArguments : packageArguments ,
567
552
EnvironmentVariables : environmentVariables ,
@@ -580,7 +565,7 @@ func createServerStructure(
580
565
VersionDetail : model.VersionDetail {
581
566
Version : version ,
582
567
},
583
- Packages : []Package {pkg },
568
+ Packages : []model. Package {pkg },
584
569
}
585
570
}
586
571
0 commit comments