install.sh•2.57 kB
#!/bin/bash
# APRS.fi MCP Server Installation Script for Claude Code
# This script builds the MCP server and configures it for Claude Code
set -e # Exit on any error
echo "🚀 Installing APRS.fi MCP Server for Claude Code..."
# Get the current directory (where the script is located)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "📦 Installing dependencies..."
npm install
echo "🔨 Building TypeScript..."
npm run build
# Make the server executable
chmod +x dist/index.js
echo "📍 Server built at: $SCRIPT_DIR/dist/index.js"
# Detect Claude Code config directory
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
CLAUDE_CONFIG_DIR="$HOME/.claude"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
CLAUDE_CONFIG_DIR="$HOME/.claude"
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
# Windows
CLAUDE_CONFIG_DIR="$USERPROFILE/.claude"
else
CLAUDE_CONFIG_DIR="$HOME/.claude"
fi
echo "🔧 Configuring Claude Code MCP..."
# Create .claude directory if it doesn't exist
mkdir -p "$CLAUDE_CONFIG_DIR"
# Create or update mcp_settings.json
MCP_CONFIG="$CLAUDE_CONFIG_DIR/mcp_settings.json"
# Check if mcp_settings.json exists
if [ -f "$MCP_CONFIG" ]; then
echo "⚠️ Existing MCP configuration found at $MCP_CONFIG"
echo "📝 You'll need to manually add the APRS server configuration."
echo ""
echo "Add this to your mcpServers section:"
echo "{"
echo ' "aprs-fi": {'
echo ' "command": "node",'
echo ' "args": ["'$SCRIPT_DIR'/dist/index.js"],'
echo ' "env": {}'
echo ' }'
echo "}"
else
echo "📝 Creating new MCP configuration..."
cat > "$MCP_CONFIG" << EOF
{
"mcpServers": {
"aprs-fi": {
"command": "node",
"args": ["$SCRIPT_DIR/dist/index.js"],
"env": {}
}
}
}
EOF
echo "✅ Created $MCP_CONFIG"
fi
echo ""
echo "✨ Installation complete!"
echo ""
echo "🔑 To use the APRS.fi MCP server:"
echo "1. Get an API key from https://aprs.fi/page/api"
echo "2. In Claude Code, use the slash command: /set-api-key <your-api-key>"
echo "3. Then use tools like: get_aprs_position, get_aprs_history, track_multiple_callsigns"
echo ""
echo "📖 Available tools:"
echo "• get_aprs_position - Get current position for a callsign"
echo "• get_aprs_history - Get position history for a callsign"
echo "• track_multiple_callsigns - Track multiple callsigns at once"
echo "• validate_aprs_key - Test if an API key is valid"
echo ""
echo "🔄 Restart Claude Code to load the new MCP server."