# mcp-server-public-transport
An MCP-compatible server providing real-time public transport data across Europe.
## About
mcp-server-public-transport is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction)-compatible local server that provides access to public transport data across Europe.
Currently, it integrates APIs from UK, Switzerland and Belgium, allowing you to retrieve train connections, live departures, and bus locations.
## Feature Implementation Status
### Supported Countries
| Country | API Base URL | Status |
| --------------------- | ---------------------------------------------------------------- | ------ |
| **United Kingdom** | [https://transportapi.com](https://transportapi.com) | 🟡 (API key issues) |
| **Switzerland** | [https://transport.opendata.ch](https://transport.opendata.ch) | ✅ |
| **Belgium** | [https://api.irail.be](https://api.irail.be) | ✅ |
### Features by Country
| Feature | API Path | Status |
| --------------------- | --------------------------------------------------------------- | ------ |
| **United Kingdom** | | |
| Live Departures | `/uk/train/station/{station_code}/live.json` | 🟡 (API key issues) |
| **Switzerland** | | |
| Search Connections | `/connections` | ✅ |
| Station Lookup | `/locations` | ✅ |
| Departure Board | `/stationboard` | ✅ |
| Nearby Stations | `/locations?x={lon}&y={lat}` | ✅ |
| **Belgium** | | |
| Live Departures | `/departures` | ✅ |
| Station Lookup | `/stations` | ✅ |
| Nearby Stations | `/stations/nearby` | ✅ |
## Setup
### Environment Variables
Set the following environment variables:
```plaintext
UK_TRANSPORT_APP_ID=your_uk_app_id
UK_TRANSPORT_API_KEY=your_uk_api_key
```
### Usage with Claude Desktop
Add to your claude_desktop_config.json`:
```json
{
"mcpServers": {
"mcp-server-public-transport": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/mcp-server-public-transport",
"run",
"server.py"
],
"env": {
"UK_TRANSPORT_APP_ID": "your-uk-app-id",
"UK_TRANSPORT_API_KEY": "your-uk-api-key"
}
}
}
}
```
Replace `/ABSOLUTE/PATH/TO/PARENT/FOLDER/mcp-server-public-transport` with the actual path where you've cloned the repository.
> Note: You may need to put the full path to the uv executable in the command field. You can get this by running which uv on MacOS/Linux or where uv on Windows.
## Development
### Setting up Development Environment
1. **Clone the repository**
```bash
git clone https://github.com/mirodn/mcp-server-public-transport.git
cd mcp-server-public-transport
```
2. **Install dependencies**
```bash
uv sync
```
3. **Set environment variables**
```bash
cp .env.example .env
```
4. **Run the server**
```bash
uv run server.py
```
### Running Tests
The project uses pytest for testing with the following commands available:
```bash
# Run all tests
make test
```
### Code Quality
```bash
# Run linting
make lint
# Run code formatting
make format
```
### Continuous Integration
The project includes a GitHub Actions workflow (`.github/workflows/test.yml`) that automatically:
- Runs tests on Python 3.10, 3.11, and 3.12
- Executes linting checks using ruff
- Runs on every push and pull request to `main` branch
The CI pipeline ensures code quality and compatibility across supported Python versions before any changes are merged.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
The package is deployed automatically to PyPI when project.version is updated in `pyproject.toml`.
Follow semver for versioning.
## License
[MIT License](LICENSE)
Raw data
{
"_id": null,
"home_page": null,
"name": "mcp-server-public-transport",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "mcp, public transport, api, europe, fastmcp",
"author": null,
"author_email": "Miro Duman <dumanmiro@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/6c/d6/78e01cb0546e219724fc15fa78b8f45ff48f802f81b390067038531b86dc/mcp_server_public_transport-0.1.0.tar.gz",
"platform": null,
"description": "# mcp-server-public-transport\n\nAn MCP-compatible server providing real-time public transport data across Europe.\n\n## About\n\nmcp-server-public-transport is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction)-compatible local server that provides access to public transport data across Europe.\nCurrently, it integrates APIs from UK, Switzerland and Belgium, allowing you to retrieve train connections, live departures, and bus locations.\n\n## Feature Implementation Status\n\n### Supported Countries\n\n| Country | API Base URL | Status |\n| --------------------- | ---------------------------------------------------------------- | ------ |\n| **United Kingdom** | [https://transportapi.com](https://transportapi.com) | \ud83d\udfe1 (API key issues) |\n| **Switzerland** | [https://transport.opendata.ch](https://transport.opendata.ch) | \u2705 |\n| **Belgium** | [https://api.irail.be](https://api.irail.be) | \u2705 |\n\n### Features by Country\n\n| Feature | API Path | Status |\n| --------------------- | --------------------------------------------------------------- | ------ |\n| **United Kingdom** | | |\n| Live Departures | `/uk/train/station/{station_code}/live.json` | \ud83d\udfe1 (API key issues) |\n| **Switzerland** | | |\n| Search Connections | `/connections` | \u2705 |\n| Station Lookup | `/locations` | \u2705 |\n| Departure Board | `/stationboard` | \u2705 |\n| Nearby Stations | `/locations?x={lon}&y={lat}` | \u2705 |\n| **Belgium** | | |\n| Live Departures | `/departures` | \u2705 |\n| Station Lookup | `/stations` | \u2705 |\n| Nearby Stations | `/stations/nearby` | \u2705 |\n\n## Setup\n\n### Environment Variables\n\nSet the following environment variables:\n\n```plaintext\nUK_TRANSPORT_APP_ID=your_uk_app_id\nUK_TRANSPORT_API_KEY=your_uk_api_key\n```\n\n### Usage with Claude Desktop\n\nAdd to your claude_desktop_config.json`:\n\n```json\n{\n \"mcpServers\": {\n \"mcp-server-public-transport\": {\n \"command\": \"uv\",\n \"args\": [\n \"--directory\",\n \"/ABSOLUTE/PATH/TO/mcp-server-public-transport\",\n \"run\",\n \"server.py\"\n ],\n \"env\": {\n \"UK_TRANSPORT_APP_ID\": \"your-uk-app-id\",\n \"UK_TRANSPORT_API_KEY\": \"your-uk-api-key\"\n }\n }\n }\n}\n\n```\n\nReplace `/ABSOLUTE/PATH/TO/PARENT/FOLDER/mcp-server-public-transport` with the actual path where you've cloned the repository.\n> Note: You may need to put the full path to the uv executable in the command field. You can get this by running which uv on MacOS/Linux or where uv on Windows.\n\n## Development\n\n### Setting up Development Environment\n\n1. **Clone the repository**\n\n ```bash\n git clone https://github.com/mirodn/mcp-server-public-transport.git\n cd mcp-server-public-transport\n ```\n\n2. **Install dependencies**\n\n ```bash\n uv sync\n ```\n\n3. **Set environment variables**\n\n ```bash\n cp .env.example .env\n ```\n\n4. **Run the server**\n\n ```bash\n uv run server.py\n ```\n\n### Running Tests\n\nThe project uses pytest for testing with the following commands available:\n\n```bash\n# Run all tests\nmake test\n```\n\n### Code Quality\n\n```bash\n# Run linting\nmake lint\n\n# Run code formatting\nmake format\n```\n\n### Continuous Integration\n\nThe project includes a GitHub Actions workflow (`.github/workflows/test.yml`) that automatically:\n\n- Runs tests on Python 3.10, 3.11, and 3.12\n- Executes linting checks using ruff\n- Runs on every push and pull request to `main` branch\n\nThe CI pipeline ensures code quality and compatibility across supported Python versions before any changes are merged.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\nThe package is deployed automatically to PyPI when project.version is updated in `pyproject.toml`.\nFollow semver for versioning.\n\n## License\n\n[MIT License](LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An MCP-compatible server for querying public transport data in Europe (UK, CH, BE).",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/mirodn/mcp-server-public-transport",
"Repository": "https://github.com/mirodn/mcp-server-public-transport"
},
"split_keywords": [
"mcp",
" public transport",
" api",
" europe",
" fastmcp"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "185e5dbe66e44404de3fcea6cacece86d940854d0c49753fb76c114172bf4cb0",
"md5": "0bb4d6de63fea67409781b177387fd65",
"sha256": "2ac84408472d64ebb0ca4071c476866ee064986fd7aebf7a8dcbd23032445359"
},
"downloads": -1,
"filename": "mcp_server_public_transport-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0bb4d6de63fea67409781b177387fd65",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 5821,
"upload_time": "2025-07-28T19:49:09",
"upload_time_iso_8601": "2025-07-28T19:49:09.163493Z",
"url": "https://files.pythonhosted.org/packages/18/5e/5dbe66e44404de3fcea6cacece86d940854d0c49753fb76c114172bf4cb0/mcp_server_public_transport-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6cd678e01cb0546e219724fc15fa78b8f45ff48f802f81b390067038531b86dc",
"md5": "df6bf8d7f8be11697f0e20069d77a7a5",
"sha256": "ca81d562f43d43cb2e3177210ff7c034c5627114f7a448d596e82cb8932dd6ed"
},
"downloads": -1,
"filename": "mcp_server_public_transport-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "df6bf8d7f8be11697f0e20069d77a7a5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 6348,
"upload_time": "2025-07-28T19:49:11",
"upload_time_iso_8601": "2025-07-28T19:49:11.366125Z",
"url": "https://files.pythonhosted.org/packages/6c/d6/78e01cb0546e219724fc15fa78b8f45ff48f802f81b390067038531b86dc/mcp_server_public_transport-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-28 19:49:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mirodn",
"github_project": "mcp-server-public-transport",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mcp-server-public-transport"
}