Skip to main content

Notebook-friendly Python client for luminus-mcp

Project description

luminus-py

A notebook-friendly Python client for luminus-mcp.

This package starts the existing Node MCP server under the hood, calls tools over stdio, and returns Python-native result objects with optional pandas helpers.

Any MCP tool exposed by luminus-mcp is callable directly as a Python method, so the SDK does not need a hand-written wrapper for every tool.

The SDK also includes geospatial helpers for notebook workflows: to_geojson() for lightweight mapping and to_geodataframe() for GeoPandas users.

Roadmap: see ../docs/python-sdk-roadmap.md.

Install

pip install luminus-py[notebook]

For GIS notebook work:

pip install luminus-py[all]

You also need luminus-mcp itself available on your machine, because the Python SDK starts the existing Node MCP server under the hood.

npm install -g luminus-mcp

Current published versions: luminus-mcp@0.3.0 and luminus-py==0.3.0.

API keys

Keyed tools use the same auth model as the Node server. Resolution order is:

  1. environment variables like ENTSOE_API_KEY
  2. ~/.luminus/keys.json

Example ~/.luminus/keys.json:

{
  "ENTSOE_API_KEY": "...",
  "GIE_API_KEY": "...",
  "FINGRID_API_KEY": "..."
}

Per-notebook overrides are also supported:

lum = Luminus(profile="trader", env={"ENTSOE_API_KEY": "..."})

Quick start

from luminus import Luminus

with Luminus(profile="trader") as lum:
    prices = lum.get_day_ahead_prices(zone="DE")
    df = prices.to_pandas()

    # Any MCP tool can be called directly
    flows = lum.get_cross_border_flows(from_zone="DE", to_zone="NL")
    site = lum.compare_sites(sites=[
        {"name": "A", "lat": 52.1, "lon": 0.1},
        {"name": "B", "lat": 52.2, "lon": 0.2},
    ], country="GB")

    # GIS-friendly exports
    geojson = site.to_geojson(data_key="rankings")

    # Batch several calls into one DataFrame
    multi_zone = lum.call_many_to_pandas(
        "get_day_ahead_prices",
        [{"zone": "DE"}, {"zone": "FR"}, {"zone": "NL"}],
        parallel=True,
    )

    # One-shot export helpers
    prices_df = lum.call_tool_to_pandas("get_day_ahead_prices", {"zone": "DE"})
    rankings_geojson = lum.call_tool_to_geojson("compare_sites", {
        "country": "GB",
        "sites": [
            {"label": "A", "lat": 52.1, "lon": 0.1},
            {"label": "B", "lat": 52.2, "lon": 0.2},
        ],
    }, data_key="rankings")

Notebook demos

Polished notebook demos live in examples/:

Notebook-first helpers

The Python SDK now ships a few opinionated helpers for high-usage analyst flows:

  • lum.get_outages_frame(...)
  • lum.get_cross_border_flows_many([...])
  • lum.get_grid_proximity_substations(...)
  • lum.get_grid_proximity_lines(...)
  • lum.get_grid_proximity_snapshot(...)
  • lum.get_grid_connection_queue_projects(...)
  • lum.get_grid_connection_queue_sites(...)
  • lum.get_grid_connection_queue_snapshot(...)
  • lum.get_distribution_headroom_matches(...)
  • lum.get_distribution_headroom_snapshot(...)
  • lum.get_grid_connection_intelligence_snapshot(...)
  • lum.estimate_site_revenue_frame(...)
  • lum.estimate_site_revenue_estimate(...)

Example:

from luminus import (
    DistributionHeadroomSnapshot,
    GridConnectionIntelligenceSnapshot,
    GridProximitySnapshot,
    Luminus,
    SiteRevenueEstimate,
)

