Skip to main content
Glama
jaipandya

product-hunt-mcp

by jaipandya

check_server_status

Verify the operational status and authentication of the Product Hunt MCP server. Retrieve server state, user details, rate limits, and error messages for monitoring and troubleshooting.

Instructions

Check the status of the Product Hunt MCP server and authentication. Returns: - status (str): "Ready", "Not initialized", "Token invalid", or "Error". - authenticated (bool, optional): True if authenticated, False otherwise. - user (dict, optional): User details if authenticated. - rate_limits (dict, optional): API rate limit information. - message (str, optional): Additional status or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'check_server_status' tool. It checks for token presence, validates it via GraphQL query to Product Hunt API, and returns detailed status including authentication, user info, and rate limits.
    def check_server_status() -> Dict[str, Any]: """ Check the status of the Product Hunt MCP server and authentication. Returns: - status (str): "Ready", "Not initialized", "Token invalid", or "Error". - authenticated (bool, optional): True if authenticated, False otherwise. - user (dict, optional): User details if authenticated. - rate_limits (dict, optional): API rate limit information. - message (str, optional): Additional status or error message. """ logger.info("server.check_server_status called") # 1. Check if token exists token_error = check_token() # Uses relative import from ..utils.token if token_error: # Use format_response for consistency, but keep specific status/message response = format_response(False, error=token_error) response["status"] = "Not initialized" response["message"] = token_error["message"] return response # 2. Try a simple query to check if token is valid try: # Uses relative imports from ..api.client and ..api.queries result, rate_limits, error = execute_graphql_query(VIEWER_QUERY) if error: response = format_response(False, error=error, rate_limits=rate_limits) response["status"] = "Error" response["message"] = f"Unable to authenticate with Product Hunt API: {error.get('message', 'Unknown error')}" return response # Check if viewer data is present (indicates successful auth) from ..utils.common import check_data_exists # Local import to avoid circular dependency at module level is_valid = check_data_exists(result.get("data", {}), "viewer") viewer_data = result.get("data", {}).get("viewer") if is_valid else None response = format_response(True, data=viewer_data, rate_limits=rate_limits) response["status"] = "Ready" if is_valid else "Token invalid" response["authenticated"] = is_valid if not is_valid: response["message"] = "Authentication successful, but no viewer data returned." if viewer_data and "user" in viewer_data: # Handle nested user structure if present response["user"] = viewer_data["user"] elif viewer_data: response["user"] = viewer_data # Assume viewer is the user object return response except Exception as e: logger.error(f"Unexpected error in check_server_status: {str(e)}", exc_info=True) response = format_response(False, error={"code": "INTERNAL_ERROR", "message": str(e)}) response["status"] = "Error" response["message"] = f"Unexpected error checking API connection: {str(e)}" return response
  • Docstring providing the tool schema description, parameters (none), and return value structure.
    """ Check the status of the Product Hunt MCP server and authentication. Returns: - status (str): "Ready", "Not initialized", "Token invalid", or "Error". - authenticated (bool, optional): True if authenticated, False otherwise. - user (dict, optional): User details if authenticated. - rate_limits (dict, optional): API rate limit information. - message (str, optional): Additional status or error message. """
  • The @mcp.tool() decorator that registers the check_server_status function as an MCP tool within the register_server_tools function.
    @mcp.tool() # No @handle_errors here as we want to return specific status messages def check_server_status() -> Dict[str, Any]:
  • Invocation of register_server_tools(mcp) in the main CLI entrypoint, which triggers the registration of the check_server_status tool.
    register_server_tools(mcp)

Other Tools

Related Tools

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/jaipandya/producthunt-mcp-server'

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