Skip to content

Commit b21c6f5

Browse files
authored
Changes on the server.json format and the API (#562)
1 parent 4962609 commit b21c6f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4056
-5608
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,16 @@ lint-fix: ## Run linter with auto-fix (includes formatting)
5959
golangci-lint run --fix --timeout=5m
6060

6161
# Combined targets
62-
check: lint validate test-all ## Run all checks (lint, validate, unit tests)
62+
check: dev-down lint validate test-all ## Run all checks (lint, validate, unit tests) and ensure dev environment is down
6363
@echo "All checks passed!"
6464

6565
# Development targets
6666
dev-compose: ## Start development environment with Docker Compose (builds image automatically)
6767
docker compose up --build
6868

69+
dev-down: ## Stop development environment
70+
docker compose down
71+
6972
# Cleanup
7073
clean: ## Clean build artifacts and coverage files
7174
rm -rf bin

cmd/publisher/commands/init.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,9 @@ func createServerJSON(
301301

302302
// Create server structure
303303
return apiv0.ServerJSON{
304-
Schema: "https://static.modelcontextprotocol.io/schemas/2025-09-16/server.schema.json",
304+
Schema: "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json",
305305
Name: name,
306306
Description: description,
307-
Status: model.StatusActive,
308307
Repository: model.Repository{
309308
URL: repoURL,
310309
Source: repoSource,

cmd/publisher/commands/publish.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func PublishCommand(args []string) error {
3939

4040
// Check for deprecated schema and recommend migration
4141
// Allow empty schema (will use default) but reject old schemas
42-
if serverJSON.Schema != "" && !strings.Contains(serverJSON.Schema, "2025-09-16") {
42+
if serverJSON.Schema != "" && !strings.Contains(serverJSON.Schema, "2025-09-29") {
4343
return fmt.Errorf(`deprecated schema detected :%s.
4444
4545
Migrate to the current schema format for new servers.
@@ -82,14 +82,12 @@ Migrate to the current schema format for new servers.
8282
}
8383

8484
_, _ = fmt.Fprintln(os.Stdout, "✓ Successfully published")
85-
if serverID := response.GetServerID(); serverID != "" {
86-
_, _ = fmt.Fprintf(os.Stdout, "✓ Server Id %s version %s\n", serverID, response.Version)
87-
}
85+
_, _ = fmt.Fprintf(os.Stdout, "✓ Server %s version %s\n", response.Server.Name, response.Server.Version)
8886

8987
return nil
9088
}
9189

92-
func publishToRegistry(registryURL string, serverData []byte, token string) (*apiv0.ServerJSON, error) {
90+
func publishToRegistry(registryURL string, serverData []byte, token string) (*apiv0.ServerResponse, error) {
9391
// Parse the server JSON data
9492
var serverJSON apiv0.ServerJSON
9593
err := json.Unmarshal(serverData, &serverJSON)
@@ -134,9 +132,10 @@ func publishToRegistry(registryURL string, serverData []byte, token string) (*ap
134132
return nil, fmt.Errorf("server returned status %d: %s", resp.StatusCode, body)
135133
}
136134

137-
if err := json.Unmarshal(body, &serverJSON); err != nil {
135+
var serverResponse apiv0.ServerResponse
136+
if err := json.Unmarshal(body, &serverResponse); err != nil {
138137
return nil, err
139138
}
140139

141-
return &serverJSON, nil
140+
return &serverResponse, nil
142141
}

cmd/publisher/commands/publish_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func TestPublishCommand_DeprecatedSchema(t *testing.T) {
4444
errorSubstr: "deprecated schema detected",
4545
},
4646
{
47-
name: "current 2025-09-16 schema should pass validation",
48-
schema: "https://static.modelcontextprotocol.io/schemas/2025-09-16/server.schema.json",
47+
name: "current 2025-09-29 schema should pass validation",
48+
schema: "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json",
4949
expectError: false,
5050
},
5151
{
@@ -69,7 +69,6 @@ func TestPublishCommand_DeprecatedSchema(t *testing.T) {
6969
Name: "com.example/test-server",
7070
Description: "A test server",
7171
Version: "1.0.0",
72-
Status: model.StatusActive,
7372
Repository: model.Repository{
7473
URL: "https://github.com/example/test",
7574
Source: "github",

cmd/registry/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ func main() {
8484
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
8585
defer cancel()
8686

87-
importerService := importer.NewService(db)
87+
importerService := importer.NewService(registryService)
8888
if err := importerService.ImportFromPath(ctx, cfg.SeedFrom); err != nil {
8989
log.Printf("Failed to import seed data: %v", err)
90-
} else {
91-
log.Println("Data import completed successfully")
9290
}
9391
}
9492

0 commit comments

Comments
 (0)