arre99 commited on
Commit
f18c3a4
·
1 Parent(s): b421a2a

added longer more detailed video. just minor tidy details left, otherwise project done

Browse files
Files changed (2) hide show
  1. mcp_client.py +3 -4
  2. utils/constants.py +21 -27
mcp_client.py CHANGED
@@ -9,7 +9,7 @@ load_dotenv()
9
 
10
  # Can manully set this to a specific time to make the agent think it is in the past
11
  time = datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0).isoformat()
12
- spanish_gp_race_plus1h = "2025-06-01T14:00:00Z"
13
 
14
  SYSTEM_PROMPT = f"""You are a helpful Formula 1 assistant and strategist. You have access to various F1 data and tools to help answer questions about races, drivers, teams, and more. Be concise and accurate in your responses. You must use the available tools to find the information.
15
  In addition, you will be asked to act as a live race engineer strategist during a Formula 1 race, making crucial calls during the event.
@@ -20,9 +20,10 @@ Lastly, combine the endpoint and filters to create a request to the OpenF1 API a
20
 
21
  Current UTC time (ISO 8601): {spanish_gp_race_plus1h}"""
22
 
 
23
  def agent_chat(message: str, history: list):
24
  message = f"{SYSTEM_PROMPT}\n\nTask: {message}"
25
- return agent.run(message, max_steps=50)
26
 
27
 
28
  if __name__ == "__main__":
@@ -74,8 +75,6 @@ if __name__ == "__main__":
74
  }
75
  api_key = os.getenv(provider_env_mapping[provider])
76
 
77
- print(f"Model ID: {model_id} | API key: {api_key}")
78
-
79
  model = InferenceClientModel(
80
  model_id=model_id,
81
  provider=provider,
 
9
 
10
  # Can manully set this to a specific time to make the agent think it is in the past
11
  time = datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0).isoformat()
12
+ spanish_gp_race_plus1h = "2025-06-01T13:45:00Z" # Race start +45 minutes
13
 
14
  SYSTEM_PROMPT = f"""You are a helpful Formula 1 assistant and strategist. You have access to various F1 data and tools to help answer questions about races, drivers, teams, and more. Be concise and accurate in your responses. You must use the available tools to find the information.
15
  In addition, you will be asked to act as a live race engineer strategist during a Formula 1 race, making crucial calls during the event.
 
20
 
21
  Current UTC time (ISO 8601): {spanish_gp_race_plus1h}"""
22
 
23
+
24
  def agent_chat(message: str, history: list):
25
  message = f"{SYSTEM_PROMPT}\n\nTask: {message}"
26
+ return agent.run(message, max_steps=80)
27
 
28
 
29
  if __name__ == "__main__":
 
75
  }
76
  api_key = os.getenv(provider_env_mapping[provider])
77
 
 
 
