# Renfe Data MCP for AI Agents AI Agent Connect

> Renfe Data MCP gives your AI agent direct access to Spain's national railway network. It pulls live GPS positions for commuter and long-distance trains, tracks real-time delays, and pulls from the official CKAN open data portal. Whether you're building a travel app or analyzing urban mobility, this lets your agent see exactly what's happening on the tracks right now.

## Overview
- **Category:** iot-hardware
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_NiuRRhYPhoWzRmGjhNgpW4F2wk5xnXdpz0kBo7fB/ai-agent-connect
- **Tags:** railway, real-time-tracking, gps-data, public-transport, logistics, open-data

## Description

Renfe Data provides a direct line to Spain's national railway network. This Connector connects your agent to the official portal, turning raw railway data into actual answers without you having to hunt through multiple tabs or parse messy PDFs. You can have your agent pull live vehicle positions for Cercanías trains or check for specific service alerts like bus substitutions and accessibility issues in one go. It also handles the heavy lifting of navigating the CKAN infrastructure, letting you find specific datasets or grab GTFS schedules for offline use. It's a huge time saver if you're tired of manual data scraping or need to build something that relies on accurate, live transport info. By adding this to your toolkit in the Vinkius catalog, you give your agent the same high-quality data feeds that professional logistics analysts use to keep things moving. You can query for planned service modifications or inspect metadata for thousands of resources, making it easy to stay on top of network changes. It makes the complex world of Spanish rail data accessible through a simple chat interface.

## Tools

### rt_trip_updates_cercanias
Get real-time trip status and updates for Cercanías. Use this to see if a specific commuter train is on time.

### rt_trip_updates_ld
Get real-time trip updates for long-distance trains like AVE and MD. This tracks major network movements.

### ckan_datastore_search
Search for specific data points within a Renfe resource. Use this to find exact values in a dataset.

### ckan_package_list
List all available dataset names in the Renfe Data portal. This helps you see what data is available.

### ckan_package_show
Get the full metadata for a specific railway dataset. This provides context on what a resource contains.

### ckan_resource_show
Get metadata for a specific resource within a dataset. Use this to see specific file details.

### get_static_datasets
List direct URLs for static files like schedules and station lists. Use this for offline data analysis.

### rt_alerts_cercanias
Get live service alerts for the Cercanías commuter network. This provides updates on local disruptions.

### get_avisos
Get planned service modifications and official Avisos. This is great for checking scheduled changes.

### rt_vehicle_positions_cercanias
Get live GPS coordinates for Cercanías vehicles. This is perfect for live map tracking.

### rt_vehicle_positions_ld
Get live vehicle positions for long-distance train lines. Use this to see where major trains are currently located.

## Prompt Examples

**Prompt:** 
```
What's the status of the long-distance trains today?
```

**Response:** 
```
I've checked the live updates for the AVE and MD lines. Here is the current status:

| Train ID | Route | Status | Delay |
| :--- | :--- | :--- | :--- |
| AVE 03122 | Barcelona to Madrid | Delayed | 10 mins |
| MD 4501 | Madrid to Valencia | On Time | 0 mins |

Most other services are running on schedule. Would you like me to check a specific route?
```

**Prompt:** 
```
Can you find the GTFS schedule files for me?
```

**Response:** 
```
I found the following static datasets available for download:

* **Horarios-GTFS**: [Link to download] 
* **Estaciones**: [Link to download]

You can use these links to get the latest official schedule files for your project.
```

**Prompt:** 
```
Where are the Cercanías trains right now?
```

**Response:** 
```
I'm pulling the live GPS positions for the Cercanías network. Currently, there are 42 active vehicles. 

**Sample Positions:**
* **Train C-4**: Lat 40.406, Lon -3.692 (Near Madrid-Atocha)
* **Train C-10**: Lat 40.410, Lon -3.701 (Near Madrid-Puerta de Toledo)

Would you like a full list of all active positions?
```

## Capabilities

### Track live train positions
Get real-time GPS coordinates for both commuter and long-distance trains.

### Monitor real-time delays
Check for active cancellations and schedule changes as they happen.

### Search CKAN datasets
Browse and inspect metadata for thousands of railway resources.

### Retrieve service alerts
Get updates on accessibility issues and bus substitutions.

### Access static schedules
Fetch direct URLs for GTFS schedules and station lists.

## Use Cases

### Building a live commuter map
A developer needs to show train locations on a web map. They ask their agent to pull live GPS coordinates using rt_vehicle_positions_cercanias.

### Finding official transit datasets
A researcher needs to find all available station data. They use ckan_package_list to see every dataset and then ckan_package_show to inspect them.

### Checking for train delays
A user wants to know why their long-distance train is late. They ask their agent to check rt_trip_updates_ld for the latest status.

### Downloading GTFS files
A dev needs to pull official schedules for an app. They use get_static_datasets to get the direct download URLs for the latest files.

## Benefits

- Stop manual scraping by using ckan_package_list to find datasets instantly.
- Get precise GPS coordinates for trains using rt_vehicle_positions_cercanias.
- Monitor live delays with rt_trip_updates_ld to keep passengers informed.
- Pull official service modifications immediately via get_avisos.
- Access offline-ready schedules using get_static_datasets for local analysis.

## How It Works

The bottom line is you get real-time Spanish railway data in your chat interface without the manual searching.

1. Get your Renfe Data API key from the official portal.
2. Add this Connector to your client and enter your credentials.
3. Ask your agent to find train locations, schedules, or data files.

## Frequently Asked Questions

**Can Renfe Data MCP track live train locations?**
Yes, it provides real-time GPS coordinates for both commuter and long-distance trains across the Renfe network.

**Does Renfe Data MCP work for all Spanish trains?**
It specifically covers the Renfe national railway network, including Cercanías, AVE, LD, and MD services.

**How do I get the official schedules with Renfe Data MCP?**
The Connector can fetch direct download URLs for official GTFS schedules and station lists from the Renfe data portal.

**Can I use Renfe Data MCP to find transit datasets?**
Yes, it allows your agent to search, list, and inspect metadata for thousands of railway datasets in the official CKAN portal.

**Does Renfe Data MCP show real-time delays?**
It pulls live trip updates, including delays and cancellations, for both commuter and long-distance train lines.

**Is Renfe Data MCP good for building a travel app?**
It's ideal for developers because it provides a direct way to integrate live train positions and official schedule data into a custom application.

**How often are the real-time train positions updated?**
It depends on the service: Cercanías positions (`rt_vehicle_positions_cercanias`) update every 20 seconds, while Long Distance trains (`rt_vehicle_positions_ld`) update every 15 minutes.

**Can I check for delays or platform changes for a specific trip?**
Yes. Use `rt_trip_updates_cercanias` or `rt_trip_updates_ld` to get live information on delays, cancellations, and platform assignments across the network.

**Where can I find the static GTFS files for schedules?**
You can use the `get_static_datasets` tool. It returns direct download URLs for GTFS schedule packages and CSV/XLSX lists of all Renfe stations.