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.2

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.2
File Size Uploaded Provenance Actions
viaggiatreno_mcp-0.4.2.tar.gz 21.2 kB With provenance Details for viaggiatreno_mcp-0.4.2.tar.gz

Built distribution (wheel)

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

Total release size: 47.5 kB

Release files / viaggiatreno_mcp-0.4.2.tar.gz

Download URL viaggiatreno_mcp-0.4.2.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
09eccb068b74ded5adf1f9f9cb49df6a15805e67b73d79eec2ff12e582b154a7
BLAKE2b-256 checksum
How to use checksums
a7e75b2732b0a08dfa73cb4680f4244a4eaf93f73e676f06ff9e79cadf4c613f
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 18, 2026.

Transparency log

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

Download URL viaggiatreno_mcp-0.4.2-py3-none-any.whl
Size 26.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d1898a7da9122918053683fc1f1a8a73ea0121e405b0ae1fd3827ae5b2c8c60
BLAKE2b-256 checksum
How to use checksums
e7e8661208edc30be884869141e1d0d54ae12aa47feb00d2193ec89856840b57
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 18, 2026.

Transparency log

Security for viaggiatreno-mcp 0.4.2

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.2.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 18, 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