with Luminus(profile="gis") as lum:
    outages = lum.get_outages_frame(zone="DE", type="generation")
    flows = lum.get_cross_border_flows_many([("DE", "NL"), ("FR", "DE")])
    substations = lum.get_grid_proximity_substations(lat=52.0, lon=0.1)
    queue = lum.get_grid_connection_queue_projects(connection_site_query="Berkswell")
    headroom = lum.get_distribution_headroom_matches(lat=50.84, lon=-1.08, operator="SSEN")
    revenue = lum.estimate_site_revenue_frame(
        lat=52.0,
        lon=0.1,
        zone="GB",
        technology="bess",
        capacity_mw=20,
    )

    proximity: GridProximitySnapshot = lum.get_grid_proximity_snapshot(lat=52.0, lon=0.1)
    headroom_snapshot: DistributionHeadroomSnapshot = lum.get_distribution_headroom_snapshot(
        lat=50.84,
        lon=-1.08,
        operator="SSEN",
    )
    intelligence: GridConnectionIntelligenceSnapshot = lum.get_grid_connection_intelligence_snapshot(
        lat=50.84,
        lon=-1.08,
        country="GB",
    )
    estimate: SiteRevenueEstimate = lum.estimate_site_revenue_estimate(
        lat=52.0,
        lon=0.1,
        zone="GB",
        technology="bess",
    )

Errors and typed models

  • Startup failures now raise LuminusStartupError.
  • Tool-side configuration failures raise LuminusConfigurationError.
  • Tool-side upstream/data-source failures raise LuminusUpstreamError.
  • Dynamic whole-surface access still works through LuminusResult, and common GIS/revenue flows also expose opt-in typed models.

Notes

  • Use lum.list_tools() to see the live tool surface for the active profile.

  • Use lum.describe_tool("tool_name") to inspect the MCP description/schema metadata.

  • Use lum.call_many() / lum.call_many_to_pandas() for generic multi-zone or multi-site notebook pulls.

  • Use parallel=True on batch helpers when you want the SDK to fan out across multiple MCP subprocesses.

  • Use lum.get_day_ahead_prices_many() and lum.get_generation_mix_many() for common analyst workflows.

  • Use lum.compare_sites_rankings() together with lum.compare_sites_rankings_geojson() and lum.compare_sites_rankings_geodataframe() for ranked siting output.

  • Use the typed snapshots only when they help notebook readability; the raw dynamic MCP surface is still available.

  • Notebook demos live in examples/.

  • Use to_geojson() for lightweight mapping and to_geodataframe() when GeoPandas is installed.

  • Requires luminus-mcp to be available on PATH, unless you pass an explicit command.

  • By default the client starts luminus-mcp --profile <profile>.

  • For local repo development you can point it at the built server directly:

lum = Luminus(command=["node", r"C:\Users\skf_s\luminus\dist\index.js"], profile="gis")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

luminus_py-0.3.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

luminus_py-0.3.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file luminus_py-0.3.0.tar.gz.

File metadata

  • Download URL: luminus_py-0.3.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for luminus_py-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b5cfa9df0a7cebd42a4cb43dc83696bae7252be6cf553ece41c55f7b30a097d1
MD5 f9ea623d5325503dc3182372ed6af4e7
BLAKE2b-256 06755239e954eea91d30908c6ae4ab41c6d61f54bfd1f48415b2b0176fd9db5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for luminus_py-0.3.0.tar.gz:

Publisher: release.yml on kitfunso/luminus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file luminus_py-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: luminus_py-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for luminus_py-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b93506b265d533e65a795eea2ff39cb117e87949a088dfd5ec914dd7902b3ed1
MD5 0f9f7dd894df9de981b7826771f6d658
BLAKE2b-256 3ea5f4af2d372588b2fb13986387785910505014f27569e4c0e34c096fa7b993

See more details on using hashes here.

Provenance

The following attestation bundles were made for luminus_py-0.3.0-py3-none-any.whl:

Publisher: release.yml on kitfunso/luminus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page