JG1310 commited on
Commit
7a84873
·
verified ·
1 Parent(s): 56e2f55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -58
app.py CHANGED
@@ -1,12 +1,7 @@
1
  #!/usr/bin/env python3
2
  """
3
- HDF5/NetCDF MCP Server - Gradio Implementation (TRULY Stateless)
4
  A Model Context Protocol server for reading and analyzing HDF5 and NetCDF scientific data files.
5
-
6
- CRITICAL: This implementation is COMPLETELY STATELESS for MCP tools.
7
- - ALL MCP tool functions take file_path as a required parameter
8
- - NO state variables are used in MCP tools
9
- - Enum validation removed from MCP tools (accepts any string)
10
  """
11
 
12
  import gradio as gr
@@ -3067,13 +3062,6 @@ def build_mcp_tools():
3067
  placeholder="0:10, :, 5",
3068
  value="",
3069
  info="NumPy-style slice notation"
3070
- ),
3071
- gr.Number(
3072
- label="Memory Limit MB (optional)",
3073
- value=None,
3074
- minimum=1,
3075
- maximum=50000,
3076
- info="Override default memory limits (100/500/2000 MB). Set higher if you have more RAM."
3077
  )
3078
  ],
3079
  outputs=gr.JSON(label="Dataset Contents"),
@@ -3173,13 +3161,6 @@ def build_mcp_tools():
3173
  placeholder="0:10, :, :",
3174
  value="",
3175
  info="Compute statistics over a subset"
3176
- ),
3177
- gr.Number(
3178
- label="Memory Limit MB (optional)",
3179
- value=None,
3180
- minimum=1,
3181
- maximum=50000,
3182
- info="Override default memory limits (100/500/2000 MB). Set higher if you have more RAM."
3183
  )
3184
  ],
3185
  outputs=gr.JSON(label="Statistical Results"),
@@ -3220,13 +3201,6 @@ def build_mcp_tools():
3220
  minimum=1000,
3221
  maximum=1000000,
3222
  info="Safety limit for CSV files"
3223
- ),
3224
- gr.Number(
3225
- label="Memory Limit MB (optional)",
3226
- value=None,
3227
- minimum=1,
3228
- maximum=50000,
3229
- info="Override default memory limits (100/500/2000 MB). Set higher if you have more RAM."
3230
  )
3231
  ],
3232
  outputs=[gr.JSON(label="Export Status"), gr.File(label="Download File")],
@@ -3334,13 +3308,6 @@ def build_mcp_tools():
3334
  minimum=0,
3335
  maximum=1000,
3336
  info="Window size for smoothing (0 or 1 = no smoothing, 2-1000 = apply moving average)"
3337
- ),
3338
- gr.Number(
3339
- label="Memory Limit (MB) - optional",
3340
- value=None,
3341
- minimum=1,
3342
- maximum=50000,
3343
- info="Override default memory limits (100/500/2000 MB)"
3344
  )
3345
  ],
3346
  outputs=[
@@ -3395,13 +3362,6 @@ def build_mcp_tools():
3395
  choices=["Viridis", "Plasma", "Inferno", "Magma", "Cividis", "Blues", "Reds", "YlOrRd", "RdBu"],
3396
  value="Viridis",
3397
  info="Plotly colorscale for heatmap"
3398
- ),
3399
- gr.Number(
3400
- label="Memory Limit (MB) - optional",
3401
- value=None,
3402
- minimum=1,
3403
- maximum=50000,
3404
- info="Override default memory limits (100/500/2000 MB)"
3405
  )
3406
  ],
3407
  outputs=[
@@ -3461,13 +3421,6 @@ def build_mcp_tools():
3461
  placeholder="Leave blank for automatic",
3462
  value="",
3463
  info="Override automatic y-axis label"
3464
- ),
3465
- gr.Number(
3466
- label="Memory Limit (MB) - optional",
3467
- value=None,
3468
- minimum=1,
3469
- maximum=50000,
3470
- info="Override default memory limits (100/500/2000 MB)"
3471
  )
