Labsco
mjrgr logo

Enedis Linky MCP Server

โ˜… 1

from mjrgr

A production-ready Model Context Protocol (MCP) server written in Go that wraps the Conso API, giving AI assistants like Claude direct access to your Enedis Linky smart meter data.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

Enedis Linky MCP Server โšก

A production-ready Model Context Protocol (MCP) server written in Go that wraps the Conso API, giving AI assistants like Claude direct access to your Enedis Linky smart meter data.


Table of Contents


Features

  • 5 MCP tools covering Linky consumption, load curve, max power, and solar production data
  • Bearer token authentication via the free Conso API proxy
  • Automatic retry with exponential backoff on transient errors
  • Rate-limit awareness โ€” respects the 5 req/s and 10k req/h limits
  • Dual MCP transports โ€” stdio for Claude Desktop, sse for HTTP clients
  • Structured logging โ€” JSON logs via log/slog with configurable levels
  • CI/CD โ€” GitHub Actions for testing, linting, and cross-platform releases

Using with Claude Desktop

Edit your Claude Desktop config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "linky": {
      "command": "/absolute/path/to/bin/enedis-linky-mcp-server",
      "env": {
        "CONSO_API_TOKEN": "your_token_here",
        "LINKY_PRM": "12345678901234"
      }
    }
  }
}

Restart Claude Desktop โ€” the Linky tools will appear in the tool list.

You can then ask things like:

  • "Show me my electricity consumption for the past week"
  • "What was my peak power usage this month?"
  • "Compare my daily consumption over the last 30 days"
  • "How much solar energy did I produce today?"

Using with Claude CLI

The server supports two transports: stdio (default) and SSE (HTTP). SSE is the recommended approach when running via Docker or Podman as it avoids the stdio-in-container overhead.

stdio transport

Docker
claude mcp add linky -s local -- docker run -i --rm \
  -e CONSO_API_TOKEN=your_token_here \
  -e LINKY_PRM=12345678901234 \
  ghcr.io/mjrgr/enedis-linky-mcp-server:latest
Local binary
claude mcp add linky -s local -- /absolute/path/to/bin/enedis-linky-mcp-server

Set CONSO_API_TOKEN and optionally LINKY_PRM in your shell environment before running.

SSE transport

SSE runs the server as a persistent HTTP process. Start it once, then point Claude CLI at its URL.

1. Prepare your env file

cp .env.example .env.local
# Edit .env.local โ€” set CONSO_API_TOKEN, LINKY_PRM, and MCP_TRANSPORT=sse
CONSO_API_TOKEN=your_token_here
LINKY_PRM=12345678901234
MCP_TRANSPORT=sse
PORT=8080

2. Start the server

Docker
docker run --rm \
  --env-file .env.local \
  -p 8080:8080 \
  ghcr.io/mjrgr/enedis-linky-mcp-server:latest
Podman
podman build -t enedis-linky-mcp -f Containerfile .
podman run --rm \
  --env-file .env.local \
  -p 8080:8080 \
  enedis-linky-mcp

3. Register with Claude CLI

claude mcp add linky --transport sse http://localhost:8080/sse

Example usage

claude "Show me my electricity consumption for today"
claude "What's my average daily power usage this week?"

screen_mcp1.png screen_mcp2.png


Docker

docker run --rm \
  --env-file .env.local \
  -p 8080:8080 \
  ghcr.io/mjrgr/enedis-linky-mcp-server:latest

Build locally with Podman

podman build -t enedis-linky-mcp -f Containerfile .
podman run --rm \
  --env-file .env.local \
  -p 8080:8080 \
  enedis-linky-mcp

Dashboard

Enable the built-in web dashboard to test your API connection and visualize meter data directly in the browser โ€” no Claude client required.

export CONSO_API_TOKEN=your_token_here
export LINKY_DASHBOARD=true
export LINKY_PRM=12345678901234   # optional โ€” pre-fills the PRM field in the dashboard
./bin/enedis-linky-mcp-server
# Dashboard available at http://localhost:8081

The dashboard provides:

  • Connection status โ€” MCP server health + live Conso API reachability check
  • Summary stats โ€” total kWh, daily average, peak day, reading count
  • Daily Consumption chart (bar)
  • Load Curve chart (30-minute intervals, line)
  • Max Power chart (bar)

screen_dashboard.png screen_dashboard_2.png

With Docker

docker run --rm \
  -e CONSO_API_TOKEN=your_token_here \
  -e LINKY_PRM=12345678901234 \
  -e LINKY_DASHBOARD=true \
  -e MCP_TRANSPORT=sse \
  -p 8080:8080 \
  -p 8081:8081 \
  ghcr.io/mjrgr/enedis-linky-mcp-server:latest

The dashboard runs on a separate port from the MCP SSE transport so both can coexist.


Security

๐Ÿ”’ Security Best Practices

  • Never commit real API tokens to version control. Use environment variables or .env.local for local development.
  • Rotate your token if you suspect it is compromised โ€” regenerate it at conso.boris.sh.
  • Report vulnerabilities by opening a security issue or emailing the maintainers.

MCP Tools Reference

ToolDescription
get_daily_consumptionDaily electricity consumption (Wh) for a date range
get_load_curve30-minute average power readings (W)
get_max_powerMaximum power reached each day (VA)
get_daily_productionDaily solar production (Wh) for solar installations
get_production_load_curve30-minute average production power readings (W)

All tools accept a PRM (meter identifier) and a date range as parameters. The prm parameter is optional when LINKY_PRM is set as an environment variable.


Project Structure

enedis-linky-mcp-server/
โ”œโ”€โ”€ cmd/
โ”‚   โ””โ”€โ”€ server/
โ”‚       โ””โ”€โ”€ main.go            # Entrypoint โ€” wires config, client, service, MCP server
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ””โ”€โ”€ config.go          # ENV-based configuration with validation
โ”‚   โ”œโ”€โ”€ client/
โ”‚   โ”‚   โ””โ”€โ”€ client.go          # Typed HTTP client โ€” retry, backoff, User-Agent
โ”‚   โ”œโ”€โ”€ service/
โ”‚   โ”‚   โ””โ”€โ”€ service.go         # Business logic โ€” validation, aggregation
โ”‚   โ””โ”€โ”€ mcp/
โ”‚       โ”œโ”€โ”€ server.go          # MCP server lifecycle (stdio / SSE transport)
โ”‚       โ””โ”€โ”€ tools.go           # Tool definitions & handlers
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ”œโ”€โ”€ ci.yml             # lint โ†’ test โ†’ build
โ”‚       โ””โ”€โ”€ release.yml        # GoReleaser + Docker (triggered on tags)
โ”œโ”€โ”€ Containerfile              # Multi-stage, distroless final image
โ”œโ”€โ”€ Makefile                   # Developer shortcuts
โ”œโ”€โ”€ .env.example               # Configuration template
โ””โ”€โ”€ go.mod

Development

# Install dependencies
go mod download

# Run tests
make test

# Lint
make lint

# Build for all platforms
make build

# Build container image
podman build -f Containerfile .