Skip to main content
Glama
install.shโ€ข6.74 kB
#!/bin/bash # LibreOffice MCP Extension Installation Guide # This script provides step-by-step installation and usage instructions set -e # Get script directory (works even if called from different location) SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PLUGIN_DIR="$SCRIPT_DIR" BUILD_DIR="$SCRIPT_DIR/../build" echo "๐ŸŽฏ LibreOffice MCP Extension - Installation & Usage Guide" echo "========================================================" echo "" show_help() { cat << EOF USAGE: $0 [COMMAND] COMMANDS: install - Build and install the extension uninstall - Remove the extension from LibreOffice build - Build the extension .oxt file only test - Test the extension functionality status - Check extension and server status help - Show this help message EXAMPLES: $0 install # Build and install extension $0 test # Test extension functionality $0 status # Check if extension is working EOF } check_requirements() { echo "๐Ÿ” Checking requirements..." # Check LibreOffice if ! command -v libreoffice >/dev/null 2>&1; then echo "โŒ LibreOffice is not installed or not in PATH" echo " Please install LibreOffice 7.0 or higher" exit 1 else echo "โœ… LibreOffice found: $(libreoffice --version | head -1)" fi # Check unopkg if ! command -v unopkg >/dev/null 2>&1; then echo "โŒ unopkg command not found" echo " Please ensure LibreOffice tools are properly installed" exit 1 else echo "โœ… unopkg found" fi # Check Python if ! command -v python3 >/dev/null 2>&1; then echo "โŒ Python 3 is required for testing" echo " Please install Python 3.7 or higher" exit 1 else echo "โœ… Python found: $(python3 --version)" fi # Check if requests is available for testing if ! python3 -c "import requests" >/dev/null 2>&1; then echo "โš ๏ธ Python 'requests' module not found (needed for testing)" echo " Install with: pip install requests" else echo "โœ… Python requests module available" fi echo "" } build_extension() { echo "๐Ÿ—๏ธ Building extension..." cd "$PLUGIN_DIR" if [ ! -f "build.sh" ]; then echo "โŒ Build script not found in $PLUGIN_DIR" exit 1 fi ./build.sh echo "" } install_extension() { echo "๐Ÿ“ฆ Installing extension..." # Build first build_extension # Check if extension file exists EXTENSION_FILE="$BUILD_DIR/libreoffice-mcp-extension.oxt" if [ ! -f "$EXTENSION_FILE" ]; then echo "โŒ Extension file not found: $EXTENSION_FILE" exit 1 fi # Remove existing installation echo "๐Ÿ—‘๏ธ Removing any existing installation..." unopkg remove org.mcp.libreoffice.extension 2>/dev/null || true # Install new version echo "โฌ‡๏ธ Installing extension..." unopkg add "$EXTENSION_FILE" echo "โœ… Extension installed successfully!" echo "" echo "๐Ÿ”„ Please restart LibreOffice for the extension to take effect" echo "" echo "๐Ÿ“‹ After restart, you can:" echo " 1. Check Tools > MCP Server menu in LibreOffice" echo " 2. Run '$0 test' to verify functionality" echo " 3. Use http://localhost:8765 for AI assistant integration" echo "" } uninstall_extension() { echo "๐Ÿ—‘๏ธ Uninstalling extension..." if unopkg remove org.mcp.libreoffice.extension 2>/dev/null; then echo "โœ… Extension uninstalled successfully!" echo "๐Ÿ”„ Please restart LibreOffice" else echo "โš ๏ธ Extension was not installed or already removed" fi echo "" } test_extension() { echo "๐Ÿงช Testing extension functionality..." # Check if LibreOffice is running if ! pgrep -f "soffice" >/dev/null 2>&1; then echo "โŒ LibreOffice is not running" echo " Please start LibreOffice and try again" echo " The extension needs LibreOffice to be running" exit 1 fi # Check if test client is available if [ ! -f "$PLUGIN_DIR/test_plugin.py" ]; then echo "โŒ Test client not found" exit 1 fi # Run test echo "๐Ÿš€ Running test client..." cd "$PLUGIN_DIR" python3 test_plugin.py echo "" } check_status() { echo "๐Ÿ“Š Checking extension status..." # Check if extension is installed echo "๐Ÿ” Checking extension installation..." if unopkg list | grep -q "org.mcp.libreoffice.extension"; then echo "โœ… Extension is installed" else echo "โŒ Extension is not installed" echo " Run '$0 install' to install it" return 1 fi # Check if LibreOffice is running echo "๐Ÿ” Checking LibreOffice process..." if pgrep -f "soffice" >/dev/null 2>&1; then echo "โœ… LibreOffice is running" else echo "โš ๏ธ LibreOffice is not running" echo " Start LibreOffice for the extension to work" fi # Check if MCP server is accessible echo "๐Ÿ” Checking MCP server..." if command -v curl >/dev/null 2>&1; then if curl -s http://localhost:8765/health >/dev/null 2>&1; then echo "โœ… MCP server is accessible at http://localhost:8765" # Get server info SERVER_INFO=$(curl -s http://localhost:8765/ 2>/dev/null) if [ $? -eq 0 ]; then echo "๐Ÿ“‹ Server info:" echo "$SERVER_INFO" | python3 -m json.tool 2>/dev/null || echo "$SERVER_INFO" fi else echo "โŒ MCP server is not accessible" echo " Check if LibreOffice is running with the extension" fi else echo "โš ๏ธ curl not available, cannot test MCP server" fi echo "" } interactive_test() { echo "๐ŸŽฎ Starting interactive test mode..." if [ ! -f "$PLUGIN_DIR/test_plugin.py" ]; then echo "โŒ Test client not found" exit 1 fi cd "$PLUGIN_DIR" python3 test_plugin.py interactive } # Parse command line arguments case "${1:-help}" in "install") check_requirements install_extension ;; "uninstall") uninstall_extension ;; "build") check_requirements build_extension ;; "test") check_requirements test_extension ;; "status") check_status ;; "interactive") check_requirements interactive_test ;; "help"|*) show_help ;; esac

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jwingnut/mcp-libre'

If you have feedback or need assistance with the MCP directory API, please join our Discord server