feat: add admin operations documentation and scripts for server management (#323)

## Summary
- Added comprehensive admin operations documentation
- Included scripts for common server management tasks

Together with #315, #316, this fixes #182
This commit is contained in:
adam jones 2025-08-28 23:40:50 +01:00 • committed by GitHub
commit 8afe162f6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 152 additions and 0 deletions

29
tools/admin/auth.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
# Simple OIDC authentication helper using gcloud
REGISTRY_URL="${REGISTRY_URL:-https://registry.modelcontextprotocol.io}"
if ! gcloud projects list &> /dev/null; then
gcloud auth login >&2
fi
# Get Google Cloud identity token
OIDC_TOKEN=$(gcloud auth print-identity-token)
# Exchange for registry token
RESPONSE=$(curl -s -X POST "${REGISTRY_URL}/v0/auth/oidc" \
-H "Content-Type: application/json" \
-d "{\"oidc_token\": \"${OIDC_TOKEN}\"}")
# Check if successful
REGISTRY_TOKEN=$(echo "$RESPONSE" | jq -r '.registry_token // empty')
if [ -z "$REGISTRY_TOKEN" ]; then
echo "Error: Authentication failed" >&2
echo "$RESPONSE" | jq '.' >&2
exit 1
fi
# Output the export command
echo "# Successfully authenticated! Now run this to use your token:" >&2
echo "export REGISTRY_TOKEN='${REGISTRY_TOKEN}'"

17
tools/admin/takedown.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
# Simple takedown script
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"
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}" \
-H "Authorization: Bearer ${REGISTRY_TOKEN}" \
-H "Content-Type: application/json" \
-d @-