feederline-mcp · Open source · Apache 2.0

The distribution feeder, as tools an agent can call.

A CIM (IEC 61970-301) operational data store on PostgreSQL, PostGIS and pgRouting, plus a Model Context Protocol server that compiles any feeder from it into an in-process OpenDSS circuit, so AI agents such as Claude can run power-flow, hosting-capacity, voltage, fault and time-series studies on a utility network model.

$npx -y @kartha-energy/feederline-mcp up
Claude Desktop plotting the voltage profile by phase against distance from the feeder head on IEEE 123, with 0.95 and 1.05 pu limit lines
One prompt in Claude DesktopIEEE 123 · voltage profile by phase
34 tools
14 engine · 20 SQL
OpenDSS
In-process circuit per chat
CIM
IEC 61970-301 on Postgres
IEEE 13 / 34 / 123
Loaded on install
Apache 2.0
Open source

In Claude Desktop

Claude calls the tools, then draws the results. Each screenshot is one prompt.

Prompt 01 · Voltage

“Plot the voltage profile by phase against distance from the head, with 0.95 and 1.05 pu limit lines.”

Claude loads the feeder, solves it, pulls the per-bus voltages with distance from the head, and plots phases A, B and C against the limits. All 278 bus-phase points are within limits, and it says where the min and max sit.

load_feederrun_power_flowcheck_voltages
Voltage profile by phase against distance from the feeder head on IEEE 123, with 0.95 and 1.05 pu limit lines

Prompt 02 · Loading

“Load Feeder 123 on IEEE 123, run a power flow, and show line loading above 50% on the map in-line.”

Results carry their geometry, so Claude draws the feeder map in the chat with lines coloured by loading band and regulators and capacitors marked. Five segments at the head are over 100%; the rest is under 50%.

load_feederrun_power_flowline_loadingfeeder_geometry
IEEE 123 feeder map with lines above 50% loading highlighted by loading band

Prompt 03 · Hosting capacity

“Analyze PV hosting capacity at bus 65 on IEEE 123 in 250 kW steps up to 3,000 kW. Plot max voltage and max loading per step, and tell me which limit binds.”

The sweep stops at the first violation; Claude reruns it with only reverse flow as a stop condition to get the full curve. Bus 65 hosts 500 kW, and overvoltage is the limit that binds: at 750 kW the feeder reaches 1.0507 pu.

analyze_capacitycreate_visualization
PV hosting capacity sweep at bus 65 on IEEE 123: max voltage and max line loading per step, with the 500 kW hosting capacity marked

Architecture

Two tool families over one CIM store. Records answer from SQL; physics compiles into OpenDSS.

feederline-mcp architecture: Claude clients, the MCP server with SQL and engine tools, PostgreSQL with PostGIS and pgRouting, and the public data sources Clients Claude Desktop stdio via connect bridge Claude Code HTTP + bearer token feederline-mcp server (Docker) nginx :8000 on 127.0.0.1 · bearer token auth SQL tools (20) Query Postgres directly Stateless, model: null Engine tools (14) Compile feeder into OpenDSS In-memory circuit per chat read load · write studies PostgreSQL 16 + PostGIS + pgRouting CIM (IEC 61970-301) store, plus studies schema Network model CIM equipment Topology pgRouting edges Geometry PostGIS Telemetry SCADA readings IEEE 13/34/123 Test feeders NREL SMART-DS 17k-node feeders HIFLD Substations, lines Demo telemetry 30 days, seed 42

Claude Desktop reaches the server over a stdio bridge, Claude Code over HTTP with a bearer token. SQL tools answer straight from Postgres with no session. Engine tools compile the feeder into an in-memory OpenDSS circuit that lives for the chat, and write their studies back to the studies schema. Public datasets load the store from the bottom.

Public data only

The local stack is for public datasets: IEEE test feeders, NREL SMART-DS, HIFLD-schema mirrors. Real utility network models and loading are CEII (Critical Energy/Electric Infrastructure Information) and must not be loaded into it.

Tools

34 MCP tools in two families, every result in the same envelope.

Engine tools

14

Simulate the physics. Call load_feeder first; the circuit lives in memory for the chat.

Build and solve

load_feederrun_power_flowrun_timeseries

Voltage, loading, losses

check_voltagesline_loadinglosses_by_segmentphase_balanceregulator_status

DER and protection

analyze_capacityoptimize_derfault_study

What-if and output

set_controlcompare_casescreate_visualization

SQL tools

20

Answer from records. Straight from Postgres, no session needed.

Lookup

search_equipmentdescribe_equipment

Topology (pgRouting)

trace_downstreamtrace_upstreamfind_pathisolatetie_optionsconnectivity_report

Spatial (PostGIS)

equipment_nearnearest_substationaffected_by_areafeeder_geometry

Telemetry

latest_readingsmeasurement_historyload_profilepeak_loadlimit_exceedancestelemetry_quality

Governance

model_changesvalidate_feeder

One envelope

Every result returns success, data, model, warnings, errors and meta. Each tool's MCP description states its inputs, outputs and units.

Results name their shape

data.viz says map, tree, path, timeseries, table or profile, so a client can draw them directly. Large results are capped and point at a grid:// resource holding the rest.

Nothing writes to the model

No tool writes to the network model, switch states or telemetry. set_control changes only the in-memory circuit of your session.

Quick start

Two commands on the host. Everything else runs in containers.

You need Docker (Docker Desktop or Docker Engine with Compose v2) and Node.js 18+. Nothing else is installed on the host: Postgres, PostGIS, pgRouting, OpenDSS and Python all run in containers. The server listens on 127.0.0.1 only, with a random bearer token generated on first run and kept in ~/.feederline-mcp/config.json.

01 · Start the stack

