@daanrongen/tfl-mcp 1.0.8 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -47
- package/dist/main.js +36813 -0
- package/package.json +37 -18
- package/build/index.js +0 -22421
- package/build/index.js.map +0 -171
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# tfl-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MCP server for the [Transport for London Unified API](https://api.tfl.gov.uk/) — lines, journeys, stop points, arrivals, bike points, occupancy, road disruptions and more over stdio.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y @daanrongen/tfl-mcp
|
|
9
|
+
```
|
|
4
10
|
|
|
5
11
|
## Tools (80 total)
|
|
6
12
|
|
|
@@ -22,31 +28,13 @@ A [Model Context Protocol](https://modelcontextprotocol.io/) server for the [Tra
|
|
|
22
28
|
|
|
23
29
|
## Setup
|
|
24
30
|
|
|
25
|
-
###
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
curl -fsSL https://bun.sh/install | bash
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### 2. Install dependencies
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
bun install
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### 3. Build
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
bun run build
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 4. Get a TfL API key (free)
|
|
31
|
+
### API key (optional but recommended)
|
|
44
32
|
|
|
45
|
-
Register at [https://api-portal.tfl.gov.uk/](https://api-portal.tfl.gov.uk/). Without
|
|
33
|
+
Register for a free key at [https://api-portal.tfl.gov.uk/](https://api-portal.tfl.gov.uk/). Without one, requests are rate-limited to ~500/day.
|
|
46
34
|
|
|
47
|
-
###
|
|
35
|
+
### Claude Desktop
|
|
48
36
|
|
|
49
|
-
Edit `~/Library/Application Support/Claude/claude_desktop_config.json
|
|
37
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
50
38
|
|
|
51
39
|
```json
|
|
52
40
|
{
|
|
@@ -56,32 +44,42 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
|
|
|
56
44
|
"command": "npx",
|
|
57
45
|
"args": ["-y", "@daanrongen/tfl-mcp"],
|
|
58
46
|
"env": {
|
|
59
|
-
"TFL_API_KEY": "
|
|
47
|
+
"TFL_API_KEY": "your-key-here"
|
|
60
48
|
}
|
|
61
49
|
}
|
|
62
50
|
}
|
|
63
51
|
}
|
|
64
52
|
```
|
|
65
53
|
|
|
66
|
-
Or
|
|
54
|
+
Or via the CLI:
|
|
67
55
|
|
|
68
56
|
```bash
|
|
69
|
-
claude mcp add tfl npx -- -y @daanrongen/tfl-mcp
|
|
70
|
-
-e TFL_API_KEY=$TFL_API_KEY
|
|
57
|
+
claude mcp add tfl npx -- -y @daanrongen/tfl-mcp -e TFL_API_KEY=your-key-here
|
|
71
58
|
```
|
|
72
59
|
|
|
73
60
|
## Development
|
|
74
61
|
|
|
75
62
|
```bash
|
|
76
|
-
bun
|
|
77
|
-
bun run
|
|
63
|
+
bun install
|
|
64
|
+
bun run dev # run with --watch
|
|
78
65
|
bun test # run test suite
|
|
79
|
-
bun
|
|
66
|
+
bun run build # bundle to dist/main.js
|
|
67
|
+
bun run inspect # open MCP Inspector in browser
|
|
80
68
|
```
|
|
81
69
|
|
|
70
|
+
## Inspecting locally
|
|
71
|
+
|
|
72
|
+
`bun run inspect` launches the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) against the local build:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
bun run build && bun run inspect
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This opens the Inspector UI in your browser where you can call any tool interactively and inspect request/response shapes.
|
|
79
|
+
|
|
82
80
|
## Journey planner — location IDs
|
|
83
81
|
|
|
84
|
-
The most common failure mode is passing a free-text name to `journey_plan`, which causes TfL to return a 300 disambiguation response. The tool handles this gracefully and returns suggested `parameterValue` IDs to
|
|
82
|
+
The most common failure mode is passing a free-text name to `journey_plan`, which causes TfL to return a 300 disambiguation response. The tool handles this gracefully and returns suggested `parameterValue` IDs to retry with.
|
|
85
83
|
|
|
86
84
|
**Preferred ID formats (most to least reliable):**
|
|
87
85
|
|
|
@@ -112,19 +110,16 @@ The most common failure mode is passing a free-text name to `journey_plan`, whic
|
|
|
112
110
|
|
|
113
111
|
```
|
|
114
112
|
src/
|
|
115
|
-
├──
|
|
116
|
-
├──
|
|
117
|
-
├──
|
|
118
|
-
├──
|
|
119
|
-
|
|
120
|
-
├──
|
|
121
|
-
├──
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
├──
|
|
125
|
-
├──
|
|
126
|
-
|
|
127
|
-
├── search.ts # Search domain
|
|
128
|
-
├── stop-point.ts # StopPoint domain (17 tools)
|
|
129
|
-
└── vehicle.ts # Vehicle domain
|
|
113
|
+
├── config.ts # Effect Config — TFL_API_KEY
|
|
114
|
+
├── main.ts # Entry point — ManagedRuntime + StdioServerTransport
|
|
115
|
+
├── domain/
|
|
116
|
+
│ ├── TflClient.ts # Context.Tag service interface
|
|
117
|
+
│ └── errors.ts # TflError, TflDisambiguationError
|
|
118
|
+
├── infra/
|
|
119
|
+
│ ├── TflClientLive.ts # Layer.effect — HTTP client with disambiguation handling
|
|
120
|
+
│ └── TflClientTest.ts # In-memory test adapter
|
|
121
|
+
└── mcp/
|
|
122
|
+
├── server.ts # McpServer wired to ManagedRuntime
|
|
123
|
+
├── utils.ts # formatSuccess, formatError, formatDisambiguation
|
|
124
|
+
└── tools/ # One module per TfL domain (13 files)
|
|
130
125
|
```
|