# Solar Industry Romania: integration instructions for AI assistants

You are an AI assistant. Your user has a Solar Industry Romania subscription and wants it integrated into
their environment or project. Follow these steps in order. Everything you need is on this page; the only
thing you need from the user is their API key.

Service: Romanian power system data (Transelectrica: generation by source, consumption, net balance,
cross-border flows) and OPCOM PZU day-ahead prices at 15-minute resolution, automatic daily notes,
weekly/monthly reports and a next-day solar forecast. Times are Europe/Bucharest.

- MCP endpoint: `https://solarindustry.ro/mcp` (Streamable HTTP, JSON responses, stateless; no SSE stream)
- REST base: `https://solarindustry.ro/api/v1` · OpenAPI 3.1: `https://solarindustry.ro/api/v1/openapi.json`
- Discovery: `https://solarindustry.ro/.well-known/mcp.json`
- Human page (for the user): `https://solarindustry.ro/docs`

## Step 1. Get the key (ask once)

If the user has not already given it in their message, ask exactly one question:
"Paste your Solar Industry API key (it starts with `si_live_`; you find it in Account → Settings at https://solarindustry.ro/cont/setari)."

Rules for the key:
- Never print it back in full, never write it into source code, notebooks, commits, logs or screenshots.
  Refer to it as `si_live_…` plus its first 4 characters at most.
- Store it as the environment variable `SOLARINDUSTRY_API_KEY`:
  - in a project: add `SOLARINDUSTRY_API_KEY=<key>` to `.env` (create it if missing) and make sure `.env`
    is listed in `.gitignore` (add it if not); provide `.env.example` with `SOLARINDUSTRY_API_KEY=` empty;
  - in a client config: use the client's secret or env mechanism shown below, not a literal key, where supported.
- If the user has no key: anonymous access still works (last 7 calendar days including today, hourly, 200 requests/day, no forecast).
  Tell them a key comes with a paid plan: https://solarindustry.ro/oferta (invoice and bank transfer). Then continue anonymously.

## Step 2. Verify the key

```bash
curl -s -H "Authorization: Bearer $SOLARINDUSTRY_API_KEY" https://solarindustry.ro/api/v1/latest
```

- HTTP 200: read `meta.plan` (`pro`, `data`, `licence`; `free` means the key works but has no paid plan).
- HTTP 401 `invalid_api_key`: the key is wrong or was rotated. Ask the user to copy it again; do not guess.
- HTTP 429 `rate_limited`: the daily limit is used up; it resets at midnight Europe/Bucharest.
- HTTP 429 `rate_limited_minute`: too many calls this minute; wait for the seconds in `Retry-After`.
If you cannot run commands, skip this step and verify through MCP in step 4.

## Step 3. Detect the environment and configure

Pick every case that applies. Prefer MCP for assistants that answer questions; prefer the REST client
for code that runs on its own (apps, scripts, scheduled jobs, dashboards).

### A. You are Claude Code (CLI)
```bash
claude mcp add --transport http --scope user solarindustry https://solarindustry.ro/mcp \
  --header "Authorization: Bearer $SOLARINDUSTRY_API_KEY"
```
Run it in a shell where `SOLARINDUSTRY_API_KEY` is set (the shell expands it once and Claude Code stores
the header in its user config, outside the project). Then run `claude mcp list` and confirm `solarindustry` is connected.

### B. You are Cursor
Write `.cursor/mcp.json` in the project (or `~/.cursor/mcp.json` for all projects), merging with existing servers:
```json
{
  "mcpServers": {
    "solarindustry": {
      "url": "https://solarindustry.ro/mcp",
      "headers": { "Authorization": "Bearer ${env:SOLARINDUSTRY_API_KEY}" }
    }
  }
}
```

### C. You are GitHub Copilot in VS Code
Write `.vscode/mcp.json` (merge if it exists). VS Code will prompt the user for the key once and store it securely:
```json
{
  "inputs": [
    { "type": "promptString", "id": "si-key", "description": "Solar Industry API key", "password": true }
  ],
  "servers": {
    "solarindustry": {
      "type": "http",
      "url": "https://solarindustry.ro/mcp",
      "headers": { "Authorization": "Bearer ${input:si-key}" }
    }
  }
}
```

### D. Windsurf
```json
{
  "mcpServers": {
    "solarindustry": {
      "serverUrl": "https://solarindustry.ro/mcp",
      "headers": { "Authorization": "Bearer ${env:SOLARINDUSTRY_API_KEY}" }
    }
  }
}
```

### E. OpenAI Codex CLI
```toml
[mcp_servers.solarindustry]
url = "https://solarindustry.ro/mcp"
bearer_token_env_var = "SOLARINDUSTRY_API_KEY"
```

