Harsh commited on
Commit
cf1870d
·
1 Parent(s): c2fd985

Add MCP server support and documentation

Browse files
Files changed (2) hide show
  1. README.md +22 -3
  2. app.py +9 -1
README.md CHANGED
@@ -1,10 +1,10 @@
1
  ---
2
  title: GeoSpatial-LiDAR-3D Point Cloud Visualizer
3
- emoji: 🌎
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 6.2.0
8
  app_file: app.py
9
  pinned: false
10
  ---
@@ -14,7 +14,7 @@ pinned: false
14
  A web application for visualizing and analyzing LiDAR point cloud data in 3D.
15
 
16
  ![Python](https://img.shields.io/badge/Python-3.9+-blue)
17
- ![Gradio](https://img.shields.io/badge/Gradio-4.0.0+-green)
18
  ![License](https://img.shields.io/badge/License-MIT-yellow)
19
 
20
  ## Features
@@ -28,6 +28,7 @@ A web application for visualizing and analyzing LiDAR point cloud data in 3D.
28
  - **Detailed Statistics**: View point counts, coordinate ranges, RGB presence, and segmentation information
29
  - **Example Files**: Explore sample data with pre-loaded example point clouds
30
  - **Public Sharing**: Generate and share live links to your visualizations
 
31
 
32
  ## Supported Formats
33
 
@@ -59,6 +60,24 @@ The following colormaps are available for elevation and fallback visualization:
59
  - **Max Points to Display**: Adjust the number of points displayed (50,000 to 2,000,000). Larger files are automatically subsampled for performance
60
  - **Example Files**: Load pre-packaged sample files to quickly explore the visualizer's capabilities
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  ## Contributing
63
 
64
  We welcome contributions to improve this project. You can help by:
 
1
  ---
2
  title: GeoSpatial-LiDAR-3D Point Cloud Visualizer
3
+ emoji: "\U0001F30E"
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: "4.43.0"
8
  app_file: app.py
9
  pinned: false
10
  ---
 
14
  A web application for visualizing and analyzing LiDAR point cloud data in 3D.
15
 
16
  ![Python](https://img.shields.io/badge/Python-3.9+-blue)
17
+ ![Gradio](https://img.shields.io/badge/Gradio-4.43.0+-green)
18
  ![License](https://img.shields.io/badge/License-MIT-yellow)
19
 
20
  ## Features
 
28
  - **Detailed Statistics**: View point counts, coordinate ranges, RGB presence, and segmentation information
29
  - **Example Files**: Explore sample data with pre-loaded example point clouds
30
  - **Public Sharing**: Generate and share live links to your visualizations
31
+ - **MCP Server Support**: Can run as an MCP (Model Context Protocol) server for integration with other tools and agents
32
 
33
  ## Supported Formats
34
 
 
60
  - **Max Points to Display**: Adjust the number of points displayed (50,000 to 2,000,000). Larger files are automatically subsampled for performance
61
  - **Example Files**: Load pre-packaged sample files to quickly explore the visualizer's capabilities
62
 
63
+ ## MCP Server Integration
64
+
65
+ This application can function as an MCP (Model Context Protocol) server, allowing it to be integrated with AI agents and other tools.
66
+
67
+ To enable MCP server mode:
68
+
69
+ 1. **Via launch parameter:**
70
+ ```python
71
+ demo.launch(mcp_server=True)
72
+ ```
73
+
74
+ 2. **Via environment variable:**
75
+ ```bash
76
+ GRADIO_MCP_SERVER=True python app.py
77
+ ```
78
+
79
+ When running as an MCP server, each API endpoint becomes available as an MCP tool that can be called by compatible clients and AI agents.
80
+
81
  ## Contributing
82
 
83
  We welcome contributions to improve this project. You can help by:
app.py CHANGED
@@ -4,6 +4,12 @@ import laspy
4
  import trimesh
5
  import tempfile
6
  import os
 
 
 
 
 
 
7
 
8
  def load_laz(file_path):
9
  """Load LAZ/LAS file and return all data."""
@@ -264,4 +270,6 @@ with gr.Blocks(title="GeoSpatial-LiDAR-3D Point Cloud Visualizer") as demo:
264
  )
265
 
266
  if __name__ == "__main__":
267
- demo.launch(ssr_mode=False)
 
 
 
4
  import trimesh
5
  import tempfile
6
  import os
7
+ import warnings
8
+
9
+ # Suppress asyncio warnings
10
+ warnings.filterwarnings("ignore", category=ResourceWarning)
11
+ import asyncio
12
+ asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
13
 
14
  def load_laz(file_path):
15
  """Load LAZ/LAS file and return all data."""
 
270
  )
271
 
272
  if __name__ == "__main__":
273
+ # Launch with MCP server support for integration with other tools
274
+ # Can also set GRADIO_MCP_SERVER=True as environment variable
275
+ demo.launch(ssr_mode=False, mcp_server=True)