3472
  ],
3473
  outputs=[
@@ -3529,13 +3482,6 @@ def build_mcp_tools():
3529
  choices=["Viridis", "Plasma", "Inferno", "Magma", "Cividis", "Blues", "Reds", "YlOrRd", "RdBu"],
3530
  value="Viridis",
3531
  info="Plotly colorscale for contours"
3532
- ),
3533
- gr.Number(
3534
- label="Memory Limit (MB) - optional",
3535
- value=None,
3536
- minimum=1,
3537
- maximum=50000,
3538
- info="Override default memory limits (100/500/2000 MB)"
3539
  )
3540
  ],
3541
  outputs=[
@@ -3635,9 +3581,9 @@ if __name__ == "__main__":
3635
  # Create organized interface with nested tabs
3636
  # All individual tools still exposed to MCP via api_name
3637
 
3638
- with gr.Blocks(title="HDF5/NetCDF MCP Server (Stateless)") as demo:
3639
- gr.Markdown("# HDF5/NetCDF MCP Server (Stateless)")
3640
- gr.Markdown("Stateless tools for analyzing HDF5 and NetCDF scientific data files")
3641
 
3642
  with gr.Tab("📥 File Loading"):
3643
  with gr.Tabs():
 
1
  #!/usr/bin/env python3
2
  """
3
+ HDF5/NetCDF MCP Server - Gradio Implementation
4
  A Model Context Protocol server for reading and analyzing HDF5 and NetCDF scientific data files.
 
 
 
 
 
5
  """
6
 
7
  import gradio as gr
 
3062
  placeholder="0:10, :, 5",
3063
  value="",
3064
  info="NumPy-style slice notation"
 
 
 
 
 
 
 
3065
  )
3066
  ],
3067
  outputs=gr.JSON(label="Dataset Contents"),
 
3161
  placeholder="0:10, :, :",
3162
  value="",
3163
  info="Compute statistics over a subset"
 
 
 
 
 
 
 
3164
  )
3165
  ],
3166
  outputs=gr.JSON(label="Statistical Results"),
 
3201
  minimum=1000,
3202
  maximum=1000000,
3203
  info="Safety limit for CSV files"
 
 
 
 
 
 
 
3204
  )
3205
  ],
3206
  outputs=[gr.JSON(label="Export Status"), gr.File(label="Download File")],
 
3308
  minimum=0,
3309
  maximum=1000,
3310
  info="Window size for smoothing (0 or 1 = no smoothing, 2-1000 = apply moving average)"
 
 
 
 
 
 
 
3311
  )
3312
  ],
3313
  outputs=[
 
3362
  choices=["Viridis", "Plasma", "Inferno", "Magma", "Cividis", "Blues", "Reds", "YlOrRd", "RdBu"],
3363
  value="Viridis",
3364
  info="Plotly colorscale for heatmap"
 
 
 
 
 
 
 
3365
  )
3366
  ],
3367
  outputs=[
 
3421
  placeholder="Leave blank for automatic",
3422
  value="",
3423
  info="Override automatic y-axis label"
 
 
 
 
 
 
 
3424
  )
3425
  ],
3426
  outputs=[
 
3482
  choices=["Viridis", "Plasma", "Inferno", "Magma", "Cividis", "Blues", "Reds", "YlOrRd", "RdBu"],
3483
  value="Viridis",
3484
  info="Plotly colorscale for contours"
 
 
 
 
 
 
 
3485
  )
3486
  ],
3487
  outputs=[
 
3581
  # Create organized interface with nested tabs
3582
  # All individual tools still exposed to MCP via api_name
3583
 
3584
+ with gr.Blocks(title="HDF5/NetCDF MCP Server") as demo:
3585
+ gr.Markdown("# HDF5/NetCDF MCP Server")
3586
+ gr.Markdown("Tools for analyzing HDF5 and NetCDF scientific data files")
3587
 
3588
  with gr.Tab("📥 File Loading"):
3589
  with gr.Tabs():