Skip to main content

MCP server for dane.gov.pl API

Project description

Dane.gov.pl MCP Server

License: MIT Python 3.11+

A Model Context Protocol (MCP) Server that integrates with dane.gov.pl, Poland's central open data portal. This server acts as a bridge between Polish public datasets and modern AI applications, creating a transparent, fast, and structured API layer consumable by LLMs, agents, and intelligent services.

Inspired by the success of data-gov-il-mcp, this project aims to unlock the potential of Polish government data for AI-powered civic applications.

๐ŸŽฏ Project Vision

We are building the first MCP server for Polish open government data. No equivalent exists today, making this a strategic opportunity to position Poland at the forefront of civic tech and AI infrastructure.

The Problem

  • Poland's <dane.gov.pl> has rich datasets but poor accessibility for AI models
  • Inconsistent data formats and lack of clear APIs
  • No standardized way for LLMs to access Polish government data

The Solution

An open-source MCP Server that:

  • ๐Ÿ” Discovers datasets through semantic search and filtering
  • ๐Ÿ”„ Parses diverse data formats into unified structures
  • ๐Ÿง  Processes data with LLM-powered operations
  • ๐Ÿ“Š Visualizes results through chart integrations
  • โšก Aggregates large datasets using Polars for performance

๐Ÿš€ Current State

The project is in its final stages of development. All core functionality is implemented and tested, with ongoing quality-of-life improvements and bug fixes being made:

โœ… Available Features

  • Institution Search - Find and filter government institutions by name, city, description
  • Dataset Discovery - Search datasets by keywords, titles, and descriptions
  • Resource Listing - Browse individual data files within datasets
  • Showcases Search - Find real-world visualizations and applications that use the datasets
  • Metadata Access - Get detailed information about institutions, datasets, and resources
  • Data Parsing - Convert resources into LLM-ready Markdown documents
  • LLM Processing - Enable grouping, aggregating, filtering, and sorting operations for tabular data resources (loaded into Polars DataFrames)
  • Chart Integration - Visualize processed data through MCP chart tools

๐Ÿ—๏ธ Architecture

The system comprises three distinct functionality layers:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    Discovery    โ”‚  โ† Search & filter datasets/resources/institutions/showcases
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚     Parsing     โ”‚  โ† Convert resources LLM ready Markdown documents 
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   Processing    โ”‚  โ† LLM-powered operations on Polars dataframes
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Discovery Layer

  • Search datasets by keywords (e.g., "water condition")
  • Filter institutions by city, name, or description
  • Browse resources within selected datasets
  • Access comprehensive metadata

Parsing Layer

  • Convert CSV, JSON, XLSX, PDF and other files to Markdown documents
  • Support for most of the resources in optimal formats

Processing Layer

  • Data operations (group, filter, aggregate)
  • Integration with visualization tools

๐Ÿ› ๏ธ Tech Stack

  • Python - Core development language
  • FastMCP - MCP server framework
  • Pydantic - Data validation and serialization
  • Polars - High-performance data processing
  • Unstructured - Document parsing and extraction for PDFs, CSVs and other formats
  • Fly.io - Deployment platform

๐Ÿš€ Installation & Setup

Prerequisites

  • Python 3.11+
  • UV package manager (recommended)

Quick Start

# Clone the repository
git clone https://github.com/appunite/dane-gov-pl-mcp.git
cd dane-gov-pl-mcp

# Install dependencies
uv sync

# Run the MCP server
uv run python -m src.app --transport stdio

MCP Client Configuration

Add to your MCP client configuration (e.g., Claude Desktop, Cursor):

{
  "mcpServers": {
    "dane-gov-pl-mcp": {
      "command": "/path/to/dane-gov-pl-mcp/.venv/bin/python",
      "args": ["-m", "src.app", "--transport", "stdio"],
      "cwd": "/path/to/dane-gov-pl-mcp",
      "env": {
        "PYTHONPATH": "/path/to/dane-gov-pl-mcp",
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

๐Ÿ“– Usage Examples

Discovery

# Search datasets by keywords
search_datasets(search_filters={"query_all": "environment"})

# Find institutions by location
search_institutions(search_filters={"city_terms": "Warszawa"})

# Get dataset details
get_resources_details(dataset_ids=[123, 456])

Document Parsing

# Parse files to Markdown
get_file_content(resource_ids=[123, 456])

Tabular Data Processing

# Get resource metadata
get_tabular_resource_metadata(resource_ids=[123])

# Query tabular data
get_tabular_data(resource_id=123, search_filters={"q": "col1:Warszawa"})

# Advanced DataFrame operations
resource_to_dataframe(resource_id=123, dataframe_operations={
    "primary_group": "col1",
    "aggregations": ["sum", "mean"],
    "aggregation_columns": ["col2", "col2"],
    "sort_columns"=["col2_sum", "col1"], 
    "sort_descending"=[True, False]
})

๐Ÿค Contributing

We welcome contributions! This project aims to make Polish government data more accessible and usable for everyone.

Contributing Guidelines

  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

๐Ÿ”— Links

Authors

Dane-gov-pl-mcp is created by Appunite.

Since 2010, Appunite is a collective of software engineers, product builders, and problem solvers. We partner with bold teams to tackle product and business challengesโ€”designing custom-built squads that ship fast and think strategically. From AI-enabled workflows to mobile platforms and cloud-native systems, we deliver end-to-end execution with full accountability.

Looking for your unfair advantage in tech execution? Talk to us.

Copyright 2025, Appunite

Appunite

Licensed under the MIT License

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

dane_gov_pl_mcp-0.1.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

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

dane_gov_pl_mcp-0.1.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dane_gov_pl_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dane_gov_pl_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 15070bd8919f1cc02069f1bcfbd01f691d63214ec0d1ccdff27a99f2caa0c66b
MD5 d4b6943270834e0a6644126039635914
BLAKE2b-256 094ea370a528aea974c205a1773ef586877d260157ce4e1469789b0180e80a86

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dane_gov_pl_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dane_gov_pl_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 144fae4d022b1cbb9217cb63344360f9ce220390bc7dfffb5214c574d827f33b
MD5 05dea20e59208079471fee6956e7d9be
BLAKE2b-256 f26c5ed523477fc5243cc6c3acf32684af6da649777e07a23b2017ee19cbc861

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