# Ayuntamiento de Madrid (CKAN) MCP for AI Agents AI Agent Connect

> Ayuntamiento de Madrid (CKAN) MCP gives your agent direct access to Madrid's official open data portal. You can search for municipal datasets, look up specific city records like transport or budget info, and pull metadata for CSV, JSON, and XLS files. It connects your AI client to thousands of public datasets from the city's CKAN repository.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_Q2ilbvlu9XTF8EEUmS6g9MnP3zj786jqBlCeEBMV/ai-agent-connect
- **Tags:** open-data, municipal-data, ckan-api, public-records, city-services, data-querying

## Description

Ayuntamiento de Madrid (CKAN) MCP connects your AI client to the official open data portal of the Madrid City Council. It lets you explore thousands of public datasets through natural conversation. Instead of digging through nested folders on a website or manually filtering through hundreds of files, you can just ask your agent to find specific information. It handles the heavy lifting of navigating the CKAN repository, allowing you to query for everything from environmental monitoring to city budget records. You can see which departments own the data, check how often it updates, and grab the specific resource IDs you need for your projects. It's a way to turn the city's massive public records into a searchable knowledge base for your AI client. You can identify the maintainers of a dataset, see the license types, and find specific files in CSV, JSON, or XLS formats without ever leaving your chat interface. Since Vinkius makes it easy to manage these connections, you can get started with the city's data without worrying about complex API configurations or manual browsing. This tool makes it possible to gather real-time information about transport, environment, and economy sectors in Madrid. It bridges the gap between raw municipal data and actionable insights for your research or development needs.

## Tools

### list_groups
List all categories/groups

### list_organizations
List municipal departments/organizations

### list_packages
List all dataset names in the portal

### search_packages
Supports filtering by tags, groups, etc.

Search for datasets matching a query

### search_resources
Search for resources matching specific criteria

### list_tags
List all tags used in the catalog

### get_package
Get full metadata for a specific dataset

### get_resource
Get metadata for a specific file/resource

## Prompt Examples

**Prompt:** 
```
Find me all datasets related to public transport in Madrid.
```

**Response:** 
```
I found several datasets related to public transport in Madrid. Here are the most relevant ones:

| Dataset Name | Description |
| :--- | :--- |
| **BiciMAD: Estaciones y ocupación** | Real-time station status and occupancy.
| **EMT Madrid** | Municipal bus service records.
| **Transporte Público** | General city transport metrics.

Would you like more details on any of these?
```

**Prompt:** 
```
Which department manages the air quality data?
```

**Response:** 
```
The **Área de Gobierno de Medio Ambiente y Movilidad** is the primary department responsible for air quality data. They manage several resources, including:

*   **Puntos de muestreo de aire** (Air sampling points)
*   **Calidad del aire en tiempo real** (Real-time air quality)

I can pull the full metadata for these if you'd like.
```

**Prompt:** 
```
Get the metadata for the 'puntos-muestreo-aire' dataset.
```

**Response:** 
```
I've inspected the **puntos-muestreo-aire** dataset. Here are the details:

*   **Maintainer:** Environment Department
*   **Update Frequency:** Monthly
*   **License:** Open Data License
*   **Resources:** Includes 4 files in **CSV** and **XML** formats.

Let me know if you need the specific links for any of these files.
```

## Capabilities

### Search municipal datasets by topic
Find specific city data like transport or budget records using natural language.

### Pull metadata for city files
Get details on file formats, licenses, and update frequencies for specific resources.

### Identify data owners by department
See which municipal organization is responsible for publishing a specific dataset.

### Filter records by city tags
Browse related information across different city sectors using official tags.

### List all available city data packages
Get a full list of every dataset currently hosted on the Madrid open data portal.

## Use Cases

### Urban Planning Research
A researcher asks for all datasets related to 'BiciMAD' stations and gets a list of specific records to analyze bike usage trends.

### Application Development
A developer needs the JSON links for air quality monitoring and uses the agent to find the exact resource IDs to build a local dashboard.

### Budget Analysis
A journalist asks for budget data from the environment department to find specific spending trends on city green spaces.

### Data Mapping
A city analyst lists all municipal organizations to map out which departments are publishing the most data for a transparency report.

## Benefits

- Stop manual scraping: Use madrid_search_packages to find municipal datasets in seconds instead of clicking through multiple pages of a government portal.
- Get precise metadata: Pull license and update info for specific files using madrid_get_package to ensure your project uses the most current data.
- Identify data owners: Use madrid_list_organizations to see exactly which city department maintains the records you need for your research.
- Explore city categories: Browse all data types with madrid_list_groups to understand the full scope of Madrid's public records in one view.
- Streamline development: Fetch resource IDs with madrid_search_resources so you can integrate city data into your own applications much faster.

## How It Works

The bottom line is you get a direct line to Madrid's public records without ever leaving your chat interface.

1. Subscribe to the Connector and obtain your API key from the Madrid Data portal.
2. Connect your AI client to the Connector through the Vinkius dashboard.
3. Ask your agent to find, filter, or describe specific municipal datasets from the city.

## Frequently Asked Questions

**What kind of data can I get with the Ayuntamiento de Madrid (CKAN) MCP?**
You can access a wide range of municipal records, including transport data, environmental monitoring, city budgets, and various public records from the Madrid City Council.

**Can the Ayuntamiento de Madrid (CKAN) MCP find specific file formats?**
Yes, the Connector can identify and provide metadata for specific files in CSV, JSON, and XLS formats so you know exactly what you're getting.

**How do I find out which city department owns a dataset?**
The Connector allows you to list all municipal organizations, making it easy to see which specific government branch is responsible for the data you're looking for.

**Can I use the Ayuntamiento de Madrid (CKAN) MCP for urban research?**
Absolutely. It is designed to help researchers quickly find and inspect municipal datasets for urban trend analysis and public record research.

**Does the Ayuntamiento de Madrid (CKAN) MCP support searching by tags?**
Yes, you can browse data by tags to find related information across different city sectors, which helps in discovering connected datasets.

**Is the Ayuntamiento de Madrid (CKAN) MCP good for finding budget info?**
Yes, it can search for specific topics like city budgets, allowing you to find financial records across various municipal departments.

**How can I find datasets specifically about air quality or pollution?**
You can use the `search_packages` tool with a query like 'aire' or 'contaminacion'. The agent will return a list of matching datasets available in the Madrid portal.

**Can I get the direct download link for a data file?**
Yes. By using `get_package` or `get_resource`, the agent will provide the metadata which includes the 'url' field for the specific resources (CSV, PDF, etc.) associated with that dataset.

**How do I see which municipal department published a certain dataset?**
Use the `get_package` tool for a specific dataset ID. The metadata returned will include the organization name. You can also use `list_organizations` to see all publishing entities.