npm package: @iflow-mcp/faaak2-db-mcp
Description: A [Model Context Protocol](https://modelcontextprotocol.io) server providing real-time Deutsche Bahn travel data — departures, journeys, trip details, and station search.
Latest version: 1.0.3

# db-mcp

A [Model Context Protocol](https://modelcontextprotocol.io) server providing real-time Deutsche Bahn travel data — departures, journeys, trip details, and station search.

## Quick Start

### Claude Code

```bash
claude mcp add db-mcp --transport http https://mcp-builder.de/db/mcp
```

### Claude Desktop / Other MCP Clients

Add to your MCP client config:

```json
{
  "mcpServers": {
    "db-mcp": {
      "url": "https://mcp-builder.de/db/mcp"
    }
  }
}
```

### Local (stdio)

```bash
git clone <repo-url> && cd db
npm install && npm run build
```

Then add to your client config:

```json
{
  "mcpServers": {
    "db-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/db/build/index.js"]
    }
  }
}
```

## Tools

### `find_station`

Search for a Deutsche Bahn station by name.

| Parameter | Type   | Required | Description                   |
|-----------|--------|----------|-------------------------------|
| `query`   | string | yes      | Station name to search for    |
| `results` | number | no       | Number of results (default 1) |

### `get_departures`

Get upcoming departures from a station.

| Parameter    | Type   | Required | Description                                      |
|--------------|--------|----------|--------------------------------------------------|
| `station_id` | string | yes      | Station ID (e.g. `8000261` for München Hbf)      |
| `when`       | string | no       | ISO 8601 datetime (defaults to now)              |
| `duration`   | number | no       | Duration in minutes to query (default 60)        |

### `find_trip`

Get full trip details for a specific train, including all stopovers and remarks.

| Parameter    | Type   | Required | Description                                      |
|--------------|--------|----------|--------------------------------------------------|
| `train_name` | string | yes      | Train name (e.g. `ICE 599`)                      |
| `station_id` | string | yes      | Station ID (e.g. `8000261` for München Hbf)      |
| `date`       | string | yes      | ISO date (e.g. `2026-03-08`)                     |

### `find_journeys`

Find journey connections between two stations.

| Parameter   | Type   | Required | Description                                      |
|-------------|--------|----------|--------------------------------------------------|
| `from_id`   | string | yes      | Departure station ID                             |
| `to_id`     | string | yes      | Arrival station ID                               |
| `departure` | string | yes      | ISO datetime (e.g. `2026-03-08T14:00`)           |
| `results`   | number | no       | Number of journeys to return (default 4)         |

## Server Instructions

The server includes built-in instructions that guide the LLM to:

- Always show actual (not planned) times, platforms, and line info
- Warn about platform changes
- Flag replacement bus services
- Inform about passenger rights when delays exceed 60 minutes
- Check reachable intermediate stops when suggesting alternatives

## Transport Modes

The server auto-selects its transport based on the `PORT` environment variable:

| `PORT` set?  | Transport        | Use case              |
|--------------|------------------|-----------------------|
| Yes          | Streamable HTTP  | Remote / hosted       |
| No           | stdio            | Local via MCP client  |

## Development

```bash
npm install
npm run build
npm run serve     # starts HTTP on port 3000
```

## License

MIT