-
Notifications
You must be signed in to change notification settings - Fork 75
Description
Adding MCP support to the ERDDAP server would enable easy querying by LLM models. By being part of ERDDAP we can support the functionality more efficiently than an external MCP can.
What is MCP? MCP is an open standard that enables AI assistants to connect to data sources. By implementing an MCP server, ERDDAP would expose its datasets as "resources" and its API functions (search, griddap, tabledap) as "tools" that AI agents can discover and execute safely.
Implementation Concept: This could be implemented as a new handler within the Erddap servlet, or possibly as a new Servlet within the existing ERDDAP Java web application.
Protocol: JSON-RPC 2.0 (over generic HTTP or SSE).
Library: Use the official Java SDK for MCP.
The MCP server would expose standard tools such as:
search_datasets(query): Wraps the existing OpenSearch/Lucene search.
get_schema(dataset_id): Returns the metadata, variables, and units (reducing LLM hallucination).
fetch_data(dataset_id, constraints): returns a JSON or CSV snippet of the data.
Describe alternatives you've considered
External Sidecar: Users can run a separate middleware service (e.g., a Python script) that translates MCP requests to ERDDAP API calls. Downside: This puts the burden on the user to host and configure extra infrastructure.
OpenAPI/Swagger only: While ERDDAP has good docs, raw OpenAPI specs are often too large or complex for LLMs to navigate efficiently compared to the optimized MCP tool definition structure.
Additional context
Benefits to the Community:
"Chat with your Data": Users could connect their local AI clients (like Claude Desktop) directly to their organization's ERDDAP URL and ask, "Plot the temperature trends from station 42 from last week," without writing a single line of Python.
Standardization: Just as ERDDAP standardized REST access for humans/scripts, this standardizes access for Agents.
Discoverability: It lowers the barrier to entry for non-technical users to utilize the rich data hosted on ERDDAP servers.
Example "Tool" Definition (Conceptual): The MCP server would automatically generate tool definitions like this for the AI:
{
"name": "erddap_tabledap",
"description": "Retrieve tabular data from ERDDAP datasets.",
"inputSchema": {
"type": "object",
"properties": {
"dataset_id": { "type": "string" },
"variables": { "type": "array", "items": { "type": "string" } },
"time_range": { "type": "string", "description": "ISO formatted time range" }
},
"required": ["dataset_id"]
}
}