78
  model = InferenceClientModel(
79
  model_id=model_id,
80
  provider=provider,
utils/constants.py CHANGED
@@ -178,23 +178,17 @@ HTML_INTRODUCTION = f"""
178
  <h1>Formula 1 MCP Server</h1>
179
  <p>Welcome to the Formula 1 MCP server, your one-stop destination for Formula 1 data retrieval and race real-time race strategy analysis.</p>
180
  <p>This application leverages the FastF1 library and OpenF1 API to provide detailed insights into Formula 1 races, drivers, and teams.</p>
181
- <h2>Video Demonstration & Submissions</h2>
182
- <h3>Short demo (Claude Desktop)</h3>
183
-
184
- <p>Minimalistic demo of the MCP server using Claude Desktop.</p>
185
- <iframe width="800" height="499" src="https://www.loom.com/embed/4ef9cf2e691143db8e5d807a1aef9672?sid=2acf26b1-49a0-4157-ac6b-3fdf08be8ea2" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
186
-
187
-
188
-
189
-
190
- <h3>Longer demo and yap sesh (Gradio UI + mcp_client.py + Claude Desktop)</h3>
191
- <p>More in-depth demo of interacting with the MCP server using Gradio UI, mcp_client.py and Claude Desktop.</p>
192
-
193
 
 
 
 
194
 
 
 
 
195
 
196
  <h2>Architecture (Created with Excalidraw and icons from Lobehub)</h2>
197
- <img src="data:image/png;base64,{IMAGE_BASE64}" width="800" />
198
 
199
  <h2>Available Tools in Gradio UI</h2>
200
  <h3>Championship Standings</h3>
@@ -227,28 +221,28 @@ HTML_INTRODUCTION = f"""
227
  <p>For MCP clients that support SSE transport (For Claude desktop see below), the following configuration can be used in your <code>mcp.json</code> file (or its equivalent):</p>
228
  <pre><code>
229
  {
230
- "mcpServers": {
231
- "gradio": {
232
- "url": "https://agents-mcp-hackathon-f1-mcp-server.hf.space/gradio_api/mcp/sse"
233
- }
234
  }
 
235
  }
236
  </code></pre>
237
 
238
  <p>For Claude Desktop, the following configuration can instead be used, but make sure you have Node.js installed:</p>
239
  <pre><code>
240
  {
241
- "mcpServers": {
242
- "gradio": {
243
- "command": "npx",
244
- "args": [
245
- "mcp-remote",
246
- "https://agents-mcp-hackathon-f1-mcp-server.hf.space/gradio_api/mcp/sse",
247
- "--transport",
248
- "sse-only"
249
- ]
250
- }
251
  }
 
252
  }
253
  </code></pre>
254
 
 
178
  <h1>Formula 1 MCP Server</h1>
179
  <p>Welcome to the Formula 1 MCP server, your one-stop destination for Formula 1 data retrieval and race real-time race strategy analysis.</p>
180
  <p>This application leverages the FastF1 library and OpenF1 API to provide detailed insights into Formula 1 races, drivers, and teams.</p>
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
+ <h2>Quick demo (Claude Desktop)</h2>
183
+ <p>Quick demo of the MCP server using Claude Desktop.</p>
184
+ <iframe width="640" height="399" src="https://www.loom.com/embed/4ef9cf2e691143db8e5d807a1aef9672?sid=2acf26b1-49a0-4157-ac6b-3fdf08be8ea2" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
185
 
186
+ <h2>Longer demo and yap sesh (Gradio UI / mcp_client.py / Claude Desktop)</h2>
187
+ <p>More in-depth demo of interacting with the MCP server using Gradio UI, mcp_client.py and Claude Desktop. Swedish accent warning, watch on 1.5x to stay sane</p>
188
+ <iframe width="640" height="399" src="https://www.loom.com/embed/bfa4e3e5d70d47f9bce406a0714893fd?sid=63dfe49d-09db-4242-ac86-ec4ba9cfec34" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
189
 
190
  <h2>Architecture (Created with Excalidraw and icons from Lobehub)</h2>
191
+ <img src="data:image/png;base64,{IMAGE_BASE64}" width="640" />
192
 
193
  <h2>Available Tools in Gradio UI</h2>
194
  <h3>Championship Standings</h3>
 
221
  <p>For MCP clients that support SSE transport (For Claude desktop see below), the following configuration can be used in your <code>mcp.json</code> file (or its equivalent):</p>
222
  <pre><code>
223
  {
224
+ "mcpServers": {
225
+ "gradio": {
226
+ "url": "https://agents-mcp-hackathon-f1-mcp-server.hf.space/gradio_api/mcp/sse"
 
227
  }
228
+ }
229
  }
230
  </code></pre>
231
 
232
  <p>For Claude Desktop, the following configuration can instead be used, but make sure you have Node.js installed:</p>
233
  <pre><code>
234
  {
235
+ "mcpServers": {
236
+ "gradio": {
237
+ "command": "npx",
238
+ "args": [
239
+ "mcp-remote",
240
+ "https://agents-mcp-hackathon-f1-mcp-server.hf.space/gradio_api/mcp/sse",
241
+ "--transport",
242
+ "sse-only"
243
+ ]
 
244
  }
245
+ }
246
  }
247
  </code></pre>
248