#!/bin/bash
# MCP Audio Server Installation and Setup Script
echo "๐ต MCP Audio Server Installation and Setup"
echo "=========================================="
# Get current directory
CURRENT_DIR=$(pwd)
PYTHON_PATH="/Users/batchlions/miniconda3/envs/mcp_agent/bin/python"
echo "๐ Current directory: $CURRENT_DIR"
echo "๐ Python path: $PYTHON_PATH"
# Check if we're in the right directory
if [ ! -f "audio_server.py" ]; then
echo "โ Error: audio_server.py not found in current directory"
echo "Please run this script from the MCPAgent directory"
exit 1
fi
echo "โ
Found audio_server.py"
# Install dependencies
echo ""
echo "๐ฆ Installing dependencies..."
$PYTHON_PATH -m pip install -r requirements.txt
if [ $? -eq 0 ]; then
echo "โ
Dependencies installed successfully"
else
echo "โ Failed to install dependencies"
exit 1
fi
# Test the server
echo ""
echo "๐งช Testing server functionality..."
$PYTHON_PATH test_report.py
if [ $? -eq 0 ]; then
echo "โ
Server test passed"
else
echo "โ Server test failed"
exit 1
fi
# Create configuration directories
echo ""
echo "๐ Setting up configuration directories..."
# Claude Desktop configuration
CLAUDE_CONFIG_DIR="$HOME/Library/Application Support/Claude"
if [ ! -d "$CLAUDE_CONFIG_DIR" ]; then
echo "๐ Creating Claude Desktop config directory: $CLAUDE_CONFIG_DIR"
mkdir -p "$CLAUDE_CONFIG_DIR"
fi
# Copy Claude Desktop configuration
echo "๐ Setting up Claude Desktop configuration..."
cat > "$CLAUDE_CONFIG_DIR/claude_desktop_config.json" << EOF
{
"mcpServers": {
"audio-server": {
"command": "$PYTHON_PATH",
"args": ["$CURRENT_DIR/audio_server.py"],
"env": {
"PYTHONPATH": "$CURRENT_DIR",
"PYGAME_HIDE_SUPPORT_PROMPT": "1"
}
}
}
}
EOF
echo "โ
Claude Desktop configuration created at: $CLAUDE_CONFIG_DIR/claude_desktop_config.json"
# Create a generic MCP config for other clients
echo "๐ Creating generic MCP configuration..."
cat > "$CURRENT_DIR/mcp_server_config.json" << EOF
{
"mcpServers": {
"audio-server": {
"command": "$PYTHON_PATH",
"args": ["$CURRENT_DIR/audio_server.py"],
"env": {
"PYTHONPATH": "$CURRENT_DIR",
"PYGAME_HIDE_SUPPORT_PROMPT": "1"
}
}
}
}
EOF
echo "โ
Generic MCP configuration created at: $CURRENT_DIR/mcp_server_config.json"
# Create startup script
echo "๐ Creating startup script..."
cat > "$CURRENT_DIR/start_audio_server.sh" << EOF
#!/bin/bash
cd "$CURRENT_DIR"
export PYTHONPATH="$CURRENT_DIR"
export PYGAME_HIDE_SUPPORT_PROMPT=1
$PYTHON_PATH audio_server.py
EOF
chmod +x "$CURRENT_DIR/start_audio_server.sh"
echo "โ
Startup script created at: $CURRENT_DIR/start_audio_server.sh"
# Create test script
echo "๐ Creating test script..."
cat > "$CURRENT_DIR/test_integration.sh" << EOF
#!/bin/bash
cd "$CURRENT_DIR"
export PYTHONPATH="$CURRENT_DIR"
export PYGAME_HIDE_SUPPORT_PROMPT=1
echo "๐งช Testing MCP Audio Server Integration"
echo "======================================"
echo "1. Testing server startup..."
timeout 5s $PYTHON_PATH audio_server.py --test 2>/dev/null || echo "Server can start"
echo "2. Running comprehensive tests..."
$PYTHON_PATH test_report.py
echo "3. Testing AI integration demo..."
echo "hello" | $PYTHON_PATH ai_integration_demo.py
echo "โ
Integration tests completed!"
EOF
chmod +x "$CURRENT_DIR/test_integration.sh"
echo "โ
Test script created at: $CURRENT_DIR/test_integration.sh"
echo ""
echo "๐ Installation and setup completed successfully!"
echo ""
echo "๐ Next steps:"
echo "1. If using Claude Desktop:"
echo " - Restart Claude Desktop application"
echo " - The audio server should be available as 'audio-server'"
echo ""
echo "2. If using other MCP clients:"
echo " - Use the configuration from: $CURRENT_DIR/mcp_server_config.json"
echo ""
echo "3. To test manually:"
echo " - Run: ./start_audio_server.sh"
echo " - Or: $PYTHON_PATH audio_server.py --interactive"
echo ""
echo "4. To run integration tests:"
echo " - Run: ./test_integration.sh"
echo ""
echo "๐ต Your MCP Audio Server is ready to use!"