crcdng commited on
Commit
fc79518
·
1 Parent(s): 21f0f09
Files changed (5) hide show
  1. README.md +6 -0
  2. app.py +29 -5
  3. doomsweek_mcp_server.py +1 -5
  4. monitorica.bold.otf +0 -0
  5. styles.css +9 -0
README.md CHANGED
@@ -13,3 +13,9 @@ tags:
13
  short_description: Can humanity survive the next 7 days?
14
  ---
15
 
 
 
 
 
 
 
 
13
  short_description: Can humanity survive the next 7 days?
14
  ---
15
 
16
+ icons
17
+ icons by christos hooper via ICON Repo (CC BY 3.0)
18
+ https://www.iconrepo.com/collection/64921/end-of-the-world-a-collection-of-contemporary/
19
+
20
+ font Monitorica by 4th february (CC BY-ND)
21
+ https://www.1001fonts.com/monitorica-font.html
app.py CHANGED
@@ -194,9 +194,26 @@ class MCPClientWrapper:
194
  client = MCPClientWrapper()
195
 
196
  def gradio_interface():
197
- with gr.Blocks(title="MCP Doomsweek Client") as demo:
198
- gr.Markdown("# MCP Doomsweek Assistant")
199
- gr.Markdown("Connect to the DOOMSWEEK MCP Server and chat with the assistant")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
  with gr.Row(equal_height=True):
202
  with gr.Column(scale=4):
@@ -229,7 +246,14 @@ def gradio_interface():
229
  connect_btn.click(client.connect, inputs=server_path, outputs=status)
230
  msg.submit(client.process_message, [msg, chatbot], [chatbot, msg])
231
  clear_btn.click(lambda: [], None, chatbot)
232
-
 
 
 
 
 
 
 
233
  return demo
234
 
235
  if __name__ == "__main__":
@@ -237,4 +261,4 @@ if __name__ == "__main__":
237
  print("Warning: ANTHROPIC_API_KEY not found in environment. Please set it in your .env file.")
238
 
239
  interface = gradio_interface()
240
- interface.launch(debug=True)
 
194
  client = MCPClientWrapper()
195
 
196
  def gradio_interface():
197
+ with gr.Blocks(title="MCP Doomsweek Assistant", css_paths=["styles.css"],) as demo:
198
+
199
+ title_html = """
200
+ <style>
201
+ @font-face {
202
+ font-family: Monitorica;
203
+ src: url("/gradio_api/file=monitorica.bold.otf") format("opentype");
204
+ font-weight: Regular;
205
+ font-style: normal;
206
+ }
207
+ </style>
208
+ <center>
209
+ <h1 style='font-family: Monitorica; font-size: 42px;'> Your Doomsweek MCP Assistant </h1>
210
+ </center>
211
+ """
212
+
213
+ with gr.Row():
214
+ title = gr.HTML(title_html)
215
+
216
+ gr.Markdown("What is more important than to know one's own end? This space will answer ultimate questions. In particular will you know if humanity will survive the next 7 days. To do that, this agent will connect via MCP to the DOOMSWEEK MCP Server. The server fetches data from the NASA Near Earth Object Web Service and checks if ... we are doomed. Anthropic's Claude will give you the result in nice words, hopefully. In other words, before an Asteroid will smash this planet you will learn it here first. Nice, isn't it? You will have enough time to enjoy a scoop of your favourate ice cream, walk the dog a last time and sell all tech stocks. You won't need them, promised. Try it out and chat with the assistant (examples below).")
217
 
218
  with gr.Row(equal_height=True):
219
  with gr.Column(scale=4):
 
246
  connect_btn.click(client.connect, inputs=server_path, outputs=status)
247
  msg.submit(client.process_message, [msg, chatbot], [chatbot, msg])
248
  clear_btn.click(lambda: [], None, chatbot)
249
+ examples = gr.Examples(
250
+ examples=[
251
+ ["Tell me about the probability of doom in the next week."],
252
+ ["How likely is it that humanity will survive the next week?"],
253
+ ["Will asteroids destroy the earth next week?"],
254
+ ],
255
+ inputs=[msg],
256
+ )
257
  return demo
258
 
259
  if __name__ == "__main__":
 
261
  print("Warning: ANTHROPIC_API_KEY not found in environment. Please set it in your .env file.")
262
 
263
  interface = gradio_interface()
264
+ interface.launch(debug=True, allowed_paths=["monitorica.bold.otf"],)
doomsweek_mcp_server.py CHANGED
@@ -1,7 +1,6 @@
1
  # -*- coding: utf-8 -*-
2
 
3
  from mcp.server.fastmcp import FastMCP
4
- from dotenv import load_dotenv
5
  import gradio as gr
6
  import io
7
  import json
@@ -14,8 +13,6 @@ import requests
14
  sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
15
  sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
16
 
17
- nasa_api_key = os.getenv("NASA_API_KEY")
18
-
19
  mcp = FastMCP("doomsweek_mcp_server")
20
 
21
  def calc_asteroid_factor(data, weight=1.0):
@@ -83,7 +80,6 @@ async def calc_doom_probability():
83
  # demo.launch(mcp_server=True)
84
 
85
  if __name__ == "__main__":
86
- load_dotenv()
87
  nasa_api_key = os.getenv("NASA_API_KEY")
88
- print(os.getenv("NASA_API_KEY"))
89
  mcp.run(transport='stdio')
 
1
  # -*- coding: utf-8 -*-
2
 
3
  from mcp.server.fastmcp import FastMCP
 
4
  import gradio as gr
5
  import io
6
  import json
 
13
  sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
14
  sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
15
 
 
 
16
  mcp = FastMCP("doomsweek_mcp_server")
17
 
18
  def calc_asteroid_factor(data, weight=1.0):
 
80
  # demo.launch(mcp_server=True)
81
 
82
  if __name__ == "__main__":
83
+ # NOTE the NASA API is provided by the client via env server parameters
84
  nasa_api_key = os.getenv("NASA_API_KEY")
 
85
  mcp.run(transport='stdio')
monitorica.bold.otf ADDED
Binary file (55.1 kB). View file
 
styles.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+
2
+ @keyframes skew-x-shaking {
3
+ 0% { transform: skewX(-15deg); }
4
+ 5% { transform: skewX(15deg); }
5
+ 10% { transform: skewX(-15deg); }
6
+ 15% { transform: skewX(15deg); }
7
+ 20% { transform: skewX(0deg); }
8
+ 100% { transform: skewX(0deg); }
9
+ }