Changes on the server.json format and the API (#562)
This commit is contained in:
parent
4962609697
commit
b21c6f564d
1 changed files with 4056 additions and 5608 deletions
|
|
@ -3,15 +3,28 @@
|
|||
|
||||
REGISTRY_URL="${REGISTRY_URL:-https://registry.modelcontextprotocol.io}"
|
||||
|
||||
if [ -z "$SERVER_ID" ] || [ -z "$REGISTRY_TOKEN" ]; then
|
||||
echo "Usage: REGISTRY_TOKEN=<token> SERVER_ID=<server-uuid> $0"
|
||||
if [ -z "$SERVER_NAME" ] || [ -z "$REGISTRY_TOKEN" ]; then
|
||||
echo "Usage: REGISTRY_TOKEN=<token> SERVER_NAME=<server-name> [VERSION=<version>] $0"
|
||||
echo "Example: REGISTRY_TOKEN=token SERVER_NAME=com.example/my-server ./takedown.sh"
|
||||
echo "Example: REGISTRY_TOKEN=token SERVER_NAME=com.example/my-server VERSION=1.0.0 ./takedown.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get current server and update status to deleted
|
||||
curl -s "${REGISTRY_URL}/v0/servers/${SERVER_ID}" | \
|
||||
jq '.status = "deleted" | {server: .}' | \
|
||||
curl -X PUT "${REGISTRY_URL}/v0/servers/${SERVER_ID}" \
|
||||
# URL encode the server name (replace / with %2F)
|
||||
ENCODED_SERVER_NAME=$(echo "$SERVER_NAME" | sed 's|/|%2F|g')
|
||||
|
||||
# Determine the endpoint based on whether VERSION is provided
|
||||
if [ -n "$VERSION" ]; then
|
||||
# Mark specific version as deleted
|
||||
ENDPOINT="${REGISTRY_URL}/v0/servers/${ENCODED_SERVER_NAME}/versions/${VERSION}?status=deleted"
|
||||
echo "Marking version $VERSION of server $SERVER_NAME as deleted..."
|
||||
else
|
||||
# Mark entire server as deleted (latest version)
|
||||
ENDPOINT="${REGISTRY_URL}/v0/servers/${ENCODED_SERVER_NAME}?status=deleted"
|
||||
echo "Marking server $SERVER_NAME as deleted..."
|
||||
fi
|
||||
|
||||
# Update server status to deleted
|
||||
curl -X PUT "$ENDPOINT" \
|
||||
-H "Authorization: Bearer ${REGISTRY_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @-
|
||||
-H "Content-Type: application/json"
|
||||
Loading…
Reference in a new issue