DESI MCP Server
About
A modular server providing unified access to multiple astronomical datasets, including astroquery services and DESI data sources.
Details
- Author
- SandyYuan
- Downloads
- 243
- Categories
- Database, Other
Jump to
- Accurate distance sorting for coordinate searches
- No result limits via Data Lab SQL
- Fast queries with Q3C spatial indexing
- Cross-survey access (DESI + BOSS + SDSS) via SPARCL
- Complete spectral data with wavelength/flux arrays and uncertainties
- Async support for large datasets (>100k results)
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
DESI MCP ServerCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Quick Setup For Cursor Claude Desktop
# Clone the repository git clone https://github.com/SandyYuan/astro_mcp.git cd astro_mcp # Create a dedicated conda environment with Python 3.11+ conda create -n mcp python=3.11 conda activate mcp # Install dependencies pip install -r requirements.txt # Install astronomical libraries for full functionality pip install sparclclient datalab astropy astroquery
# Test basic functionality python test_server.py # Test with a simple query (optional) python -c " import asyncio from server import astro_server async def test(): result = astro_server.get_global_statistics() print('✅ Server working:', result['total_files'], 'files in registry') services = astro_server.list_astroquery_services() print(f'✅ Astroquery: {len(services)} services discovered') asyncio.run(test()) "
Add this configuration to your Cursor MCP settings:
{ "mcpServers": { "astro-mcp": { "command": "/path/to/conda/envs/mcp/bin/python", "args": ["/path/to/astro_mcp/server.py"], "cwd": "/path/to/astro_mcp", "env": {} } } }
conda activate mcp which python # Copy this path for the "command" field above
Edit your Claude Desktop MCP configuration file:
macOS:~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:%APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "astro-mcp": { "command": "/path/to/conda/envs/mcp/bin/python", "args": ["/path/to/astro_mcp/server.py"], "cwd": "/path/to/astro_mcp", "env": {} } } }
- Restart Cursor/Claude Desktopto load the new MCP server
- Test with a querylike:
- "Search for galaxies near RA=10.68, Dec=41.27"
- "Get Betelgeuse's coordinates from SIMBAD"
- "Find 10 BOSS galaxies around z=0.5 and save as FITS"
- "List available astroquery services"
# Check Python environment conda activate mcp python --version # Should be 3.11+ # Test server manually python server.py # Should start without errors
- Verify the Python path in your config points to the conda environment
- Ensure the working directory (cwd) points to the astro_mcp folder
- Check that all dependencies are installed in the correct environment
# Install optional dependencies for full functionality conda activate mcp pip install sparclclient datalab astropy astroquery h5py
Usage Examples With Cursor Claude Desktop
Once configured, you can ask natural language questions about astronomical data:
- "Find galaxies near RA=150.5, Dec=2.2 within 0.1 degrees"
- "Search for quasars with redshift between 2 and 3"
- "Get Betelgeuse's exact coordinates from SIMBAD"
- "Find 10 BOSS galaxies around redshift 0.5"
- "Query VizieR for stellar catalogs in the Orion region"
- "Search SDSS for galaxies and save as FITS format"
- "Get object information from multiple astronomical databases"
- "List all available astroquery services for galaxy studies"
- "Get the spectrum for DESI object with ID 1270d3c4-9d36-11ee-94ad-525400ad1336"
- "Show me detailed spectral information for the brightest quasar you can find"
- "Find a galaxy spectrum and analyze its redshift"
- "List all saved astronomical data files"
- "Convert my galaxy catalog to FITS format"
- "Preview the structure of the latest search results"
- "Show me storage statistics for downloaded data"
- "Find high-redshift galaxies (z > 1.5) and save their spectra"
- "Search for objects in the COSMOS field and analyze their types"
- "Cross-match DESI and SDSS data for the same sky region"
- Execute appropriate database queries across multiple surveys
- Save results with descriptive filenames and metadata
- Handle coordinate conversions and astronomical calculations
- Convert data to standard formats (CSV, FITS) as needed
astro_mcp/ ├── server.py # Main MCP server entry point ├── data_sources/ # Modular data source implementations │ ├── __init__.py │ ├── base.py # Base class for all data sources │ ├── desi.py # DESI survey data access │ ├── astroquery_universal.py # Universal astroquery wrapper │ └── astroquery_metadata.py # Service metadata and capabilities ├── data_io/ # File handling and conversion │ ├── __init__.py │ ├── preview.py # Data preview and structure analysis │ └── fits_converter.py # FITS format conversion ├── tests/ # Test suite ├── examples/ # Usage examples └── requirements.txt # Project dependencies
- DESI: Dark Energy Spectroscopic Instrument via SPARCL and Data Lab
- Astroquery: Automatic access to 40+ astronomical services (SIMBAD, VizieR, SDSS, Gaia, etc.)
- Auto-discovery: Automatically detects and configures available astroquery services
- Unified interface: Same API for all data sources
- Automatic data saving with descriptive filenames
- Cross-source file registry and organization
- Comprehensive metadata tracking with provenance
- Smart file preview with loading examples
- FITS format conversion for astronomical compatibility
- Coordinate-based searches (point, cone, box) across all surveys
- Object type and redshift filtering
- SQL queries with spatial indexing (Q3C)
- Natural language query interpretation
- Cross-survey data correlation
- Spectral data retrieval and analysis
- Automatic FITS conversion for catalogs, spectra, and images
- File structure inspection and preview
- Statistics and storage management
- Extensible tool architecture for custom analysis
- Parameter preprocessing and validation
- Intelligent error handling with helpful suggestions
- Automatic format detection and conversion
- Consistent metadata across all data sources
Quick Start:For Cursor & Claude Desktop integration, see theQuick Setupsection above.
# Clone the repository git clone https://github.com/SandyYuan/astro_mcp.git cd astro_mcp # Create and activate environment conda create -n mcp python=3.11 conda activate mcp # Install core dependencies pip install -r requirements.txt # Install astronomical libraries pip install sparclclient datalab astropy astroquery # Optional: Install development dependencies pip install pytest coverage
# Test the server components python test_server.py # Check available astroquery services python -c " import asyncio from server import astro_server async def show_services(): services = astro_server.list_astroquery_services() print(f'✅ Discovered {len(services)} astroquery services') for service in services[:5]: # Show first 5 print(f' - {service["full_name"]} ({service["service"]})') asyncio.run(show_services()) "
- search_objects- Find astronomical objects (DESI)
- astroquery_query- Universal queries across 40+ astronomical services
- get_spectrum_by_id- Retrieve detailed spectral data (DESI)
- list_astroquery_services- Show all available astronomical databases
- get_astroquery_service_details- Detailed service information
- search_astroquery_services- Find services by criteria
- preview_data- Inspect saved files with structure analysis
- list_files- Manage saved data across all sources
- file_statistics- Storage usage and organization info
- convert_to_fits- Convert data to FITS format
# Get object coordinates from SIMBAD astroquery_query( service_name="simbad", object_name="Betelgeuse" ) # Search SDSS for galaxies with SQL astroquery_query( service_name="sdss", query_type="query_sql", sql="SELECT TOP 10 ra, dec, z FROM SpecObj WHERE class='GALAXY' AND z BETWEEN 0.1 AND 0.3" ) # Search VizieR catalogs astroquery_query( service_name="vizier", ra=10.68, dec=41.27, radius=0.1 ) # Convert results to FITS convert_to_fits( identifier="search_results.csv", data_type="catalog" )
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"desi mcp server": {
"astro_mcp": {
"command": "python",
"args": [
"server.py"
]
}
}
}
}
McpServers
{
"astro_mcp": {
"command": "python",
"args": [
"server.py"
]
}
}
Astro MCP - Agentic Astronomical Data Access
A modular Model Context Protocol (MCP) server that provides unified access to multiple astronomical datasets through a clean, extensible architecture.
This MCP server aims to transform big-data astronomy from a software engineering problem into a natural language conversation. Instead of spending months learning astroquery APIs, researchers simply ask for what they need and get clean, processed analysis-ready data products.
One expert solves the complexity once; thousands of scientists benefit forever. A student with little programming experience can now perform the same multi-survey analysis as an expert astronomer using nothing but natural language and an AI assistant.
This isn't just about astronomy—it's a template for democratizing all of science. Every field has brilliant researchers spending 80% of their time on data wrangling instead of discovery. By removing that bottleneck, we accelerate the pace of scientific progress itself.
The result: AI scientists that can seamlessly access and cross-match data from dozens of astronomical surveys, enabling discoveries that would have taken months of setup to attempt just a few years ago.
Quick Setup for Cursor & Claude Desktop
# Clone the repository git clone https://github.com/SandyYuan/astro_mcp.git cd astro_mcp # Create a dedicated conda environment with Python 3.11+ conda create -n mcp python=3.11 conda activate mcp # Install dependencies pip install -r requirements.txt # Install astronomical libraries for full functionality pip install sparclclient datalab astropy astroquery
# Test basic functionality python test_server.py # Test with a simple query (optional) python -c " import asyncio from server import astro_server async def test(): result = astro_server.get_global_statistics() print('✅ Server working:', result['total_files'], 'files in registry') services = astro_server.list_astroquery_services() print(f'✅ Astroquery: {len(services)} services discovered') asyncio.run(test()) "
Add this configuration to your Cursor MCP settings:
{ "mcpServers": { "astro-mcp": { "command": "/path/to/conda/envs/mcp/bin/python", "args": ["/path/to/astro_mcp/server.py"], "cwd": "/path/to/astro_mcp", "env": {} } } }
conda activate mcp which python # Copy this path for the "command" field above
Edit your Claude Desktop MCP configuration file:
macOS:~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:%APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "astro-mcp": { "command": "/path/to/conda/envs/mcp/bin/python", "args": ["/path/to/astro_mcp/server.py"], "cwd": "/path/to/astro_mcp", "env": {} } } }
- Restart Cursor/Claude Desktopto load the new MCP server
- Test with a querylike:
- "Search for galaxies near RA=10.68, Dec=41.27"
- "Get Betelgeuse's coordinates from SIMBAD"
- "Find 10 BOSS galaxies around z=0.5 and save as FITS"
- "List available astroquery services"
# Check Python environment conda activate mcp python --version # Should be 3.11+ # Test server manually python server.py # Should start without errors
- Verify the Python path in your config points to the conda environment
- Ensure the working directory (cwd) points to the astro_mcp folder
- Check that all dependencies are installed in the correct environment
# Install optional dependencies for full functionality conda activate mcp pip install sparclclient datalab astropy astroquery h5py
Usage Examples with Cursor/Claude Desktop
Once configured, you can ask natural language questions about astronomical data:
- "Find galaxies near RA=150.5, Dec=2.2 within 0.1 degrees"
- "Search for quasars with redshift between 2 and 3"
- "Get Betelgeuse's exact coordinates from SIMBAD"
- "Find 10 BOSS galaxies around redshift 0.5"
- "Query VizieR for stellar catalogs in the Orion region"
- "Search SDSS for galaxies and save as FITS format"
- "Get object information from multiple astronomical databases"
- "List all available astroquery services for galaxy studies"
- "Get the spectrum for DESI object with ID 1270d3c4-9d36-11ee-94ad-525400ad1336"
- "Show me detailed spectral information for the brightest quasar you can find"
- "Find a galaxy spectrum and analyze its redshift"
- "List all saved astronomical data files"
- "Convert my galaxy catalog to FITS format"
- "Preview the structure of the latest search results"
- "Show me storage statistics for downloaded data"
- "Find high-redshift galaxies (z > 1.5) and save their spectra"
- "Search for objects in the COSMOS field and analyze their types"
- "Cross-match DESI and SDSS data for the same sky region"
- Execute appropriate database queries across multiple surveys
- Save results with descriptive filenames and metadata
- Handle coordinate conversions and astronomical calculations
- Convert data to standard formats (CSV, FITS) as needed
astro_mcp/ ├── server.py # Main MCP server entry point ├── data_sources/ # Modular data source implementations │ ├── __init__.py │ ├── base.py # Base class for all data sources │ ├── desi.py # DESI survey data access │ ├── astroquery_universal.py # Universal astroquery wrapper │ └── astroquery_metadata.py # Service metadata and capabilities ├── data_io/ # File handling and conversion │ ├── __init__.py │ ├── preview.py # Data preview and structure analysis │ └── fits_converter.py # FITS format conversion ├── tests/ # Test suite ├── examples/ # Usage examples └── requirements.txt # Project dependencies
- DESI: Dark Energy Spectroscopic Instrument via SPARCL and Data Lab
- Astroquery: Automatic access to 40+ astronomical services (SIMBAD, VizieR, SDSS, Gaia, etc.)
- Auto-discovery: Automatically detects and configures available astroquery services
- Unified interface: Same API for all data sources
- Automatic data saving with descriptive filenames
- Cross-source file registry and organization
- Comprehensive metadata tracking with provenance
- Smart file preview with loading examples
- FITS format conversion for astronomical compatibility
- Coordinate-based searches (point, cone, box) across all surveys
- Object type and redshift filtering
- SQL queries with spatial indexing (Q3C)
- Natural language query interpretation
- Cross-survey data correlation
- Spectral data retrieval and analysis
- Automatic FITS conversion for catalogs, spectra, and images
- File structure inspection and preview
- Statistics and storage management
- Extensible tool architecture for custom analysis
- Parameter preprocessing and validation
- Intelligent error handling with helpful suggestions
- Automatic format detection and conversion
- Consistent metadata across all data sources
Quick Start:For Cursor & Claude Desktop integration, see theQuick Setupsection above.
# Clone the repository git clone https://github.com/SandyYuan/astro_mcp.git cd astro_mcp # Create and activate environment conda create -n mcp python=3.11 conda activate mcp # Install core dependencies pip install -r requirements.txt # Install astronomical libraries pip install sparclclient datalab astropy astroquery # Optional: Install development dependencies pip install pytest coverage
# Test the server components python test_server.py # Check available astroquery services python -c " import asyncio from server import astro_server async def show_services(): services = astro_server.list_astroquery_services() print(f'✅ Discovered {len(services)} astroquery services') for service in services[:5]: # Show first 5 print(f' - {service["full_name"]} ({service["service"]})') asyncio.run(show_services()) "
- search_objects- Find astronomical objects (DESI)
- astroquery_query- Universal queries across 40+ astronomical services
- get_spectrum_by_id- Retrieve detailed spectral data (DESI)
- list_astroquery_services- Show all available astronomical databases
- get_astroquery_service_details- Detailed service information
- search_astroquery_services- Find services by criteria
- preview_data- Inspect saved files with structure analysis
- list_files- Manage saved data across all sources
- file_statistics- Storage usage and organization info
- convert_to_fits- Convert data to FITS format
# Get object coordinates from SIMBAD astroquery_query( service_name="simbad", object_name="Betelgeuse" ) # Search SDSS for galaxies with SQL astroquery_query( service_name="sdss", query_type="query_sql", sql="SELECT TOP 10 ra, dec, z FROM SpecObj WHERE class='GALAXY' AND z BETWEEN 0.1 AND 0.3" ) # Search VizieR catalogs astroquery_query( service_name="vizier", ra=10.68, dec=41.27, radius=0.1 ) # Convert results to FITS convert_to_fits( identifier="search_results.csv", data_type="catalog" )
DESI (Dark Energy Spectroscopic Instrument)
- SPARCL Access: Full spectral data retrieval
- Data Lab SQL: Fast catalog queries (sparcl.main table)
- Coverage: DESI EDR (~1.8M) and DR1 (~18M+ spectra)
- Wavelength: 360-980 nm, Resolution: R ~ 2000-5500
- SIMBAD: Object identification and basic data
- VizieR: Astronomical catalogs and surveys
- SDSS: Sloan Digital Sky Survey data and spectra
- Gaia: Astrometric and photometric data
- MAST: Hubble, JWST, and other space telescope archives
- IRSA: Infrared and submillimeter archives
- ESASky: Multi-mission astronomical data
- And 30+ more services...
- Automatic service discovery and configuration
- Intelligent query type detection
- Parameter preprocessing and validation
- Unified error handling and help generation
# data_sources/my_survey.py from .base import BaseDataSource class MySurveyDataSource(BaseDataSource): def __init__(self, base_dir=None): super().__init__(base_dir=base_dir, source_name="my_survey") # Initialize survey-specific clients def search_objects(self, kwargs): # Implement survey-specific search pass
# server.py from data_sources import MySurveyDataSource class AstroMCPServer: def __init__(self, base_dir=None): # ... existing code ... self.my_survey = MySurveyDataSource(base_dir=base_dir)
The astroquery integration automatically discovers new services. To add custom metadata:
# data_sources/astroquery_metadata.py ASTROQUERY_SERVICE_INFO = { "my_service": { "full_name": "My Custom Service", "description": "Custom astronomical database", "data_types": ["catalogs", "images"], "wavelength_coverage": "optical", "object_types": ["stars", "galaxies"], "requires_auth": False, "example_queries": [ { "description": "Search by object name", "query": "astroquery_query(service_name='my_service', object_name='M31')" } ] } }
Files are automatically organized by data source with comprehensive metadata:
~/astro_mcp_data/ ├── file_registry.json # Global file registry with metadata ├── desi/ # DESI-specific files │ ├── desi_search_.json # Search results │ ├── spectrum_.json # Spectral data │ └── .fits # FITS conversions └── astroquery/ # Astroquery results ├── astroquery_simbad_.csv # SIMBAD queries ├── astroquery_sdss_.csv # SDSS results ├── astroquery_vizier_.csv # VizieR catalogs └── .fits # FITS conversions
- Modularity: Easy to add new surveys and analysis tools
- Universal Access: Single interface to 40+ astronomical databases
- Separation of Concerns: Data access, I/O, and analysis are separate
- Testability: Each module can be tested independently
- Scalability: Clean architecture supports unlimited growth
# Run all tests pytest # Test specific modules pytest tests/test_desi.py pytest tests/test_astroquery.py # Test with coverage pytest --cov=data_sources tests/
- Fork the repository
- Create a feature branch (git checkout -b feature/new-capability)
- Add your data source or tool following the existing patterns
- Write tests for new functionality
- Update documentation and examples
- Submit a pull request
- mcp>=1.0.0- Model Context Protocol framework
- pandas>=2.0.0- Data manipulation
- numpy>=1.24.0- Numerical computing
- astroquery>=0.4.6- Universal astronomical database access
- astropy>=5.0.0- FITS files and astronomical calculations
- sparclclient>=1.0.0- DESI SPARCL access
- datalab>=2.20.0- NOAO Data Lab queries
- h5py>=3.8.0- HDF5 file support
- pytest>=7.0.0- Testing framework
If you use this software in your research, please cite:
@software{astro_mcp, title={Astro MCP: Universal Astronomical Data Access for AI Agents}, author={[Your Name]}, year={2024}, url={[Repository URL]} }
- Issues:GitHub Issues
- Documentation:Full Documentation
- Discussions*:GitHub Discussions
- ✅ DESI data access via SPARCL and Data Lab
- ✅ Universal astroquery integration (40+ services)
- ✅ Automatic FITS conversion for all data types
- ✅ Intelligent file management with comprehensive metadata
- ✅ Natural language query interface
- 🚧 Cross-survey object matching and correlation
- 🚧 Advanced astronomical calculations (distances, magnitudes)
- 🚧 Time-series analysis for variable objects
- 🚧 Visualization tools integration
- 🔮 Machine learning integration for object classification
- 🔮 Real-time data streaming from surveys
- 🔮 Custom analysis pipeline creation
- 🔮 Multi-wavelength data correlation tools
Slingshot MCP introduces Slingshot Aerospace’s space data platform in your AI chat—explore satellites, orbits, and Portal insights through Slingshot’s hosted server.
Access data on 261 countries and 13.4 million cities — population, GDP, geography, rankings, and comparisons. Built for Claude, Cursor, and AI agents.
A nutrition analysis platform integrating Canada's Food Guide recipes with Health Canada's official nutrition databases.
Interact with the Hugging Face Dataset Viewer API to browse, filter, and get statistics for datasets.
Access ERDDAP servers worldwide to search, discover, and retrieve oceanographic and environmental scientific datasets.
A Centralized MCP Server for Fetching Data from Many Countries' Govs
Provides seamless access to particle physics data from the Particle Data Group (PDG) for AI assistants and applications.
Access the Protein Data Bank (PDB) for 3D structures of proteins and nucleic acids, with tools for structural analysis and comparison.
Connect LLMs or AI-chatbots to let them query and interact with official data and statistics from SCB (Sweden Statistics)
H1B salary data, compensation benchmarks, and job market analysis
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