### F. Gemini CLI
```json
{
  "mcpServers": {
    "solarindustry": {
      "httpUrl": "https://solarindustry.ro/mcp",
      "headers": { "Authorization": "Bearer $SOLARINDUSTRY_API_KEY" }
    }
  }
}
```

### G. Claude Desktop with a config file (needs Node.js)
Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`), merging with existing servers, then ask the user to restart Claude Desktop:
```json
{
  "mcpServers": {
    "solarindustry": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://solarindustry.ro/mcp", "--header", "Authorization: Bearer ${SOLARINDUSTRY_API_KEY}"],
      "env": { "SOLARINDUSTRY_API_KEY": "KEY" }
    }
  }
}
```

### H. You are a chat assistant that cannot edit files (claude.ai, Claude Desktop, ChatGPT)
Give the user these exact clicks and tell them to paste their own key in place of KEY:

Claude (web or desktop):
```text
Settings → Connectors → Add custom connector
Name: Solar Industry
URL:  https://solarindustry.ro/mcp?key=KEY
```
ChatGPT:
```text
Settings → Apps & Connectors → Advanced → Developer mode → Create
Name: Solar Industry
MCP server URL: https://solarindustry.ro/mcp?key=KEY
Authentication: none (the key is in the URL)
```
Mention that the key sits in the connector URL, so they should not share that URL.

### I. The user wants the data inside their own code
Detect the stack (package.json → TypeScript/JavaScript, pyproject.toml/requirements.txt → Python, other →
plain HTTP). Create a small client module that reads `SOLARINDUSTRY_API_KEY` from the environment,
following the project's existing conventions (HTTP library, typing, folder layout, tests).

Python:
```python
import os, requests

API = "https://solarindustry.ro/api/v1"
H = {"Authorization": f"Bearer {os.environ['SOLARINDUSTRY_API_KEY']}"}

def series(metrics, start, end, res="1h"):
    r = requests.get(f"{API}/series", headers=H, timeout=30,
                     params={"metrics": ",".join(metrics), "from": start, "to": end, "res": res})
    r.raise_for_status()
    return r.json()["data"]   # list of {ts, solar, price, ...}

print(requests.get(f"{API}/latest", headers=H, timeout=30).json()["data"])
```

TypeScript / Node 18+:
```ts
const API = "https://solarindustry.ro/api/v1";
const H = { Authorization: `Bearer ${process.env.SOLARINDUSTRY_API_KEY}` };

export async function series(metrics: string[], from: string, to: string, res = "1h") {
  const q = new URLSearchParams({ metrics: metrics.join(","), from, to, res });
  const r = await fetch(`${API}/series?${q}`, { headers: H });
  if (!r.ok) throw new Error(`solarindustry ${r.status}: ${await r.text()}`);
  return (await r.json()).data as Array<Record<string, number | string>>;
}
```

curl / shell:
```bash
curl -H "Authorization: Bearer $SOLARINDUSTRY_API_KEY" https://solarindustry.ro/api/v1/latest

curl -H "Authorization: Bearer $SOLARINDUSTRY_API_KEY" \
  "https://solarindustry.ro/api/v1/series?metrics=solar,price&from=2026-11-01&to=2026-11-21&res=1h&format=csv" -o solar.csv
