mcp-carbon-calculator

mcp-carbon-calculator

Enables carbon emission calculations for Australian electricity and gas consumption using official National Greenhouse Accounts 2024 data, supporting all states and territories.

Category
Visit Server

README

Australian Carbon Calculator MCP Server

A high-performance Model Context Protocol (MCP) server for calculating carbon emissions using official Australian National Greenhouse Accounts (NGA) 2024 data. Built with TypeScript and deployed on Cloudflare Workers for global availability and sub-100ms response times.

Overview

This MCP server provides accurate carbon footprint calculations for electricity and gas consumption across Australian states and territories. All emission factors are sourced from the Australian Government's Department of Climate Change, Energy, the Environment and Water (DCCEEW), ensuring compliance with national reporting standards.

Key Features

  • Official Data: Uses Australian National Greenhouse Accounts (NGA) 2024 emission factors
  • Comprehensive Coverage: Supports all Australian states and territories
  • Dual Area Types: Separate calculations for metropolitan and non-metropolitan gas consumption
  • Production Ready: Deployed on Cloudflare Workers with global edge network
  • Type Safe: Written in TypeScript with comprehensive type definitions
  • MCP Compliant: Full compatibility with Model Context Protocol specification

Quick Start

Using the Production Server

The fastest way to get started is using our production deployment:

# Add to your Claude Desktop configuration
{
  "mcpServers": {
    "carbon-calculator": {
      "command": "npx",
      "args": ["mcp-remote", "https://mcp-carbon-calculator.mcp-carbon-calculator.workers.dev/sse"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

Local Development

# Clone the repository
git clone https://github.com/Programmer-RD-AI/mcp-carbon-calculator.git
cd mcp-carbon-calculator

# Install dependencies
npm install

# Start development server
npm run dev

# The server will be available at http://localhost:8787

Available Tools

electricity_emission

Calculate carbon emissions from electricity consumption across Australian states and territories.

Parameters:

  • kilo_watt_hours (number): Electricity consumption in kWh
  • state (string): Australian state/territory

Supported States:

  • New South Wales & ACT
  • Victoria
  • Queensland
  • South Australia
  • Western Australia - SWIS (South West Interconnected System)
  • Western Australia - NWIS (North West Interconnected System)
  • Tasmania
  • Northern Territory - DKIS (Darwin-Katherine Interconnected System)

Example Response:

Australian Electricity Emission Calculation:

State: Victoria
Electricity consumed: 350 kWh
Scope 2 factor: 0.77 kg CO₂e/kWh
Scope 3 factor: 0.09 kg CO₂e/kWh
Total factor: 0.86 kg CO₂e/kWh

Total emissions: 301.00 kg CO₂e
Total emissions: 0.301000 tonnes CO₂e

Context: This calculation uses Australian National Greenhouse Accounts (NGA) 2024 emission factors.

gas_emission_metro

Calculate carbon emissions from gas consumption in metropolitan areas.

Parameters:

  • giga_joules (number): Gas consumption in GJ
  • gas_type (string): Australian state/territory

gas_emission_non_metro

Calculate carbon emissions from gas consumption in non-metropolitan areas.

Parameters:

  • giga_joules (number): Gas consumption in GJ
  • gas_type (string): Australian state/territory

Architecture

The codebase follows a modular architecture pattern optimized for serverless deployment:

src/
├── index.ts              # Main Cloudflare Worker entry point
├── types.ts              # Type definitions and interfaces
├── calculators/          # Emission calculation logic
│   ├── electricity.ts    # Electricity emission calculations
│   └── gas.ts           # Gas emission calculations
├── handlers/            # Request handlers
│   ├── mcp.ts          # MCP JSON-RPC handler
│   └── sse.ts          # Server-Sent Events handler
├── data/               # Static data and constants
│   └── emissions.ts    # NGA 2024 emission factors
├── config/             # Configuration files
│   └── tools.ts        # MCP tool definitions
└── utils/              # Utility functions
    └── cors.ts         # CORS handling utilities

Development

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Cloudflare account (for deployment)

Scripts

npm run dev        # Start development server
npm run build      # Build TypeScript
npm run deploy     # Deploy to Cloudflare Workers
npm run typecheck  # Run TypeScript type checking
npm run lint       # Run ESLint
npm run test       # Run tests

Environment Variables

For deployment, you'll need to configure:

  • CLOUDFLARE_API_TOKEN: Your Cloudflare API token
  • CLOUDFLARE_ACCOUNT_ID: Your Cloudflare account ID

Deployment

Automatic Deployment

This repository includes GitHub Actions workflows for automatic deployment:

  • Push to main: Automatically deploys to production
  • Pull Requests: Runs tests and type checking

Manual Deployment

# Deploy to production
npm run deploy

# Deploy with specific environment
wrangler deploy --env production

API Reference

MCP Protocol Endpoints

  • POST /sse - JSON-RPC endpoint for MCP clients
  • GET /sse - Server-Sent Events endpoint (with Accept: text/event-stream)
  • GET / - Information page with API documentation

JSON-RPC Methods

  • initialize - Initialize MCP connection
  • tools/list - Get available tools
  • tools/call - Execute a calculation tool

Data Sources

All emission factors are sourced from:

Australian National Greenhouse Accounts (NGA) Factors 2024

  • Published by: Department of Climate Change, Energy, the Environment and Water
  • Updated: December 2024
  • Scope: National greenhouse gas inventory reporting

The emission factors include:

  • Electricity: Scope 2 and Scope 3 factors by state/territory
  • Gas: Scope 1 and Scope 3 factors for metro/non-metro areas

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Acknowledgments

  • Australian Government Department of Climate Change, Energy, the Environment and Water for providing the NGA 2024 emission factors
  • Cloudflare for the Workers platform enabling global deployment
  • The Model Context Protocol team for the MCP specification

Production URL: https://mcp-carbon-calculator.mcp-carbon-calculator.workers.dev
MCP Endpoint: https://mcp-carbon-calculator.mcp-carbon-calculator.workers.dev/sse

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured