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
Line Chart — Time Series
Pie Chart — Energy Mix
Multi-Line — Production Comparison
Scatter Plot — GDP vs Energy
Horizontal Bar — Energy by Sector
Electricity Prices
Renewable Energy Capacity
GCC Power Generation Mix
Multi-Bar — CO2 Emissions
Solar Irradiance vs Capacity Factor
Renewable Share of Electricity
Hydrogen Production Costs
Brent Crude Oil Price
Saudi Arabia 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d41e2700b3b2552d63289cd4ce2641e8a53d875cd74e5c54674a751bfd30db37
|
|
| MD5 |
dc6e9cabb12c5b295857730413939431
|
|
| BLAKE2b-256 |
beaea0adfebba05804a8d6c302de8511ac7ed004011fe7b2966104a4e333a847
|
File details
Details for the file kapsarc_mcp_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kapsarc_mcp_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 63.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e2e583edba45cb85b5a23d146e9119d721a218a97142ac4a0f517cd1a51617c
|
|
| MD5 |
fcd5daffbed9feddb8a1203fd368c75d
|
|
| BLAKE2b-256 |
7951967931c1969cf6bc665ad79362342d7f8e6e9340d48436532e954d7557e8
|