# Refinery Margin Calculator AI Agent Connect

> Calculate refinery gross margins, net margins, and crack spreads.

## Overview
- **Category:** finance
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_kcMkhyqnOApI7Pww2eCvIcKnRsq0pMK3FitczMzr/ai-agent-connect
- **Tags:** refinery, margin, crude, economics, oil

## Description

This MCP server provides essential tools for refinery economics. It allows AI agents to calculate `calculate_gross_margin` for specific crude slates, determine the bottom-line profitability using `calculate_net_margin`, and analyze specific profitability via `calculate_crack_spread`. It also includes `optimize_slates` to identify the most profitable combination of crude grades and product yields.

## Tools

### calculate_crack_spread
Calculates the crack spread for a single crude type into specific products

### calculate_gross_margin
Calculates the gross margin for a specific crude slate and product yield

### calculate_net_margin
Calculates the net margin after operating costs

### optimize_slates
Finds the combination of crude and products that maximizes net margin

## Prompt Examples

**Prompt:** 
```
What is the gross margin for a crude costing $70 with a 50% yield of gasoline at $100 and 50% yield of diesel at $80?
```

**Response:** 
```
The gross margin is $30.00.
```

**Prompt:** 
```
Calculate the crack spread for crude at $80 with 80% gasoline at $110 and 20% diesel at $90.
```

**Response:** 
```
The crack spread is $14.00.
```

**Prompt:** 
```
If my gross margin is $50 and my operating costs are $20, what is my net margin?
```

**Response:** 
```
Your net margin is $30.00.
```

## Frequently Asked Questions

**How do I calculate the net margin?**
You can use the `calculate_net_margin` tool by providing the gross margin data and the total operating costs.

**What is a crack spread?**
A crack spread is the difference between the price of a barrel of crude oil and the value of the refined products produced from it. Use `calculate_crack_spread` to find this value.

**Can I optimize my crude selection?**
Yes, the `optimize_slates` tool evaluates different crude and product combinations to find the maximum net margin.
