Skip to main content
Glama

NetCDF Explorer MCP Server

by HanchaoLi

NetCDF Explorer MCP Server

A simple and powerful MCP (Message Communication Protocol) server for exploring, analyzing, and interacting with NetCDF format files. Designed to simplify NetCDF data management with intuitive APIs and efficient data handling.

Overview

NetCDF (Network Common Data Form) is a widely used format for storing scientific data. This MCP server provides a streamlined interface to work with NetCDF files, offering essential functionalities to list files, inspect structures, extract data, and analyze variables—all while handling large datasets efficiently through smart sampling.

Features

  • 📁 File Discovery: List all NetCDF files (.nc, .cdf, .netcdf, .nc4) in a specified directory.
  • 🔍 Structure Inspection: Retrieve detailed metadata of NetCDF files, including dimensions, variables, attributes, and global properties.
  • 📊 Data Extraction: Read variable data with support for flexible slicing (e.g., lat: "0:10:2" to extract subsets).
  • 🧠 Smart Sampling: Automatically sample large datasets to prevent memory overflow, with configurable element limits.
  • Time Series Analysis: Extract temporal data from spatial variables, with optional custom location coordinates.
  • 🔎 Search Functionality: Find variables and attributes by keyword, simplifying navigation in complex files.
  • 📋 Variable Summaries: Generate human-readable summaries of variables, including dimensions, data types, and attributes.

Installation

Prerequisites

  • Python ≥ 3.13

Install via pip

pip install nc-mcp

Install from Source

  1. Clone the repository:
    git clone https://github.com/HanchaoLi/nc-mcp.git cd nc-mcp
  2. Install dependencies (using uv for faster dependency management):
    # Install uv (if not already installed) curl -LsSf https://astral.sh/uv/install.sh | sh # Sync dependencies uv sync --all-groups

Quick Start

Start the Server

python -m nc_mcp_server.main

API Reference

Core Functions

FunctionDescriptionParameters
list_netcdf_filesLists all NetCDF files in a directory.directory (str): Path to search (default: .).
get_netcdf_infoReturns metadata and structure of a NetCDF file (dimensions, variables, attributes).file_path (str): Path to the NetCDF file.
get_variable_dataExtracts data from a specific variable (supports slicing and sampling).file_path (str), variable_name (str), slices (dict, optional), max_elements (int, default: 1000).
search_variablesSearches variables and attributes for a keyword (case-insensitive).file_path (str), search_term (str).
extract_timeseriesExtracts time series data from a spatial variable.file_path (str), variable_name (str), location (dict, optional: spatial coordinates like {"lat": 10, "lon": 20}).

Testing

Run the test suite to verify functionality:

uv run pytest tests/ -v

Tests cover:

  • File discovery logic
  • NetCDF structure parsing
  • Data extraction with slicing
  • Sampling for large datasets
  • Error handling for invalid inputs

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Author

John Li

-
security - not tested
A
license - permissive license
-
quality - not tested

Enables exploration and analysis of NetCDF scientific data files through intuitive APIs. Supports file discovery, metadata inspection, data extraction with slicing, smart sampling for large datasets, and time series analysis.

  1. Overview
    1. Features
      1. Installation
        1. Prerequisites
        2. Install via pip
        3. Install from Source
      2. Quick Start
        1. Start the Server
      3. API Reference
        1. Core Functions
      4. Testing
        1. License
          1. Contributing
            1. Links
              1. Author

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  Enables autonomous data exploration on .csv-based datasets, providing intelligent insights with minimal effort.
                  Last updated -
                  2
                  475
                  MIT License
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A feature-rich NASA data query tool that supports various NASA API services including astronomy pictures, Mars rover photos, Earth satellite images, near-Earth objects data, and space weather information through natural language queries.
                  Last updated -
                  2
                  2
                  MIT License
                • A
                  security
                  A
                  license
                  A
                  quality
                  Exposes Cloudflare DNS, security, redirects and zone-settings functionality as structured tools that AI assistants like Claude Desktop can invoke directly.
                  Last updated -
                  18
                  MIT License

                View all related MCP servers

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/HanchaoLi/nc-mcp'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server