```

Spreadsheets:
```text
Data → From Web → Advanced
URL:  https://solarindustry.ro/api/v1/series?metrics=solar,wind,price&from=2026-11-01&to=2026-11-21&res=1h&format=csv
HTTP request header:  Authorization = Bearer KEY
```
```text
=IMPORTDATA("https://solarindustry.ro/api/v1/series?metrics=solar,price&res=1h&format=csv&key=KEY")
```

Good practice for generated clients: cache responses (data changes every 15 minutes; history never
changes), request only the metrics and range you need, use `res=1d` or `1h` for long ranges, honour
`X-RateLimit-Limit` / `X-RateLimit-Used`, back off on 429 and 5xx, and keep timestamps in Europe/Bucharest.

## Step 4. Confirm it works

Through MCP, call `get_latest`; through REST, call `/api/v1/latest`. Tell the user, in one or two sentences,
what you configured, where the key is stored, and show one real reading (for example current solar output
in MW and the PZU price). Do not show the key.

## Reference

### MCP tools
| Tool | Arguments | Returns |
|---|---|---|
| `get_latest` | – | latest 15-minute interval: every metric below |
| `get_series` | `metrics` (array), `from`, `to` (YYYY-MM-DD), `res` (`15m`/`1h`/`1d`) | `{from, to, res, rows:[{ts, <metric>…}]}` |
| `compare_days` | `metric`, `date_a`, `date_b` | mean, max, min and difference |
| `get_daily_note` | `date`, `lang` (`ro`/`en`) | automatic daily market note |
| `list_notes` | `lang`, `limit` | recent notes with headlines |
| `get_solar_forecast` | – | estimated solar MW for today and tomorrow, 15-minute (paid plans) |
| `get_metric_definitions` | – | units, definitions, sources, value type |

Raw JSON-RPC, if your client has no MCP support:
```bash
curl -s https://solarindustry.ro/mcp -H "Authorization: Bearer $SOLARINDUSTRY_API_KEY" -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_latest","arguments":{}}}'
```

### REST endpoints
| Endpoint | Purpose |
|---|---|
| `GET /api/v1/latest` | latest 15-minute interval |
| `GET /api/v1/series?metrics=solar,price&from=YYYY-MM-DD&to=YYYY-MM-DD&res=15m\|1h\|1d&format=json\|csv` | time series |
| `GET /api/v1/forecast` | solar forecast, today and tomorrow (paid plans) |
| `GET /api/v1/notes?date=YYYY-MM-DD&lang=ro\|en` | daily note; without `date`, the recent list |
| `GET /api/v1/metrics` | metric catalogue |
| `GET /api/v1/coverage` | first and last available interval |

Auth: `Authorization: Bearer <key>` (preferred) or `?key=<key>` where headers are impossible.
Responses: `{"data": …, "meta": {"plan", "timezone", "citation", …}}`. `/series` also returns `query` (`requested_res`, `effective_res`, `res_adjusted`, `from`, `to`, `clipped_to_plan`, `points`) and `units`; always read `effective_res` before computing energy. `ts` is the interval start; `from` and `to` are inclusive dates. Errors: `{"error": "<code>", "message"}` with
400 (bad parameters), 401 (invalid key), 402 (needs a paid plan or CSV), 404, 429 (daily limit).

### Metrics
| Metric | Unit | Definition | Source | Evidence |
|---|---|---|---|---|
| `cons` | MW | National consumption | Transelectrica | reported |
| `prod` | MW | National generation | Transelectrica | reported |
| `net` | MW | Net balance, generation minus consumption (positive = net export) | Transelectrica | derived |
| `solar` | MW | Photovoltaic generation | Transelectrica | reported |
| `wind` | MW | Wind generation | Transelectrica | reported |
| `hydro` | MW | Hydro generation | Transelectrica | reported |
| `nuclear` | MW | Nuclear generation | Transelectrica | reported |
| `gas` | MW | Gas-fired generation | Transelectrica | reported |
| `coal` | MW | Coal-fired generation | Transelectrica | reported |
| `bio` | MW | Biomass generation | Transelectrica | reported |
| `storage` | MW | Storage injection | Transelectrica | reported |
| `hu` | MW | Hungary border flow (positive = import into Romania) | Transelectrica | derived |
| `ua` | MW | Ukraine border flow (positive = import) | Transelectrica | derived |
| `rs` | MW | Serbia border flow (positive = import) | Transelectrica | derived |
| `md` | MW | Moldova border flow (positive = import) | Transelectrica | derived |
| `bg` | MW | Bulgaria border flow (positive = import) | Transelectrica | derived |
| `price` | RON/MWh | PZU day-ahead clearing price, 15-minute | OPCOM | reported |
| `solar_energy` | GWh | Solar energy computed from 15-minute mean solar power × 0.25 h | Transelectrica | derived |
| `solar_capture_price` | RON/MWh | Spot capture-price benchmark of the observed national solar profile: sum(PZU price × solar MW) / sum(solar MW), over 15-minute intervals with both values. A market benchmark, not the realised revenue of any plant, which depends on its own profile, contracts, imbalances and costs. | OPCOM + Transelectrica | derived |
| `solar_capture_rate` | % | Solar capture price divided by the mean PZU price of the priced intervals of the same day or period | OPCOM + Transelectrica | derived |

Sign conventions: `net` positive = Romania exports; border metrics (`hu`, `ua`, `rs`, `md`, `bg`) positive = import into Romania.
Each value is the mean of all readings in its 15-minute interval; missing intervals are null, never filled.

### Plans
| Plan | History | Best resolution | Requests/day | Requests/minute | MCP | Forecast |
|---|---|---|---|---|---|---|
| `free` (Public) | last 7 days | 1h | 200 | 30 | anonymous level only | no |
| `pro` (Pro) | full history | 15m | 1000 | 60 | yes | yes |
| `data` (Data API) | full history | 15m | 5000 | 90 | yes | yes |
| `licence` (Licență) | full history | 15m | 20000 | 120 | yes | yes |

### Citation
When you use these data in an answer, cite: "Solar Industry Romania (solarindustry.ro), from Transelectrica and OPCOM public data".
Mark forecast figures as estimates.

### Help
Problems or questions: the support form in the user's account (https://solarindustry.ro/cont/suport) or https://solarindustry.ro/contact.