ns-mcp-server
by: r-huijts
A Model Context Protocol (MCP) server that provides access to NS (Dutch Railways) travel information through Claude AI. This server enables Claude to fetch real-time train travel information and disruptions using the official Dutch NS API.
📌Overview
Purpose: The NS Travel Information MCP Server aims to transform your AI assistant into a knowledgeable expert on Dutch railways, providing real-time travel information for navigating the train system in the Netherlands.
Overview: This server connects the AI assistant Claude with the Nederlandse Spoorwegen (NS) API, enabling users to access a variety of services related to train schedules, ticket pricing, journey planning, and station information. The setup is straightforward, with multiple installation options and the ability to obtain real-time updates and essential travel details.
Key Features:
-
Real-time Train Information: Access current departure and arrival data, including delays, platform changes, and journey planning assistance.
-
Pricing Information: Retrieve accurate fare details for various travel classes, group pricing options, and any available discounts.
-
Station Information: Gain comprehensive insights into train stations, including facilities, accessibility options, and OV-fiets bike rental availability.
-
Multi-language Support: Information is available in both Dutch and English to cater to a wider audience.
-
Flexible Queries: Supports searches by station names, codes, or UIC identifiers, ensuring ease of access to information.
-
Time Zone Handling: Proper management of time zones for international travelers ensures accurate scheduling.
NS Travel Information MCP Server
Transform your AI assistant into a Dutch railways expert! This MCP server connects Claude to real-time NS (Nederlandse Spoorwegen) travel information, making it your perfect companion for navigating the Netherlands by train.
Installation
You can install this server in three ways:
1. Using Claude Desktop with NPM Package
Update your Claude configuration file (~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"ns-server": {
"command": "npx",
"args": [
"-y",
"ns-mcp-server"
],
"env": {
"NS_API_KEY": "your_api_key_here"
}
}
}
}
You can get an API key from the NS API Portal: https://apiportal.ns.nl/
2. Using Smithery
To install NS Travel Information Server automatically via Smithery:
npx -y @smithery/cli install ns-server --client claude
3. From Source
- Clone this repository
- Install dependencies:
npm install
- Copy the example environment file:
cp .env.example .env
- Add your NS API key to the
.env
file:NS_API_KEY=your_api_key_here
Update your Claude configuration file:
{
"mcpServers": {
"ns-server": {
"command": "node",
"args": [
"/path/to/ns-server/build/index.js"
],
"env": {
"NS_API_KEY": "your_api_key_here"
}
}
}
}
Make sure to:
- Replace
/path/to/ns-server
with the actual path to your installation. - Add your NS API key in the
env
section. It can be obtained from: https://apiportal.ns.nl/product#product=NsApp
After updating the configuration, restart Claude Desktop for the changes to take effect.
Real-World Use Cases
- Is my usual 8:15 train from Almere to Amsterdam running on time?
- Are there any delays on the Rotterdam-Den Haag route today?
- What's the best alternative route to Utrecht if there's maintenance on the direct line?
- Which train should I take to arrive at my office in Amsterdam Zuid before 9 AM?
- Which route to Amsterdam has the fewest transfers with a stroller?
- What's the earliest train I can take to make my 10 AM meeting in The Hague?
- When's the last train back to Groningen after a night out in Amsterdam?
- Are there any weekend engineering works that might affect my Monday morning class?
- Are there OV-fiets bikes available at Utrecht Centraal for my afternoon meeting?
- Is Eindhoven Strijp-S station wheelchair accessible and what platforms does it have?
- What trains are arriving at Utrecht Centraal in the next hour?
- Has the train from Venlo to Schiphol Airport arrived on time?
- How much does a first-class ticket from Amsterdam to Rotterdam cost?
- What's the price for 2 adults and 1 child traveling to Den Haag?
Environment Variables
Variable | Description |
---|---|
NS_API_KEY | Your NS API key (required) |
Features
This MCP server provides comprehensive access to NS train information through the following endpoints:
Real-time Train Information
- Departures: Real-time departure info including platform numbers, delays, and travel notes.
- Arrivals: Upcoming train arrivals with origin stations, platform changes, and status updates.
- Journey Planning: Find optimal travel routes with transfers and live updates.
- Service Updates: Information on disruptions, maintenance work, and engineering activities.
Pricing Information
- Ticket Prices: Accurate pricing for single and return journeys.
- Travel Classes: Compare first- and second-class prices.
- Group Pricing: Calculate fares for adults and children.
- Discount Options: Joint journey discounts and special offers.
- Validity Details: Ticket validity periods and travel conditions.
Station Information
- Station Details:
- Facilities and accessibility features.
- Platform layouts and track info.
- OV-fiets (bike rental) availability.
- Location and approach details.
Additional Features
- Multi-language support (Dutch and English).
- Flexible queries by station name, code, or UIC identifier.
- Proper handling of time zones for international stations.
- Real-time status updates on changes, delays, and cancellations.
License
This project is licensed under the MIT License. See the LICENSE file for details.