Skip to main content
Glama
markloveridge-rex

SIGNALS Market Readiness MCP Server

README.md
# SIGNALS MCP Server — Market Readiness Index

MCP (Model Context Protocol) server exposing all 7 SIGNALS market readiness signals as tools. Runs server-side — no CORS issues. All Yahoo Finance, ENTSOG, AGSI+, Carbon Intensity, and Open-Meteo APIs work cleanly.

## Tools Exposed

| Tool | Signal | Source |
|------|--------|--------|
| `get_norwegian_gas_flows` | S1 — Norwegian Gas Flows | ENTSOG + UMMs |
| `get_eu_gas_storage` | S2 — EU Gas Storage | AGSI+ |
| `get_nbp_gas_price` | S3 — NBP Gas Price | Yahoo (TTF) |
| `get_uk_generation_mix` | S4 — UK Gen Mix | Carbon Intensity |
| `get_temperature_vs_norm` | S5 — Temperature | Open-Meteo |
| `get_implied_power_price` | S6 — Implied Power | Computed |
| `get_brent_crude` | S7 — Brent Crude | Yahoo (BZ=F) |
| `get_market_readiness_index` | **ALL 7 + MRI** | All sources |

## Quick Start (Local)

```bash
pip install -r requirements.txt

# STDIO transport (for Claude Desktop, Claude Code)
python signals_mcp.py

# SSE transport (for Base44, remote clients)
python signals_mcp_sse.py
```

## Deploy to Railway (Recommended)

Railway is the easiest way to get a hosted URL for Base44.

1. Push this folder to a GitHub repo
2. Go to [railway.app](https://railway.app) → New Project → Deploy from GitHub
3. Railway auto-detects the Dockerfile
4. Once deployed, your SSE endpoint is: `https://your-app.railway.app/sse`

**Alternative: Render.com**
1. New Web Service → connect your repo
2. Build Command: `pip install -r requirements.txt`
3. Start Command: `python signals_mcp_sse.py`
4. SSE endpoint: `https://your-app.onrender.com/sse`

## Connect to Base44

1. Go to **Account Settings → MCP Connections**
2. Click **Add MCP Server**
3. Enter:
   - **Name**: `SIGNALS Market Readiness`
   - **URL**: `https://your-deployed-url.railway.app/sse`
4. Save

Now in the Base44 AI builder chat, you can say things like:
- "Pull the current Market Readiness Index from SIGNALS"
- "Check Norwegian gas flows"
- "What's the implied UK power price?"

> **Note**: Base44 MCP connections work in the AI builder chat, not in deployed apps.
> For deployed apps, use Base44 **backend functions** that call your server's tools
> via HTTP, or use the **Custom OpenAPI integration** approach (see below).

## Connect to Claude Desktop

Add to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "signals": {
      "command": "python",
      "args": ["/path/to/signals_mcp.py"]
    }
  }
}
```

## Connect to Claude Code

```bash
claude mcp add signals python /path/to/signals_mcp.py
```

## For Base44 Deployed Apps: Backend Functions

If you want live signal data in your actual Base44 app (not just builder chat), create backend functions that call your hosted server directly:

```javascript
// Base44 backend function example
import fetch from 'node-fetch';

export async function getMarketReadiness() {
  // Call your hosted MCP server's underlying endpoint
  const response = await fetch('https://your-app.railway.app/sse', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      method: 'tools/call',
      params: { name: 'get_market_readiness_index', arguments: {} }
    })
  });
  return await response.json();
}
```

Alternatively, add a simple REST wrapper (see `rest_wrapper.py` if included) that exposes `/api/signals` as a standard JSON endpoint your Base44 app can call.

## Updating the Power Baseline

Signal 6 uses a baseline from smart-energy.uk. Update `POWER_BASELINE` in `signals_mcp.py`, or pass it as a parameter when calling `get_implied_power_price(baseline_gbp_mwh=72.50)`.

## Architecture

```
┌─────────────┐     ┌──────────────────┐     ┌──────────────┐
│  Base44 AI  │────▶│  SIGNALS MCP     │────▶│  ENTSOG      │
│  Builder    │ SSE │  Server          │     │  AGSI+       │
│  Chat       │     │  (Railway/Render)│     │  Yahoo       │
├─────────────┤     │                  │     │  CarbonInt   │
│  Claude     │────▶│  Python + MCP SDK│     │  Open-Meteo  │
│  Desktop    │stdio│                  │     └──────────────┘
├─────────────┤     └──────────────────┘
│  Base44 App │────▶ (via backend function / REST wrapper)
│  (deployed) │ HTTP
└─────────────┘
```