Skip to main content
Glama

server_status

Monitor server health, version, and system updates to ensure optimal performance. Retrieve real-time status and identify available updates for efficient maintenance.

Instructions

Check current server status, version, and available updates with comprehensive system information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
check_updatesNoCheck for available updates from PyPI

Implementation Reference

  • The core handler function for the 'server_status' tool. It checks server version using multiple methods, detects installation type (uvx/pip/dev), queries PyPI for updates, reports configuration status, and provides upgrade recommendations. Includes comprehensive error handling and formatted output.
    @app.tool( description="Check current server status, version, and available updates with comprehensive system information", tags={"admin", "server", "status", "version", "updates"} ) async def server_status( check_updates: Annotated[bool, Field(description="Check for available updates from PyPI")] = True ) -> str: """Check comprehensive server status including version, installation method, and update availability.""" try: # Get current version with multiple fallback methods current_version = "unknown" version_source = "fallback" try: # Method 1: Standard package metadata (for uvx installs) import importlib.metadata current_version = importlib.metadata.version("agent-knowledge-mcp") version_source = "importlib.metadata" except Exception: # Method 2: Local module version (for development) try: from . import __version__ current_version = __version__ version_source = "local module" except ImportError: try: from src import __version__ current_version = __version__ version_source = "src module" except ImportError: # Keep fallback pass # Get current configuration config = load_config() server_status = "running" # Detect installation method with comprehensive checking installation_method = "unknown" installation_details = "" try: # Check if installed via uvx (UV tool management) result = subprocess.run( ["uv", "tool", "list"], capture_output=True, text=True, timeout=10 ) if result.returncode == 0 and "agent-knowledge-mcp" in result.stdout: installation_method = "uvx" installation_details = "Installed via UV tool management" elif result.returncode == 0: installation_method = "development" installation_details = "Running in development mode" else: installation_method = "other" installation_details = "Non-uvx installation detected" except FileNotFoundError: installation_method = "no-uv" installation_details = "UV not found - likely pip install or development" except subprocess.TimeoutExpired: installation_method = "timeout" installation_details = "UV tool check timed out" except Exception as e: installation_method = "error" installation_details = f"Error checking: {str(e)}" # Check for updates with comprehensive PyPI integration latest_version = None update_available = False update_check_status = "not_checked" recommendation = "" if check_updates: try: import requests response = requests.get( "https://pypi.org/pypi/agent-knowledge-mcp/json", timeout=5 ) if response.status_code == 200: data = response.json() latest_version = data["info"]["version"] update_check_status = "success" # Enhanced version comparison if latest_version != current_version and current_version != "unknown": update_available = True if installation_method == "uvx": recommendation = f"πŸ”„ **Update Available!** Version {latest_version} ready\n πŸ’‘ Use server_upgrade tool to update automatically" else: recommendation = f"πŸ”„ **Update Available!** Version {latest_version} ready\n ⚠️ Manual update required (not uvx installation)" elif current_version == "unknown": recommendation = f"πŸ“¦ Latest version: {latest_version}\n ⚠️ Cannot compare - current version unknown" else: update_check_status = f"http_error_{response.status_code}" latest_version = f"HTTP {response.status_code} error" except ImportError: update_check_status = "missing_requests" latest_version = "requests module not available" except requests.exceptions.Timeout: update_check_status = "timeout" latest_version = "PyPI request timed out" except requests.exceptions.ConnectionError: update_check_status = "connection_error" latest_version = "No internet connection" except Exception as e: update_check_status = "error" latest_version = f"Error: {str(e)}" else: update_check_status = "skipped" latest_version = "Update check disabled" # Build comprehensive status message message = "πŸ–₯️ **Server Status Report**\n\n" # Version information message += f"πŸ“ **Version Information:**\n" message += f" 🏷️ Current Version: {current_version}\n" message += f" πŸ“– Version Source: {version_source}\n" if latest_version: message += f" πŸ“¦ Latest Version: {latest_version}\n" message += f" πŸ” Update Check: {update_check_status}\n" # Installation details message += f"\nπŸ”§ **Installation Information:**\n" message += f" πŸ“₯ Method: {installation_method}\n" message += f" πŸ“ Details: {installation_details}\n" # System status message += f"\n⚑ **System Status:**\n" message += f" πŸš€ Server: {server_status}\n" message += f" πŸ—‚οΈ Elasticsearch: {config['elasticsearch']['host']}:{config['elasticsearch']['port']}\n" # Configuration summary if "server" in config: server_config = config["server"] message += f" πŸ“› Server Name: {server_config.get('name', 'AgentKnowledgeMCP')}\n" message += f" 🏷️ Config Version: {server_config.get('version', '1.0.0')}\n" # Update recommendations if update_available and recommendation: message += f"\n✨ **Update Available:**\n {recommendation}\n" elif check_updates and not update_available and update_check_status == "success": message += f"\nβœ… **System Up to Date:**\n You are running the latest version!\n" # Installation method guidance if installation_method not in ["uvx"]: message += f"\nπŸ’‘ **Management Tools Notice:**\n" message += f" ⚠️ Server management tools (upgrade) require uvx installation\n" message += f" πŸ› οΈ Install via: `uvx install agent-knowledge-mcp`\n" message += f" πŸ“š Current method ({installation_method}) has limited management capabilities\n" return message except ImportError as e: return f"❌ Module Error: Missing required dependency\nπŸ” Details: {str(e)}\nπŸ’‘ Some status features require additional modules (requests for update checks)" except subprocess.TimeoutExpired: return f"❌ Timeout Error: System command timed out\nπŸ’‘ Installation method detection failed - try again or check system performance" except Exception as e: return _format_admin_error(e, "check server status", "version detection and update checking")
  • Registration of the admin server app via mounting to the main FastMCP app, making admin tools (including server_status as admin_server_status) available. Backward compatibility aliases provide unprefixed names like server_status.
    # Mount Administrative operations server with 'admin' prefix # This provides: admin_get_config, admin_update_config, admin_server_status, etc. app.mount(admin_server_app)
  • CLI output listing 'server_status' as one of the available tools, confirming its registration and accessibility without prefix for backward compatibility.
    print(" └─ Tools: get_config, update_config, server_status, server_upgrade, setup_elasticsearch, elasticsearch_status, validate_config, reset_config, reload_config")

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/itshare4u/AgentKnowledgeMCP'

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