Pulls images, starts Postgres and the server, migrates, loads IEEE 13/34/123 and seeds demo telemetry. Then prints the connection settings.

npx -y @kartha-energy/feederline-mcp up
npx -y @kartha-energy/feederline-mcp config

02 · Connect Claude Desktop

Add this to claude_desktop_config.json, or run config --write-desktop, which merges it in after writing a backup. Restart Claude Desktop; the 34 tools appear in the tools menu.

{
  "mcpServers": {
    "feederline-mcp": {
      "command": "npx",
      "args": ["-y", "@kartha-energy/feederline-mcp", "connect"]
    }
  }
}

03 · Or connect Claude Code

HTTP transport with the bearer token that config prints.

claude mcp add --transport http feederline-mcp \
  http://127.0.0.1:8000/mcp \
  --header "Authorization: Bearer <token>"

What you can ask

Plain questions about a feeder, answered from the model and the records.

  • 01List the feeders available, with region, substation and nominal voltage.
  • 02Load the IEEE 123 feeder and run a power flow. What are the losses and the lowest voltage?
  • 03Which buses on IEEE 123 are outside 0.95–1.05 pu? Show the worst ten.
  • 04What is the PV hosting capacity at bus 76 on IEEE 123, and which constraint binds first?
  • 05What was the peak load at the IEEE 123 feeder head over the last 7 days, and when did it occur?

The Claude playbook

A 13-lesson learning path for Claude Desktop: concepts, prompts to type, what to look for in each answer, a prompt cheat sheet and a self-check quiz. The prompts on the left are a few from it.

Read docs/playbook.md

CLI and data

Public datasets in, deterministic IDs out.

CLI

Command
Does
up [--ha] [--no-demo] [--smartds]
Start the stack, migrate, load the IEEE feeders and 30 days of demo telemetry. Safe to rerun.
down / reset
Stop (keep data) / remove containers and data after confirmation.
status
Containers, URL, feeders with root IDs, telemetry date range.
logs [service]
Follow logs.
load ieee|smartds|hifld [...]
Load a public dataset.
config [--write-desktop] [--claude-code]
Connection settings.
connect
stdio bridge for Claude Desktop.
inspect
MCP Inspector against the local server.
doctor
Check Node, Docker, Compose, ports, disk and registry access.

Datasets

Command
Loads
load ieee
IEEE 13/34/123 test feeders, vendored under tests/fixtures/feeders. Run by up.
load smartds --region P1R --substation p1rhs0_1247 [--date YYYY-MM-DD]
An NREL SMART-DS substation downloaded from OEDI at run time (~7 MB, 17k nodes); --date also ingests that day's load profiles.
load hifld --state CA
HIFLD-schema substations and transmission lines (transmission tier, 500 m snapping).
make load-pecan FILE=... REGION=IEEE123
From source: your own Pecan Street Dataport 15-minute export, scaled onto a region's consumers. No Pecan Street data is distributed.

IEEE root IDs

The same on every install: deterministic uuid5 mRIDs. Demo telemetry is simulated (deterministic, seed 42) for the 30 days before install.

IEEE 13
c990acfa-4c84-5788-be92-53b20464fbd8
IEEE 34
378451c2-afdb-524f-a587-9808c081df60
IEEE 123
1dfeb41b-bf91-52f3-b6af-7b400b93c5b8

From source

Build it, test it, and bring your own backend through an adapter.

Requires Docker, uv and Python 3.12. PG_PORT= and MCP_PORT= move the host ports. The from-source stack uses the static token dev-token; the npm path never does. The npm CLI lives in npm/ (make npm-build), with its compose files in npm/compose/.

make up          # build images; postgres (127.0.0.1:5433), migrations, two MCP replicas behind nginx on :8000
make load-ieee   # IEEE 13/34/123 -> CIM, SCADA registry, latest values, network_edges
make demo        # 30 days of deterministic demo telemetry
make test        # unit, contract, golden (0.1%), loaders, writer, auth/RLS, tools, rehydration, spatial, SQL tools
make inspect     # MCP Inspector -> http://localhost:8000/mcp (Authorization: Bearer dev-token)
make ha-check    # stop the replica holding a session; the other must serve it
make lint        # ruff + import-linter (tools/ and compiler/ depend only on adapters/base.py)

Adapters

The server reads a DataSource, writes a StudySink and trusts an Auth (protocols in feederline_mcp/adapters/base.py). Implementations are discovered through the Python entry-point group feederline_mcp.adapters and selected with FEEDERLINE_MCP_ADAPTER (default local: one Postgres, the studies schema, a static bearer token). Another backend ships as a separate package that registers its own entry point:

[project.entry-points."feederline_mcp.adapters"]
mybackend = "my_package.adapter:build"   # build(settings) -> (DataSource, StudySink, Auth)

Any Postgres 16+ with PostGIS 3.4+ and pgRouting 3.4+ runs the schema. Sessions rehydrate on any replica from a shared snapshot directory (SNAPSHOT_DIR).

Docs, contributing, license

Read the playbook, explore every tool, send a signed-off patch.

docs/playbook.md

Learning the grid with Claude Desktop: concepts, 13 lessons, cheat sheet, quiz.

Start here

tests/inspector.md

Exploring every tool with the MCP Inspector, field by field.

make inspect

Contributing

DCO sign-off (git commit -s), running the tests, code rules. Report vulnerabilities privately via SECURITY.md.

Code of conduct included

Apache License 2.0

Third-party components and data are listed in NOTICE.

Open source

The open-source grid layer of applied AI for the utility.

feederline-mcp is created by Kartha Energy, the energy and utilities practice of Kartha AI. We build agentic workflows on frontier models, delivered by forward-deployed engineers on a context and trust layer brought to every engagement. For production deployments, connectors to other data platforms and support, talk to the practice.