Sponsored by Deepsite.site

DESI MCP Server

Created By
SandyYuan6 months ago
mcp server for desi and other surveys
Content

DESI MCP Server

A Model Context Protocol (MCP) server for accessing DESI (Dark Energy Spectroscopic Instrument) survey data through dual access methods: Data Lab SQL queries (default) and SPARCL client (backup).

Overview

This MCP server provides fast, comprehensive access to DESI spectroscopic data, enabling AI assistants and researchers to:

  • Search DESI objects with coordinate-based queries (nearest, cone, box search)
  • Retrieve complete spectral data with wavelength/flux arrays
  • Filter by object type (galaxy, quasar, star), redshift, and data release
  • Access the full DESI catalog with no row limits via Data Lab SQL
  • Cross-survey searches including BOSS and SDSS via SPARCL client

Architecture

Dual Access Methods

Data Lab SQL (Default):

  • Fast queries against sparcl.main table
  • Efficient Q3C spatial indexing for coordinate searches
  • No result limits - access full DESI catalog
  • Asynchronous support for large datasets (>100k results)
  • Always sorted by distance for accurate "nearest" results

SPARCL Client (Backup):

  • Cross-survey access: DESI + BOSS + SDSS
  • Box-constraint spatial searches
  • Broader survey coverage when needed
  • Activated with use_sparcl_client: true

Available Tools

1. search_objects

Primary search interface for DESI astronomical objects

Coordinate Search Modes:

  • Nearest Object: ra, dec (finds closest within 0.1°)
  • Cone Search: ra, dec, radius (all objects within radius)
  • Box Search: ra_min, ra_max, dec_min, dec_max (rectangular region)

Filtering Options:

  • object_types: ["GALAXY", "QSO", "STAR"]
  • redshift_min/max: Redshift range constraints
  • data_releases: Specific releases ["DESI-DR1", "DESI-EDR", "BOSS-DR16"]

Output Control:

  • max_results: Limit number of results
  • output_file: Save results to JSON
  • async_query: Use for large datasets (>100k)
  • use_sparcl_client: Switch to SPARCL for cross-survey search

2. get_spectrum_by_id

Retrieve detailed spectrum data by SPARCL UUID

Parameters:

  • sparcl_id: SPARCL UUID identifier (required)
  • format: "summary" (metadata only) or "full" (complete spectral arrays)

Returns:

  • Object metadata (coordinates, redshift, type, survey info)
  • Full spectral data (wavelength, flux, model, uncertainties)
  • Saves complete data to JSON files for analysis

Installation

  1. Install dependencies:

    pip install mcp sparclclient datalab
    
  2. Verify access:

    # Test SPARCL
    from sparcl.client import SparclClient
    client = SparclClient()
    
    # Test Data Lab
    from dl import queryClient as qc
    result = qc.query(sql="SELECT COUNT(*) FROM sparcl.main")
    

Usage

Running the Server

python server.py

MCP Client Configuration

{
  "mcpServers": {
    "desi-mcp": {
      "command": "python",
      "args": ["/path/to/server.py"]
    }
  }
}

Example Queries

Find nearest galaxy:

search_objects(ra=9.9443, dec=41.7221, object_types=["GALAXY"])

Cone search for quasars:

search_objects(ra=150.0, dec=2.0, radius=0.1, object_types=["QSO"], redshift_min=2.0)

Box search with cross-survey data:

search_objects(ra_min=150.0, ra_max=151.0, dec_min=2.0, dec_max=3.0, use_sparcl_client=True)

Get complete spectrum:

get_spectrum_by_id(sparcl_id="1270d3c4-9d36-11ee-94ad-525400ad1336", format="full")

Data Coverage

  • DESI DR1: ~18+ million spectra
  • DESI EDR: ~1.8 million spectra
  • Cross-surveys: BOSS DR16, SDSS DR16 (via SPARCL)
  • Sky coverage: ~14,000 square degrees
  • Wavelength range: 360-980 nm
  • Spectral resolution: R ~ 2000-5500

Key Features

Accurate distance sorting: All coordinate searches properly sorted by distance
No result limits: Access complete DESI catalog via SQL
Fast queries: Optimized Q3C spatial indexing
Cross-survey access: DESI + BOSS + SDSS via SPARCL
Complete spectral data: Full wavelength/flux arrays with uncertainties
Async support: Handle large datasets (>100k results)
Error handling: Robust error handling and fallback options

Performance

  • Typical coordinate search: < 1 second
  • Large dataset queries: Async support for 100k+ results
  • Cross-survey searches: 2-5 seconds via SPARCL
  • Spectrum retrieval: < 2 seconds for full spectral data

Dependencies

  • mcp: Model Context Protocol framework
  • sparclclient: DESI SPARCL client for cross-survey access
  • datalab: NOIRLab Data Lab query client for SQL access
  • Standard library: asyncio, json, logging

License

[Specify license here]

Support

For issues related to:

Version

Current version: 0.1.0 (Phase 1 implementation)

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
ChatWiseThe second fastest AI chatbot™
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Tavily Mcp
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
WindsurfThe new purpose-built IDE to harness magic
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code