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.1 and luminus-py==0.3.1.

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(...)

get_distribution_headroom_* currently supports operator="SSEN" and operator="NPG" against the public upstreams wired into the MCP server.

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",
    )
    if intelligence.nged_connection_signal and intelligence.nged_connection_signal.queue_signal:
        project_count = intelligence.nged_connection_signal.queue_signal.summary.matched_projects
    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.1.tar.gz (16.2 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.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: luminus_py-0.3.1.tar.gz
  • Upload date:
  • Size: 16.2 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.1.tar.gz
Algorithm Hash digest
SHA256 78864b73df39a060c0b8e01978d1750ad41367db50b1e02a34b41c5ddcd1ccf8
MD5 223bc4df74ba01f8a890053023818fd5
BLAKE2b-256 47d10923d4b85f440d48466fc611a9209f2eca784679fbb7d398a0b903bae8b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for luminus_py-0.3.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: luminus_py-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 14.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4682d6def12b72065fd6b999d4846230ecde110d3c382999bca483a95919066f
MD5 6158141854a83b763774c166fc61e229
BLAKE2b-256 1df0b4a738b104de27bc6520930ed4f1988ffe275ca2969d4d4ca2b290185d11

See more details on using hashes here.

Provenance

The following attestation bundles were made for luminus_py-0.3.1-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