This MCP server provides real-time Dutch Railways (NS) data for journey planning, live departures, disruptions, and station search.
- Journey Planning - Plan optimal routes between stations with real-time updates
- Live Departures - Get real-time departure boards for any station
- Disruption Alerts - Check service disruptions and maintenance work
- Station Search - Find stations with auto-suggestions
-
NS API Key: Get your free API key from NS API Portal
- Sign up for an account
- Subscribe to the "NS App" product (free)
- Copy your subscription key
-
Cloudflare Account: Sign up at Cloudflare
-
Wrangler CLI: Install globally
npm install -g wrangler
# Create project directory
git clone git@github.com:lauragift21/ns-travel-mcp.git
cd ns-mcp-server
# Install dependencies
npm install
# Set your NS API key as a secret
npx wrangler secret put NS_API_KEY
# Paste your NS API subscription key when prompted
Create a .dev.vars
file in the project root with your NS API key:
NS_API_KEY=your_ns_api_key
# Deploy to Cloudflare Workers
npx wrangler deploy
# Your MCP server will be available at:
# https://ns-travel-mcp.your-subdomain.workers.dev
To use this MCP server with Claude Desktop, add it to your configuration: ~/Library/Application Support/Claude/claude_desktop_config.json
:
{
"mcpServers": {
"ns-mcp-server": {
"command": "npx",
"args": [
"mcp-remote",
"https://your-deployment.workers.dev/sse"
],
"env": {
"NS_API_KEY": "<YOUR_API_KEY"
}
}
}
}
You can connect your MCP server from the Cloudflare AI Playground, which is a remote MCP client:
- Go to https://playground.ai.cloudflare.com/
- Enter your deployed MCP server URL (remote-mcp-server-authless..workers.dev/sse)
- You can now use your MCP tools directly from the playground!
Plan my journey from Amsterdam Centraal to Utrecht Centraal tomorrow at 8:00 AM
Plan a trip from Amsterdam Centraal to Rotterdam Centraal this Saturday at 2:00 PM. I want to see both earlier and later options.
Are there any disruptions that would affect travel between Amsterdam and Utrecht?
Show me both planned maintenance and unexpected disruptions happening today
Find all train stations in Amsterdam
I'm flying into Schiphol at 3:00 PM. What's the best way to get to Amsterdam Centraal, and when should I expect to arrive?
I have a meeting in Rotterdam at 10:00 AM. What time should I leave from Amsterdam Centraal to arrive on time?
My usual train from Amsterdam to Utrecht is cancelled. What are my alternative options?
What are the last trains from Amsterdam Centraal to Utrecht tonight?
-
API Key Error: Ensure your NS API key is correctly set
wrangler secret put NS_API_KEY
-
Station Not Found: Use exact station names or codes
- ✅ "Amsterdam Centraal" or "asd"
- ❌ "Amsterdam Central" or "amsterdam"
-
CORS Issues: The server includes CORS headers for browser requests
-
Rate Limiting: NS API has rate limits - implement caching if needed
# Run locally for debugging
npx wrangler dev
# Check logs
npx wrangler tail
- NS API Documentation: apiportal.ns.nl
- Cloudflare Workers: developers.cloudflare.com
- Model Context Protocol modelcontextprotocol.io/introduction
MIT License - Feel free to modify and extend for your needs!
Built with ❤️ by Gift Egwuenu | Powered by MCP & Cloudflare Workers