## Summary
Implements `PUT /v0/servers/{id}` admin edit endpoint to address part of
issue #182, providing an API-based solution for server moderation
without requiring direct database access.
- **New endpoint**: `PUT /v0/servers/{id}` for editing existing servers
- **Security**: Uses existing JWT auth with `PermissionActionEdit`
permissions
- **Anti-undelete protection**: Added `ServerStatusDeleted` status that
cannot be reverted
- **Full implementation**: Database, service, API, and comprehensive
test coverage
## Key Use Cases
- Mark malicious servers as `deleted` for takedown
- Update server metadata for moderation actions
Related to: https://github.com/modelcontextprotocol/registry/issues/182
(but that is not _done_ yet because we need admins to be able to login
(probably with #283), and need to add docs on how to do the takedown,
and probably guidelines on what we will/won't takedown)
23 lines
827 B
Go
23 lines
827 B
Go
// Package router contains API routing logic
|
|
package router
|
|
|
|
import (
|
|
"github.com/danielgtaylor/huma/v2"
|
|
|
|
v0 "github.com/modelcontextprotocol/registry/internal/api/handlers/v0"
|
|
v0auth "github.com/modelcontextprotocol/registry/internal/api/handlers/v0/auth"
|
|
"github.com/modelcontextprotocol/registry/internal/config"
|
|
"github.com/modelcontextprotocol/registry/internal/service"
|
|
"github.com/modelcontextprotocol/registry/internal/telemetry"
|
|
)
|
|
|
|
func RegisterV0Routes(
|
|
api huma.API, cfg *config.Config, registry service.RegistryService, metrics *telemetry.Metrics,
|
|
) {
|
|
v0.RegisterHealthEndpoint(api, cfg, metrics)
|
|
v0.RegisterPingEndpoint(api)
|
|
v0.RegisterServersEndpoints(api, registry)
|
|
v0.RegisterEditEndpoints(api, registry, cfg)
|
|
v0auth.RegisterAuthEndpoints(api, cfg)
|
|
v0.RegisterPublishEndpoint(api, registry, cfg)
|
|
}
|