Skip to main content

viaggiatreno-mcp

Server MCP (Model Context Protocol) per interrogare in tempo reale la rete ferroviaria italiana tramite le API di ViaggiaTreno.

Il server è un adattatore sottile: espone come tool MCP le funzionalità della libreria viaggiatreno, senza conoscere i dettagli delle API sottostanti. Permette ad assistenti come Claude di cercare stazioni, consultare tabelloni partenze/arrivi, monitorare ritardi e andamento dei treni, controllare le tratte e leggere le notizie di infomobilità.

Tool di analisi

Oltre agli endpoint grezzi, il server espone due analisi della libreria (viaggiatreno.insights):

  • profilo_stazione: ruolo (capolinea/transito), frequenza, binari e collegamenti di una stazione, dai tabelloni di partenze e arrivi;
  • profilo_treno: itinerario, fermate, archi (tempi di percorrenza, ritardo accumulato) e anomalie di un treno, da andamentoTreno.

Installazione

pip install viaggiatreno-mcp

Avvio

# tramite lo script console
viaggiatreno-mcp

# oppure come modulo
python -m viaggiatreno_mcp

Il server usa il trasporto stdio: viene avviato dal client MCP, non va lanciato a mano quando lo si configura in Claude/Kiro/ecc.

Configurazione nei client MCP

Il modo consigliato è uvx, che scarica ed esegue il pacchetto in un ambiente isolato senza installazione manuale (richiede uv).

Claude Desktop

File di configurazione:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "viaggiatreno": {
      "command": "uvx",
      "args": ["viaggiatreno-mcp"]
    }
  }
}

Kiro (e client con lo stesso formato: Cursor, Windsurf, VS Code MCP, ecc.)

In ~/.kiro/settings/mcp.json (globale) o .kiro/settings/mcp.json (per workspace):

{
  "mcpServers": {
    "viaggiatreno": {
      "command": "uvx",
      "args": ["viaggiatreno-mcp"],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Alternativa senza uvx (pacchetto già installato con pip)

Se hai fatto pip install viaggiatreno-mcp, punta direttamente al comando. Usa un percorso assoluto se il client non eredita il tuo PATH:

{
  "mcpServers": {
    "viaggiatreno": {
      "command": "viaggiatreno-mcp",
      "args": []
    }
  }
}

Oppure, per essere indipendenti dal PATH, via interprete Python:

{
  "mcpServers": {
    "viaggiatreno": {
      "command": "python",
      "args": ["-m", "viaggiatreno_mcp"]
    }
  }
}

Dopo aver salvato la configurazione, riavvia il client MCP.

Dipendenze

Licenza

Vedi il file LICENSE nel repository.

Repository: https://github.com/matteoredaelli/pyviaggiatreno

Metadata

Release files for viaggiatreno-mcp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for viaggiatreno-mcp 0.4.0
File Size Uploaded Provenance Actions
viaggiatreno_mcp-0.4.0.tar.gz 21.2 kB With provenance Details for viaggiatreno_mcp-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for viaggiatreno-mcp 0.4.0
File Interpreter ABI Platform Actions
viaggiatreno_mcp-0.4.0-py3-none-any.whl Python 3 none any Details for viaggiatreno_mcp-0.4.0-py3-none-any.whl

Total release size: 47.5 kB

Release files / viaggiatreno_mcp-0.4.0.tar.gz

Download URL viaggiatreno_mcp-0.4.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5b174d6d92f308871162fec6ac15584f16efe393b501d1cac4446460cc6736e0
BLAKE2b-256 checksum
How to use checksums
3fd9e1c942f14b511555e5ebd04c31ccd613fc15b487dc10329ab13d29f14e5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / viaggiatreno_mcp-0.4.0-py3-none-any.whl

Download URL viaggiatreno_mcp-0.4.0-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88dc40a76c511d8f88519cfc1efc8ce7a4643ebf1d618ca76526138c7d591b77
BLAKE2b-256 checksum
How to use checksums
1bf8b1c2408000f1934f35519ca6f2101da39cdd539ac501fe612d95a997f208
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for viaggiatreno-mcp 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for viaggiatreno_mcp-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page