Skip to main content
Glama

MCP Log Analyzer

streamlit_ui.pyโ€ข3.16 kB
import nest_asyncio import streamlit as st import asyncio import json nest_asyncio.apply() if 'result' not in st.session_state: st.session_state.result = None st.title('MCP Log Analyzer') st.markdown("Upload a JSON log file to analyze errors and receive fixes.") def display_results(result): """Display the agent results in a clear format""" st.subheader("๐Ÿ” Analysis Results") if not result: st.warning("โš ๏ธ No results received") return if isinstance(result, dict) and "error" in result: st.error("โŒ Error occurred:") st.code(result.get("details", result["error"])) return # Try to parse messages if they exist if isinstance(result, dict) and "messages" in result: st.subheader("๐Ÿ’ฌ Conversation Messages") messages = result["messages"] for i, message in enumerate(messages): # Handle different message formats if hasattr(message, 'content'): # LangChain message object message_type = type(message).__name__ content = message.content if 'Human' in message_type: st.info(f"๐Ÿ‘ค **User:** {content}") elif 'AI' in message_type: st.success(f"๐Ÿค– **AI:** {content}") elif 'Tool' in message_type: tool_name = getattr(message, 'name', 'Unknown Tool') st.warning(f"๐Ÿ› ๏ธ **{tool_name}:** {content}") else: st.write(f"๐Ÿ“ **{message_type}:** {content}") elif isinstance(message, dict): # Dictionary format st.json(message) else: # String or other format st.code(str(message)) else: st.warning("โš ๏ธ No conversation messages found in result") uploaded_file = st.file_uploader('Upload a log file', type='json') if uploaded_file: content = uploaded_file.read().decode("utf-8") st.success("โœ… File uploaded successfully") # Show preview of logs try: logs = json.loads(content) st.info(f"๐Ÿ“Š Found {len(logs)} log entries") with st.expander("๐Ÿ‘€ Preview logs"): st.json(logs[:2]) # Show first 2 entries except: st.error("โŒ Invalid JSON format") if st.button("๐Ÿงช Analyze Log File"): with st.spinner("๐Ÿ”„ Running analysis..."): try: from streamlit_client import run_agent logs = json.loads(content) # Run the agent loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) result = loop.run_until_complete(run_agent(logs)) loop.close() st.success("โœ… Analysis complete!") # Store and display results st.session_state.result = result display_results(result) except Exception as e: st.error(f"โŒ Analysis failed: {str(e)}") import traceback st.code(traceback.format_exc())

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/Tushar-Shrivastava/Loganalyzer'

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