Changes on the server.json format and the API (#562)

This commit is contained in:
Radoslav Dimitrov 2025-09-29 23:30:35 +03:00 • committed by GitHub
commit b21c6f564d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,24 +1,24 @@
package service
import (
"context"
"github.com/modelcontextprotocol/registry/internal/database"
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
)
// RegistryService defines the interface for registry operations
type RegistryService interface {
// Retrieve all servers with optional filtering
List(filter *database.ServerFilter, cursor string, limit int) ([]apiv0.ServerJSON, string, error)
// Retrieve a single server by registry metadata version ID
GetByVersionID(versionID string) (*apiv0.ServerJSON, error)
// Retrieve latest version of a server by server ID
GetByServerID(serverID string) (*apiv0.ServerJSON, error)
// Retrieve specific version of a server by server ID and version
GetByServerIDAndVersion(serverID string, version string) (*apiv0.ServerJSON, error)
// Retrieve all versions of a server by server ID
GetAllVersionsByServerID(serverID string) ([]apiv0.ServerJSON, error)
// Publish a server
Publish(req apiv0.ServerJSON) (*apiv0.ServerJSON, error)
// Update an existing server
EditServer(id string, req apiv0.ServerJSON) (*apiv0.ServerJSON, error)
// ListServers retrieve all servers with optional filtering
ListServers(ctx context.Context, filter *database.ServerFilter, cursor string, limit int) ([]*apiv0.ServerResponse, string, error)
// GetServerByName retrieve latest version of a server by server name
GetServerByName(ctx context.Context, serverName string) (*apiv0.ServerResponse, error)
// GetServerByNameAndVersion retrieve specific version of a server by server name and version
GetServerByNameAndVersion(ctx context.Context, serverName string, version string) (*apiv0.ServerResponse, error)
// GetAllVersionsByServerName retrieve all versions of a server by server name
GetAllVersionsByServerName(ctx context.Context, serverName string) ([]*apiv0.ServerResponse, error)
// CreateServer creates a new server version
CreateServer(ctx context.Context, req *apiv0.ServerJSON) (*apiv0.ServerResponse, error)
// UpdateServer updates an existing server and optionally its status
UpdateServer(ctx context.Context, serverName, version string, req *apiv0.ServerJSON, newStatus *string) (*apiv0.ServerResponse, error)
}