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": "uvx",
      "args": ["dane-gov-pl-mcp"]
    }
  }
}
Alternative: Local Development Setup

For local development without PyPI:

{
  "mcpServers": {
    "dane-gov-pl-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/dane-gov-pl-mcp", "dane-gov-pl-mcp"]
    }
  }
}

๐Ÿ“– 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.1.tar.gz (175.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: dane_gov_pl_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 175.1 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.1.tar.gz
Algorithm Hash digest
SHA256 919b734ffc6be4ae064b1e5a9acaa39f23eedca6b72b883548214fcdf71ade4b
MD5 3077d68e324e3ee4077744198a3a9f82
BLAKE2b-256 70df110106c240132188091899504925f9f4387f6293f5f95371810459cd609d

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