Sncf Mcp Server — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Sncf Mcp Server (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
A Model Context Protocol (MCP) server for querying SNCF (French national railway) train schedules using the official Navitia API. Integrates seamlessly with Claude Desktop and other MCP-compatible clients.
git clone https://github.com/belgrano9/sncf_mcp_server.git
cd sncf_mcp_server uv syncCreate a .env file in the project root:
SNCF_API=your-api-key-here⚠️ IMPORTANT: Never commit your .env file! It's already in .gitignore.
uv run server.pyTest the search functionality directly in Python:
from server import search_trains, find_station
# Search for trains
result = search_trains("Paris", "Lyon", "2025-11-20 14:00")
print(result)
# Find a station
stations = find_station("Paris")
print(stations)Or use the included Jupyter notebook (test_notebook.ipynb) for interactive testing.
Add to your Claude Desktop config file:
Windows (%APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"sncf": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\YourName\\path\\to\\sncf_mcp_server",
"run",
"server.py"
]
}
}
}macOS (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"sncf": {
"command": "uv",
"args": [
"--directory",
"/path/to/sncf_mcp_server",
"run",
"server.py"
]
}
}
}Linux (~/.config/Claude/claude_desktop_config.json):
{
"mcpServers": {
"sncf": {
"command": "uv",
"args": [
"--directory",
"/path/to/sncf_mcp_server",
"run",
"server.py"
]
}
}
}Restart Claude Desktop, and you can ask:
search_trainsFind trains between two stations with real-time data.
Parameters:
origin (string): Origin station/city name (e.g., "Paris", "Lyon", "Paris Gare de l'Est")destination (string): Destination station/city name (e.g., "München Hbf", "Barcelona")departure_datetime (string, optional): Travel date/time in flexible formats:"2025-11-28 08:00" (recommended)"28/11/2025 08:00""November 28, 2025 8:00am"Example Output:
═══════════════════════════════════
SNCF JOURNEY SEARCH
═══════════════════════════════════
🔍 Searched for 'Paris Est':
✓ Paris Gare de l'Est (ID: stop_area:SNCF:...)
Paris - Bercy (ID: stop_area:SNCF:...)
Paris Montparnasse (ID: stop_area:SNCF:...)
→ Selected: Paris Gare de l'Est
🔍 Searched for 'München Hbf':
✓ München Hauptbahnhof (ID: stop_area:OCE:...)
→ Selected: München Hauptbahnhof
📅 Searching for trains departing after: 2025-11-28 08:00
🔄 API datetime format: 20251128T080000
─────────────────────────────────
🚄 AVAILABLE TRAINS
─────────────────────────────────
Found 5 journey option(s):
1. Depart: 2025-11-28 08:55 → Arrive: 2025-11-28 14:54
Duration: 5h 59min | Direct
2. Depart: 2025-11-28 10:55 → Arrive: 2025-11-28 16:54
Duration: 5h 59min | Direct
3. Depart: 2025-11-28 12:55 → Arrive: 2025-11-28 19:18
Duration: 6h 23min | 1 change(s)
Route: Paris Gare de l'Est → Stuttgart Hbf | Stuttgart Hbf → München Hbf
═══════════════════════════════════find_stationSearch for train stations in a city or by name.
Parameters:
station_name (string): Station/city name to search (e.g., "Paris", "Lyon Part-Dieu")Example Output:
═══════════════════════════════════
STATION SEARCH
═══════════════════════════════════
🔍 Searched for 'Paris':
✓ Paris Gare de Lyon (ID: stop_area:SNCF:87686006)
Paris Montparnasse (ID: stop_area:SNCF:87391003)
Paris Gare du Nord (ID: stop_area:SNCF:87271007)
→ Selected: Paris Gare de Lyon
✅ Best match: Paris Gare de Lyon
ID: stop_area:SNCF:87686006
═══════════════════════════════════get_train_prices ⚠️ EXPERIMENTALEducational Proof of Concept Only - May Not Work
Attempts to scrape price information from SNCF's booking system.
⚠️ IMPORTANT DISCLAIMERS:
Parameters:
origin (string): Origin station/city namedestination (string): Destination station/city namedeparture_datetime (string, optional): Travel date/time (same formats as search_trains)page (integer, optional): Page number (default: 1)per_page (integer, optional): Results per page (default: 5, max: 20)Example Output (if it worked):
═══════════════════════════════════
SNCF PRICE CHECK (EXPERIMENTAL)
═══════════════════════════════════
⚠️ WARNING: Experimental feature
May not work due to anti-scraping measures
For educational purposes only
📍 Route: Paris Gare de Lyon → Marseille Saint-Charles
📅 Date: 2025-11-17
─────────────────────────────────
Attempting to fetch prices...
─────────────────────────────────
❌ Price check failed: Access forbidden - anti-scraping measures detected
This feature is experimental and may not work.
For real pricing, please visit:
- SNCF Connect: https://www.sncf-connect.com
- Or use commercial API providersWhy This Probably Won't Work:
Recommended Alternatives for Production:
See sncf_scraper/README.md for technical details and ethical considerations.
sncf_mcp_server/
├── server.py # FastMCP server implementation
├── price_checker.py # Price scraping wrapper (experimental)
├── pyproject.toml # Dependencies & project config
├── .env # API key (not committed)
├── .gitignore # Git ignore rules
├── README.md # This file
├── test_notebook.ipynb # Jupyter notebook for testing
├── sncf_scraper/ # Price scraper module (experimental)
│ ├── __init__.py # Module exports
│ ├── models.py # TrainOffer, PriceSearchResult models
│ ├── scraper.py # SNCFPriceScraper implementation
│ └── README.md # Scraper documentation & disclaimers
└── tests/ # Test suite
├── test_simple.py # Simple train search test
├── test_pagination.py # Pagination feature test
├── test_search.py # MCP wrapper test
├── test_price_scraper.py # Price scraper tests (experimental)
├── debug_*.py # Debug/diagnostic scripts
├── run_all_tests.py # Test runner
└── README.md # Test documentation/places endpoint with fuzzy matching/journeys endpoint with origin, destination, and datetimepython-dateutilThe server supports any route in the SNCF/Navitia network:
Major Cities:
Use find_station to discover available stations in any city.
# Clone and install
git clone https://github.com/belgrano9/sncf_mcp_server.git
cd sncf_mcp_server
uv sync
# Set up your API key in .env
echo "SNCF_API=your-api-key-here" > .env
# Run the server
uv run server.py
# Or use FastMCP dev mode
fastmcp dev server.pyserver.py - Main MCP server with search_trains and find_station tools.env - API key configuration (never commit!)test_notebook.ipynb - Interactive testing notebooktests/ - Test suite (see tests/README.md)Run the test suite to verify everything works:
# Run all tests
uv run tests/run_all_tests.py
# Run individual tests
uv run tests/test_simple.py # Simple train search
uv run tests/test_pagination.py # Pagination feature
uv run tests/debug_env2.py # Environment checkSee tests/README.md for detailed test documentation.
Real-time data from SNCF Navitia API:
https://api.sncf.com/v1.envfind_station for ambiguous namesContributions welcome! Please:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ using [FastMCP](https://github.com/jlowin/fastmcp) and [Claude](https://claude.ai)
Voyagez intelligent, voyagez en train! 🚄
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.