碳交易数据查询 MCP 服务

面向全国碳市场的 MCP 服务,提供 CEA/CCER 历史行情查询、市场概况总结、CSV/XLSX 数据导出及 Plotly 交互式仪表盘,适用于碳市场分析、研究以及集成到 Claude 等 AI 助手的场景。

  • by JIN-Z-pop
  • Python
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 JIN-Z-pop/china-ets-mcp

使用说明

China ETS MCP Server

MCP server for China's national carbon market (CEA + CCER) trading data — with interactive dashboard, data query, and export tools.

Live Dashboard Demo — Click to explore China ETS data interactively. No installation required.

Features

  • Market Data Query — Query historical CEA and CCER trading data by date range
  • Market Summary — Get latest prices, price ranges, and trading statistics
  • Data Export — Download trading data as CSV or XLSX
  • Interactive Dashboard — Generate a Plotly-based HTML dashboard with candlestick charts, volume analysis, and multi-language support (EN/CN/JA/KO)

Data Sources

Market Source Coverage
CEA (Carbon Emission Allowance) Shanghai Environment and Energy Exchange (daily rows since 2025-12-25 are taken from carbonmarket.cn, a public mirror of the exchange's published figures) 2021-07 ~ present
CCER (China Certified Emission Reduction) CCER Official (ccer.com.cn) 2024-01 ~ present

Late arrival (resolved): the 2026-10-13 row was still missing from the upstream source on 2026-10-24 and first appeared in the 2026-10-25 daily refresh. It is now in the database. An earlier note here recorded it as a gap in the upstream data; that note is withdrawn.

Past stall (resolved): no rows dated after 2026-10-16 appeared in the daily refreshes up to 2026-10-24. The rows for 2026-10-19 to 2026-10-23 then all appeared in the 2026-10-25 daily refresh. Rows are taken only from the upstream source; nothing is filled in from other sources. Late arrivals like this are why the "latest" date can lag the calendar by several days.

Quick Start

1. Install

Recommended (auto-manages Python version):

git clone https://github.com/JIN-Z-pop/china-ets-mcp.git
cd china-ets-mcp
uv sync

Or with pip (requires Python 3.11+):

pip install -e .

2. Download Data

Download the latest data.db.zip from GitHub Releases, then:

mkdir -p data
# Extract china_ets.db into data/ directory
unzip data.db.zip -d data/

3. View Dashboard (No MCP Required)

uv run china-ets-dashboard

Or with pip install:

china-ets-dashboard

This generates an interactive HTML dashboard and opens it in your browser.

4. Configure MCP (Optional)

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "china-ets": {
      "command": "python",
      "args": ["-m", "china_ets_mcp.server_lite"],
      "env": {
        "DATA_DIR": "/path/to/china-ets-mcp/data"
      }
    }
  }
}

Or use the CLI entry point:

{
  "mcpServers": {
    "china-ets": {
      "command": "china-ets-mcp-lite"
    }
  }
}

5. Use with Claude

Once configured, you can ask Claude:

  • "Show me the latest CEA market summary"
  • "Query CEA trading data from 2025-01-01 to 2025-06-30"
  • "Download CCER data as CSV"
  • "Generate a dashboard for China carbon market data"

MCP Tools

Tool Description
query_trading_data Query CEA or CCER historical data by date range
get_market_summary Get latest prices, stats, and market overview
download_data Export data as CSV or XLSX
generate_dashboard Create interactive HTML dashboard with Plotly charts

Dashboard

The generated dashboard includes:

  • CEA price trend (line chart)
  • CEA candlestick + volume analysis
  • Annual price distribution (box plot)
  • Monthly trading volume heatmap
  • CCER average price trend
  • Multi-language support (English, Chinese, Japanese, Korean)

Project Structure

china-ets-mcp/
├── src/china_ets_mcp/
│   ├── server_lite.py       # MCP server (4 tools)
│   ├── tools/
│   │   ├── query.py         # Data query engine
│   │   ├── exporter.py      # CSV/XLSX export
│   │   └── dashboard.py     # Dashboard generator
│   └── db/
│       ├── models.py        # SQLite schema
│       └── manager.py       # Database operations
├── dashboard/
│   └── template.html        # Plotly + i18n template
├── tests/                   # Test suite
├── examples/                # Sample data
└── data/                    # SQLite database (not in repo)

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

Data Updates

Trading data is updated periodically via GitHub Releases. Check the Releases page for the latest data.

Disclaimer

This tool is provided for research and educational purposes only. The authors make no warranties regarding accuracy, completeness, or fitness for any particular purpose, and accept no liability for any loss or damage arising from its use. Use of this tool is entirely at your own risk.

本工具仅供研究与教育目的使用。作者不对其准确性、完整性或特定用途的适用性作任何保证,亦不对因使用本工具而产生的任何损失或损害承担责任。使用本工具的风险由用户自行承担。

License

MIT - JIN-Z-pop and his merry AI brothers