We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pingidentity/aic-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
publish-npm•3.27 KiB
#!/bin/bash
set -e
# Publish to npm Script
# Publishes a tagged version to npm registry
# Usage: ./script/publish-npm v1.0.0-beta.1
VERSION=$1
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
error() {
echo -e "${RED}Error: $1${NC}" >&2
exit 1
}
info() {
echo -e "${GREEN}$1${NC}"
}
warn() {
echo -e "${YELLOW}$1${NC}"
}
# Cleanup function - called on exit (success or failure)
cleanup() {
local exit_code=$?
# Return to original branch/commit if we changed it
if [ -n "$CURRENT_REF" ] && [ -n "$CHECKED_OUT_TAG" ]; then
if ! git checkout "$CURRENT_REF" >/dev/null 2>&1; then
warn "Failed to return to ${CURRENT_REF}. You may need to manually checkout your branch."
fi
fi
# If we're exiting with an error, inform the user
if [ $exit_code -ne 0 ]; then
warn "npm publish failed. Cleanup completed."
fi
}
# Register cleanup function to run on exit
trap cleanup EXIT
# Check if version argument is provided
if [ -z "$VERSION" ]; then
error "Version argument required.\nUsage: $0 v1.0.0-beta.1"
fi
# Add 'v' prefix if not present
if [[ ! $VERSION =~ ^v ]]; then
VERSION="v${VERSION}"
fi
info "Publishing ${VERSION} to npm..."
# Check if tag exists
if ! git rev-parse "$VERSION" >/dev/null 2>&1; then
error "Tag $VERSION does not exist locally. Run ./script/tag-release first."
fi
# Check if npm is logged in
if ! npm whoami >/dev/null 2>&1; then
error "Not logged in to npm. Run: npm login"
fi
# Save current branch/commit to return to later
CURRENT_REF=$(git rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_REF" == "HEAD" ]; then
# We're in detached HEAD state, save the commit
CURRENT_REF=$(git rev-parse HEAD)
fi
# Checkout the tag
info "Checking out tag ${VERSION}..."
CHECKED_OUT_TAG=""
if ! git checkout "$VERSION"; then
error "Failed to checkout tag ${VERSION}"
fi
CHECKED_OUT_TAG="$VERSION"
# Install dependencies and build
info "Installing dependencies..."
npm ci --quiet
info "Building project..."
npm run build
# Determine npm dist-tag based on version
# Per semver 2.0.0: any version with a hyphen followed by identifiers is a pre-release
NPM_TAG=""
if [[ $VERSION =~ -[a-zA-Z] ]]; then
NPM_TAG="--tag beta"
info "Detected pre-release version (will publish with tag: beta)"
info "Users install with: npm install @ping-identity/aic-mcp-server@beta"
else
info "Detected stable version (will publish with tag: latest)"
info "Users install with: npm install @ping-identity/aic-mcp-server"
fi
# Show what will be published
info "Verifying package contents..."
npm pack --dry-run
echo ""
read -p "Publish to npm? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
warn "Publish cancelled"
exit 0
fi
# Publish to npm
info "Publishing to npm..."
npm publish $NPM_TAG
# Return to previous branch/commit
info "Returning to ${CURRENT_REF}..."
if ! git checkout "$CURRENT_REF"; then
error "Failed to return to ${CURRENT_REF}"
fi
CHECKED_OUT_TAG="" # Clear flag since we've returned
info "✓ Successfully published ${VERSION} to npm"
echo ""
if [[ $NPM_TAG == "--tag beta" ]]; then
info "Install with: npm install @ping-identity/aic-mcp-server@beta"
else
info "Install with: npm install @ping-identity/aic-mcp-server"
fi
echo ""