earthdata-mcp-server 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ # Copyright (c) 2023-2024 Datalayer, Inc.
2
+ #
3
+ # BSD 3-Clause License
4
+
5
+ """Earthdata MCP Server."""
6
+
7
+ __all__ = []
@@ -0,0 +1,7 @@
1
+ # Copyright (c) 2023-2024 Datalayer, Inc.
2
+ #
3
+ # BSD 3-Clause License
4
+
5
+ """Earthdata MCP Server."""
6
+
7
+ __version__ = "0.1.0"
@@ -0,0 +1,92 @@
1
+ # Copyright (c) 2023-2024 Datalayer, Inc.
2
+ #
3
+ # BSD 3-Clause License
4
+
5
+ import logging
6
+
7
+ from mcp.server.fastmcp import FastMCP
8
+ import earthaccess
9
+
10
+ # Initialize FastMCP server
11
+ mcp = FastMCP("earthdata")
12
+
13
+
14
+ logger = logging.getLogger(__name__)
15
+
16
+
17
+ @mcp.tool()
18
+ def search_earth_datasets(search_keywords: str, count: int, temporal:tuple, bounding_box:tuple) -> list:
19
+ """
20
+ Search for datasets on NASA Earthdata.
21
+
22
+ Args:
23
+ search_keywords: Keywords to search for in the dataset titles.
24
+ count: Number of datasets to return.
25
+ temporal: (Optional) Temporal range in the format (date_from, date_to).
26
+ bounding_box: (Optional) Bounding box in the format (lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat).
27
+
28
+ Returns:
29
+ list
30
+ List of dataset abstracts.
31
+ """
32
+
33
+ search_params = {
34
+ "keyword": search_keywords,
35
+ "count": count,
36
+ "cloud_hosted": True
37
+ }
38
+
39
+ if temporal and len(temporal) == 2:
40
+ search_params["temporal"] = temporal
41
+ if bounding_box and len(bounding_box) == 4:
42
+ search_params["bounding_box"] = bounding_box
43
+
44
+ datasets = earthaccess.search_datasets(**search_params)
45
+
46
+ datasets_info = [
47
+ {'Title': dataset.get_umm("EntryTitle"),
48
+ 'ShortName': dataset.get_umm("ShortName"),
49
+ 'Abstract': dataset.abstract(),
50
+ "Data Type": dataset.data_type(),
51
+ "DOI": dataset.get_umm("DOI"),
52
+ "LandingPage": dataset.landing_page(),
53
+ "DatasetViz": dataset._filter_related_links("GET RELATED VISUALIZATION"),
54
+ "DatasetURL": dataset._filter_related_links("GET DATA"),
55
+ } for dataset in datasets]
56
+
57
+ return datasets_info
58
+
59
+ @mcp.tool()
60
+ def search_earth_datagranules(short_name: str, count:int, temporal:tuple, bounding_box:tuple) -> list:
61
+ """
62
+ Search for data granules on NASA Earthdata.
63
+
64
+ Args:
65
+ short_name: Short name of the dataset.
66
+ count: Number of data granules to return.
67
+ temporal: (Optional) Temporal range in the format (date_from, date_to).
68
+ bounding_box: (Optional) Bounding box in the format (lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat).
69
+
70
+ Returns:
71
+ list
72
+ List of data granules.
73
+ """
74
+
75
+ search_params = {
76
+ "short_name": short_name,
77
+ "count": count,
78
+ "cloud_hosted": True
79
+ }
80
+
81
+ if temporal and len(temporal) == 2:
82
+ search_params["temporal"] = temporal
83
+ if bounding_box and len(bounding_box) == 4:
84
+ search_params["bounding_box"] = bounding_box
85
+
86
+ datagranules = earthaccess.search_data(**search_params)
87
+
88
+ return datagranules
89
+
90
+ if __name__ == "__main__":
91
+ # Initialize and run the server
92
+ mcp.run(transport='stdio')
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: earthdata_mcp_server
3
+ Version: 0.1.0
4
+ Project-URL: Home, https://github.com/datalayer/earthdata-mcp-server
5
+ Author-email: Datalayer <info@datalayer.io>
6
+ License: BSD 3-Clause License
7
+
8
+ Copyright (c) 2024, Datalayer
9
+ All rights reserved.
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions are met:
13
+
14
+ 1. Redistributions of source code must retain the above copyright notice, this
15
+ list of conditions and the following disclaimer.
16
+
17
+ 2. Redistributions in binary form must reproduce the above copyright notice,
18
+ this list of conditions and the following disclaimer in the documentation
19
+ and/or other materials provided with the distribution.
20
+
21
+ 3. Neither the name of the copyright holder nor the names of its
22
+ contributors may be used to endorse or promote products derived from
23
+ this software without specific prior written permission.
24
+
25
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
+
36
+ ---
37
+
38
+ This library reuse part of Jupyter Server code licensed under BSD 3-Clause License
39
+ Source: https://github.com/jupyter-server/jupyter_server/blame/v2.12.0/jupyter_server/services/kernels/connection/base.py
40
+
41
+ This library reuse part of traitlets code licensed under BSD 3-Clause License
42
+ Source: https://github.com/ipython/traitlets/blob/v5.14.3/traitlets/log.py
43
+ License-File: LICENSE
44
+ Keywords: Earthdata
45
+ Classifier: Intended Audience :: Developers
46
+ Classifier: Intended Audience :: System Administrators
47
+ Classifier: License :: OSI Approved :: BSD License
48
+ Classifier: Programming Language :: Python
49
+ Classifier: Programming Language :: Python :: 3
50
+ Requires-Python: >=3.10
51
+ Requires-Dist: earthaccess
52
+ Requires-Dist: mcp[cli]>=1.2.1
53
+ Requires-Dist: rich
54
+ Provides-Extra: lint
55
+ Requires-Dist: mdformat-gfm>=0.3.5; extra == 'lint'
56
+ Requires-Dist: mdformat>0.7; extra == 'lint'
57
+ Requires-Dist: ruff; extra == 'lint'
58
+ Provides-Extra: test
59
+ Requires-Dist: ipykernel; extra == 'test'
60
+ Requires-Dist: jupyter-server<3,>=1.6; extra == 'test'
61
+ Requires-Dist: pytest>=7.0; extra == 'test'
62
+ Provides-Extra: typing
63
+ Requires-Dist: mypy>=0.990; extra == 'typing'
64
+ Description-Content-Type: text/markdown
65
+
66
+ <!--
67
+ ~ Copyright (c) 2023-2024 Datalayer, Inc.
68
+ ~
69
+ ~ BSD 3-Clause License
70
+ -->
71
+
72
+ [![Datalayer](https://assets.datalayer.tech/datalayer-25.svg)](https://datalayer.io)
73
+
74
+ [![Become a Sponsor](https://img.shields.io/static/v1?label=Become%20a%20Sponsor&message=%E2%9D%A4&logo=GitHub&style=flat&color=1ABC9C)](https://github.com/sponsors/datalayer)
75
+
76
+ # 🪐 ✨ Earthdata MCP Server
77
+
78
+ [![Github Actions Status](https://github.com/datalayer/earthdata-mcp-server/workflows/Build/badge.svg)](https://github.com/datalayer/earthdata-mcp-server/actions/workflows/build.yml)
79
+ [![PyPI - Version](https://img.shields.io/pypi/v/earthdata-mcp-server)](https://pypi.org/project/earthdata-mcp-server)
80
+
81
+ Earthdata MCP Server is a [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) server implementation that provides tools to interact with [NASA Earth Data](https://www.earthdata.nasa.gov/). It enables efficient dataset discovery and retrieval for Geospatial analysis.
82
+
83
+ ## Usage with Claude Desktop
84
+
85
+ To use this with Claude Desktop, add the following to your claude_desktop_config.json:
86
+
87
+ ```json
88
+ {
89
+ "mcpServers": {
90
+ "earthdata": {
91
+ "command": "docker",
92
+ "args": [
93
+ "run",
94
+ "-i",
95
+ "--rm",
96
+ "datalayer/earthdata-mcp-server:latest"
97
+ ]
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ ## Components
104
+
105
+ ### Tools
106
+
107
+ The server currently offers 2 tools:
108
+
109
+ 1. `search_earth_datasets`
110
+ - Search for datasets on NASA Earthdata.
111
+ - Input:
112
+ - search_keywords (str): Keywords to search for in the dataset titles.
113
+ - count (int): Number of datasets to return.
114
+ - temporal (tuple): (Optional) Temporal range in the format (date_from, date_to).
115
+ - bounding_box (tuple): (Optional) Bounding box in the format (lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat).
116
+ - Returns: List of dataset abstracts.
117
+
118
+ 2. `search_earth_datagranules`
119
+ - Search for data granules on NASA Earthdata.
120
+ - Input:
121
+ - short_name (str): Short name of the dataset.
122
+ - count (int): Number of data granules to return.
123
+ - temporal (tuple): (Optional) Temporal range in the format (date_from, date_to).
124
+ - bounding_box (tuple): (Optional) Bounding box in the format (lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat).
125
+ - Returns: List of data granules.
126
+
127
+ ## Building from Source
128
+
129
+ ```bash
130
+ docker build -t datalayer/earthdata-mcp-server .
131
+ ```
@@ -0,0 +1,7 @@
1
+ earthdata_mcp_server/__init__.py,sha256=47PmGgFXaYhIQq3qBXHt8gj400v_LJjUWyw-GTYq694,110
2
+ earthdata_mcp_server/__version__.py,sha256=Rup5YTFFEd5KPxOGq9ynti1uyQMG0fo2biFYbj4-FWE,119
3
+ earthdata_mcp_server/server.py,sha256=feuDbuGByK3tQ-VI8DSSIkmtTtObMHvHJI8eCRyvZHI,2734
4
+ earthdata_mcp_server-0.1.0.dist-info/METADATA,sha256=zbHXDp_FwqwrjgYUVUVXpsjFECYyQK_vGH-TGevdAfc,5516
5
+ earthdata_mcp_server-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ earthdata_mcp_server-0.1.0.dist-info/licenses/LICENSE,sha256=W_0rWKXq5rcG8a4qp2wkg_MUCpYg4QwjEMWZtVYdmT4,1882
7
+ earthdata_mcp_server-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,37 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, Datalayer
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ ---
32
+
33
+ This library reuse part of Jupyter Server code licensed under BSD 3-Clause License
34
+ Source: https://github.com/jupyter-server/jupyter_server/blame/v2.12.0/jupyter_server/services/kernels/connection/base.py
35
+
36
+ This library reuse part of traitlets code licensed under BSD 3-Clause License
37
+ Source: https://github.com/ipython/traitlets/blob/v5.14.3/traitlets/log.py