Octopus Energy MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Octopus Energy MCP Server show my electricity usage for last week grouped by day"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Octopus Energy MCP Server
An MCP (Model Context Protocol) server for interacting with the Octopus Energy API to retrieve electricity and gas consumption data.
Features
Get electricity consumption data (kWh with 0.045 kWh precision)
Get gas consumption data (kWh for SMETS1 meters, cubic meters for SMETS2 meters)
Support for date range filtering
Pagination support
Group by day, week, month, or quarter
Order by period (ascending or descending)
Related MCP server: mcp-octopus-energy
Prerequisites
Node.js (v18 or higher recommended)
An Octopus Energy API key
Your meter details (MPAN/MPRN and serial number)
Getting Your API Key and Meter Details
API Key: Log into your Octopus Energy account at https://octopus.energy/dashboard/new/accounts/personal-details/api-access
Meter Details: You can find your MPAN (electricity) or MPRN (gas) and meter serial numbers:
On your energy bill
In your Octopus Energy account dashboard
Via the Octopus Energy account API endpoint
Installation
Clone or download this repository
Install dependencies:
npm installCreate a
.envfile from the example:
cp .env.example .envEdit
.envand add your Octopus Energy credentials:
OCTOPUS_API_KEY=your_api_key_here
ELECTRICITY_MPAN=1234567890123
ELECTRICITY_SERIAL_NUMBER=12A3456789
GAS_MPRN=9876543210
GAS_SERIAL_NUMBER=G4A1234567Build the project:
npm run buildConfiguration
The server loads environment variables from a .env file in the project root. This file should contain:
OCTOPUS_API_KEY (required): Your API key for authentication
ELECTRICITY_MPAN (optional): Your 13-digit electricity meter point number
ELECTRICITY_SERIAL_NUMBER (optional): Your electricity meter serial number
GAS_MPRN (optional): Your 10-digit gas meter point reference number
GAS_SERIAL_NUMBER (optional): Your gas meter serial number
If you configure the meter details in .env, you won't need to provide them when calling the tools. You can still override them by passing parameters to the tools if needed.
Note: The .env file is ignored by git to keep your credentials secure.
Usage with Claude Desktop
Add this to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"octopus-energy": {
"command": "node",
"args": ["/absolute/path/to/octopus-mcp-server/dist/index.js"]
}
}
}Replace /absolute/path/to/octopus-mcp-server with the actual path to this project directory.
Note: The server will automatically load your API key from the .env file in the project directory. Alternatively, you can override it by adding an env section to the config:
{
"mcpServers": {
"octopus-energy": {
"command": "node",
"args": ["/absolute/path/to/octopus-mcp-server/dist/index.js"],
"env": {
"OCTOPUS_API_KEY": "your_api_key_here"
}
}
}
}Available Tools
get_electricity_consumption
Retrieves electricity consumption data.
Parameters:
mpan(string, optional): The MPAN (Meter Point Administration Number). UsesELECTRICITY_MPANfrom .env if not provided.serial_number(string, optional): The meter serial number. UsesELECTRICITY_SERIAL_NUMBERfrom .env if not provided.period_from(string, optional): Start date/time in ISO 8601 format (e.g., "2024-01-01T00:00:00Z")period_to(string, optional): End date/time in ISO 8601 format (e.g., "2024-01-31T23:59:59Z")page_size(number, optional): Number of results per page (default: 100, max: 25000)order_by(string, optional): Set to "period" to return earliest records first (default: latest first)group_by(string, optional): Group results by "day", "week", "month", or "quarter"
Example with meter details in .env:
{
"period_from": "2024-01-01T00:00:00Z",
"period_to": "2024-01-31T23:59:59Z",
"group_by": "day"
}Example with explicit parameters:
{
"mpan": "1234567890123",
"serial_number": "12A3456789",
"period_from": "2024-01-01T00:00:00Z",
"period_to": "2024-01-31T23:59:59Z",
"group_by": "day"
}get_gas_consumption
Retrieves gas consumption data.
Parameters:
mprn(string, optional): The MPRN (Meter Point Reference Number). UsesGAS_MPRNfrom .env if not provided.serial_number(string, optional): The meter serial number. UsesGAS_SERIAL_NUMBERfrom .env if not provided.period_from(string, optional): Start date/time in ISO 8601 format (e.g., "2024-01-01T00:00:00Z")period_to(string, optional): End date/time in ISO 8601 format (e.g., "2024-01-31T23:59:59Z")page_size(number, optional): Number of results per page (default: 100, max: 25000)order_by(string, optional): Set to "period" to return earliest records first (default: latest first)group_by(string, optional): Group results by "day", "week", "month", or "quarter"
Example with meter details in .env:
{
"period_from": "2024-11-01T00:00:00Z",
"period_to": "2024-11-30T23:59:59Z",
"group_by": "week"
}Example with explicit parameters:
{
"mprn": "9876543210",
"serial_number": "G4A1234567",
"period_from": "2024-11-01T00:00:00Z",
"period_to": "2024-11-30T23:59:59Z",
"group_by": "week"
}Response Format
Both tools return consumption data in the following format:
{
"count": 100,
"next": "https://api.octopus.energy/v1/...",
"previous": null,
"results": [
{
"consumption": 1.234,
"interval_start": "2024-01-01T00:00:00Z",
"interval_end": "2024-01-01T00:30:00Z"
}
]
}Development
Build the project:
npm run buildRun in development mode:
npm run devWatch for changes:
npm run watchAPI Documentation
For more information about the Octopus Energy API:
Troubleshooting
"OCTOPUS_API_KEY environment variable is not set"
Make sure you've set the API key in your environment or in the Claude Desktop configuration.
Authentication errors (401)
Verify your API key is correct and active.
Invalid MPAN/MPRN or serial number
Double-check your meter details from your Octopus Energy account or bill.
Date format errors
Ensure dates are in ISO 8601 format with UTC indicator (Z suffix), e.g., "2024-01-01T00:00:00Z"
License
ISC
Available Tools
2 toolsget_electricity_consumptionA
Get electricity consumption data from Octopus Energy. Returns consumption in kWh with 0.045 kWh precision. MPAN and serial number can be provided as parameters or will use values from ELECTRICITY_MPAN and ELECTRICITY_SERIAL_NUMBER environment variables.
Inputs: mpan, serial_number, period_from, period_to, +3 more.
get_gas_consumptionA
Get gas consumption data from Octopus Energy. Returns consumption in kWh for SMETS1 meters or cubic meters for SMETS2 meters. MPRN and serial number can be provided as parameters or will use values from GAS_MPRN and GAS_SERIAL_NUMBER environment variables.
Inputs: mprn, serial_number, period_from, period_to, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools are clearly distinct: one retrieves electricity consumption data and the other retrieves gas consumption data. Their purposes do not overlap, and the descriptions specify different parameters and units, making misselection unlikely.
Both tools follow a consistent verb_noun pattern with 'get_' prefix and descriptive nouns ('electricity_consumption', 'gas_consumption'). The naming is uniform and predictable across the set.
With only 2 tools, the server feels thin for an energy data domain. While it covers electricity and gas consumption, typical energy APIs might include additional operations like tariff lookup, usage analysis, or billing information, suggesting a limited scope.
The toolset is severely incomplete for an energy data server. It only provides consumption retrieval, lacking essential operations such as tariff queries, historical data analysis, account management, or update capabilities, which could hinder agent workflows.
Maintenance
Related MCP Connectors
Read your organization usage records. No payments or transfers. Customer API key required.
Query and manage Amberflo metering & billing: customers, meters, usage, plans, invoices, prepaid.
Record idempotent usage events and read monthly per-customer rollups (Usage Lab metering API).
Read customers, contracts, balances, invoices and usage; send usage events in Metronome.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceAccess Great Britain electricity grid open data from the NESO API, enabling queries about generation, demand, and market data.55 npmMIT- AlicenseNot gradedqualityCmaintenanceEnables AI agents to query UK energy tariffs and products via the Octopus Energy public API.65 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables access to Great Britain electricity grid and market data via the Elexon BMRS Insights API.56 npmMIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables users to query current and historical UK electricity carbon intensity, generation mix, and regional intensity data to schedule energy-intensive tasks during low-carbon periods.61 npmMIT