# Cosmic-Ray Rejection MCP for astronomy. AI Agent Connect

> Cosmic-Ray Rejection MCP provides specialized tools for cleaning astronomical image data. It identifies cosmic-ray hits and uses statistical methods to mask interference, helping you maintain data integrity in CCD and sensor-based imaging workflows.

## Overview
- **Category:** science
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_RzeejqQia4hJruyL4g2hI35V7lGCf4bUZcFXhSvy/ai-agent-connect
- **Tags:** astronomy, cosmic-ray, image-cleaning, ccd, sensor-noise

## Description

If you work with astronomical imaging, you know how much cosmic-ray hits can ruin a clean exposure. This MCP gives your AI client the ability to identify and mitigate these hits using statistical analysis. You can run full detection and flux replacement workflows on single images or compare multiple exposures to find transient hits that shouldn't be there. It also handles the math for you, providing pixel flux distributions and ensuring your binary masks are geometrically sound. Instead of manual cleaning, you can instruct your agent to handle the detection, masking, and statistical validation of your sensor data directly.

## Tools

### compare_images
This tool identifies cosmic rays by comparing a target image against a reference image or a stack of images.

### get_cleaned_image
This tool runs the primary detection and mitigation workflow to clean a single image.

### get_noise_statistics
This tool calculates statistical properties of an image to check quality or cleaning impact.

### validate_mask_integrity
This tool checks that generated masks are valid and free of geometric errors or impossible values.

## Prompt Examples

**Prompt:** 
```
Clean this astronomical image using the laplacian algorithm with a threshold of 5.0.
```

**Response:** 
```
The image has been cleaned. 42 cosmic-ray events were detected and masked using the median replacement method.
```

**Prompt:** 
```
Compare these two images to find cosmic ray hits.
```

**Response:** 
```
Comparison complete. 12 transient cosmic-ray hits were identified in the target image.
```

**Prompt:** 
```
What are the noise statistics for this image data?
```

**Response:** 
```
The image statistics are: Mean: 120.5, Standard Deviation: 15.2, Variance: 231.04, Min Flux: 0.0, Max Flux: 500.0.
```

## Capabilities

### Automated Hit Detection
Your agent uses statistical methods to find cosmic-ray interference in CCD data.

### Flux Replacement
The MCP replaces detected hits to restore image integrity.

### Multi-exposure Comparison
Your AI client compares different images to isolate transient hits.

### Statistical Analysis
The tool calculates pixel flux distributions to assess image quality.

### Mask Validation
The MCP verifies that binary masks are geometrically correct.

## Use Cases

### Single Image Cleaning
Use the primary workflow to remove cosmic-ray hits from a single CCD exposure.

### Transient Hit Detection
Compare a target image against a reference stack to find hits that only appear in one frame.

### Quality Assessment
Run noise statistics to see how much the cleaning process changed the pixel flux distribution.

### Mask Verification
Check that your generated masks don't contain geometric errors before proceeding with analysis.

## Benefits

- Reduces manual image cleaning through automated statistical detection.
- Maintains data integrity by replacing hit flux with calculated values.
- Speeds up transient hit identification via multi-image comparison.
- Ensures mask accuracy with geometric validation tools.

## How It Works

Connect your AI client to Vinkius to start processing astronomical data immediately.

1. Connect your preferred MCP-compatible client to the Vinkius platform.
2. Provide your astronomical image data to your AI agent.
3. Instruct your agent to use the specific cleaning or comparison tools.
4. Review the statistical output or the cleaned image files produced by the MCP.

## Frequently Asked Questions

**What kind of images can this MCP process?**
This MCP is designed for astronomical image data, specifically targeting cosmic-ray hits in CCD and sensor-based imaging.

**How does it find cosmic rays?**
It uses several statistical methods to identify hits, including comparing target images against reference stacks.

**Can I use this with Claude or Cursor?**
Yes, you can connect this MCP to any MCP-compatible client like Claude, Cursor, or Windsurf via Vinkius.

**Does it detect hits or does it fix them?**
It can do both. The get_cleaned_image tool performs detection and flux replacement to mitigate the hits.

**How do I know if the mask is correct?**
You can use the validate_mask_integrity tool to ensure the mask is valid and lacks geometric errors.

**What algorithms are supported for detection?**
The server supports Laplacian edge detection, median-residual methods, and multi-image comparison.

**How are cosmic ray hits replaced in the image?**
You can choose between 'median' replacement or 'interpolation' to fill the flux of detected hits.

**Can I verify the quality of the cleaned image?**
Yes, use `get_noise_statistics` to calculate mean, variance, and standard deviation of the pixel flux.
