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.
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 kWhstate(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 GJgas_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 GJgas_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 tokenCLOUDFLARE_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 clientsGET /sse- Server-Sent Events endpoint (with Accept: text/event-stream)GET /- Information page with API documentation
JSON-RPC Methods
initialize- Initialize MCP connectiontools/list- Get available toolstools/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
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。