Skip to main content
Glama

server_status

Check server status, version, and system information to monitor health and identify available updates for 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

  • Main handler for 'server_status' tool. Checks server version (multiple sources), installation method (uvx detection), PyPI updates via requests, Elasticsearch config, and provides comprehensive formatted status report with recommendations.
    @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")
  • Mounting of admin_server_app into main FastMCP server, registering admin tools including server_status (with backward compatibility aliases mentioned).
    # 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 print statement listing 'server_status' as one of the available tools from Admin server.
    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