Skip to main content

MCP server for the KAPSARC Data Portal — search, query, export, and visualize energy/economic datasets

Project description

KAPSARC Data Portal MCP Server

An MCP server that connects LLMs to the KAPSARC Data Portal — search, query, export, and visualize energy and economic datasets via the Opendatasoft Explore API v2.1.

Tools

Data Tools

Tool Description
search_datasets Free-text search of KAPSARC datasets
get_dataset Full metadata and field definitions for a dataset
get_records Query records with ODSQL filters
get_record Retrieve a single record by ID
get_dataset_facets Categorical field values and counts
get_catalog_facets Portal-wide themes, keywords, publishers
export_dataset Export without 100-record limit (JSON/CSV)
get_dataset_attachments List documentation/file attachments
export_catalog Bulk export all dataset metadata
list_export_formats Check available export formats

Visualization Tools

Tool Description
visualize_dataset Fetch data and render a branded chart image
visualize_data Render a chart from pre-fetched records (no API call)
visualize_comparison Multi-series comparison charts (e.g. country vs country)

All charts are returned as PNG images with official KAPSARC branding — logo, color palette, and source attribution. Chart types are auto-detected from data shape, or can be explicitly set to: bar, hbar, line, pie, or scatter.

Example Charts

Bar Chart — Top Oil Producers

Bar Chart

Line Chart — Time Series

Line Chart

Pie Chart — Energy Mix

Pie Chart

Multi-Line — Production Comparison

Multi-Line Chart

Scatter Plot — GDP vs Energy

Scatter Chart

Horizontal Bar — Energy by Sector

Horizontal Bar Chart

Electricity Prices

Electricity Prices

Renewable Energy Capacity

Renewables Capacity

GCC Power Generation Mix

GCC Power Mix

Multi-Bar — CO2 Emissions

CO2 Emissions

Solar Irradiance vs Capacity Factor

Solar Scatter

Renewable Share of Electricity

Renewable Share Trend

Hydrogen Production Costs

Hydrogen Costs

Brent Crude Oil Price

Brent Crude Price

Saudi Arabia GDP Composition

Saudi GDP Composition

Installation

Quick Start

uvx kapsarc-mcp-server

Or install with pip:

pip install kapsarc-mcp-server
kapsarc-mcp-server

Claude Code

claude mcp add kapsarc-data -- uvx kapsarc-mcp-server

Claude Desktop

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "kapsarc-data": {
      "command": "uvx",
      "args": ["kapsarc-mcp-server"]
    }
  }
}

Development

git clone https://github.com/MHDhazmi/kapsarc-mcp-server.git
cd kapsarc-mcp-server
uv sync
uv run kapsarc-mcp-server

Configuration

Set the KAPSARC_API_KEY environment variable to authenticate with the KAPSARC API. This is optional — most datasets are publicly accessible without a key.

export KAPSARC_API_KEY="your-api-key"

Development

# Unit tests (no network needed)
uv run pytest tests/test_charts.py -v

# Integration tests (hits live KAPSARC API)
uv run pytest tests/test_main.py -v

# Regenerate example chart images
uv run python examples/generate_examples.py

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kapsarc_mcp_server-0.1.0.tar.gz (904.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kapsarc_mcp_server-0.1.0-py3-none-any.whl (63.1 kB view details)

Uploaded Python 3

File details

Details for the file kapsarc_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: kapsarc_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 904.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for kapsarc_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d41e2700b3b2552d63289cd4ce2641e8a53d875cd74e5c54674a751bfd30db37
MD5 dc6e9cabb12c5b295857730413939431
BLAKE2b-256 beaea0adfebba05804a8d6c302de8511ac7ed004011fe7b2966104a4e333a847

See more details on using hashes here.

File details

Details for the file kapsarc_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kapsarc_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e2e583edba45cb85b5a23d146e9119d721a218a97142ac4a0f517cd1a51617c
MD5 fcd5daffbed9feddb8a1203fd368c75d
BLAKE2b-256 7951967931c1969cf6bc665ad79362342d7f8e6e9340d48436532e954d7557e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page