searchLABSCO SUMMARY
A working example of two tools beating twenty.
The Code Mode pattern is the reason to look at this even if you never take a Berlin tram: the model gets the API spec on demand instead of every schema up front, and a two-step lookup happens inside one sandbox run. The repository is explicit that swapping the spec and the origin points it at a different API, so it doubles as a template.
What it is
A Cloudflare Worker that wraps the VBB transport API. It uses Code Mode: rather than registering a tool per API operation, it describes the API as an OpenAPI spec and exposes two tools — the model reads the spec, then writes a short JavaScript snippet that runs in a sandboxed Dynamic Worker and chains several calls in one go.
What you get
search— read the OpenAPI spec to find the operation, its parameters and the shape of what comes backexecute— run an async JavaScript snippet callingcodemode.request({ method, path, query }); the host proxies the HTTP call, and the sandbox has no direct network access of its own- Three underlying operations the spec exposes:
getLocationsfor stops, stations, addresses and points of interest;getDeparturesfor what is leaving a stop next;getJourneysfor routes between two places - Chaining in a single sandbox run — find the stop, then fetch its departures, without a round trip back to the model in between
Requirements
No account and no key for the transport data itself. npm install then npm run dev gives a local server at http://localhost:8787/mcp; npm run deploy publishes the Worker to your own workers.dev subdomain, which needs a Cloudflare account. Clients that speak remote MCP connect to the URL directly; Claude Desktop reaches it through npx mcp-remote with the URL as the argument. To wrap a different API instead, change API_ORIGIN and the OpenAPI spec in src/index.ts.
Setup effort
Paste a URL — add the endpoint to your client
USE CASES
Asking when the next tram leaves
Look up the stop by name and read its upcoming departures in one sandbox run.
Planning a route across the city
Resolve both ends to stop IDs, then ask for journey options between them.
Wrapping your own API the same way
Replace the origin and the OpenAPI spec in the source, and keep the two-tool interface.
2 tools
Listed in project docs. Your client may show a different list.
executeBEFORE YOU INSTALL
What to know first
Tools you get
2 tools named in the project's documentation.
Requires
npx on PATH
Where it runs
The documented client connects to a hosted endpoint.
INSTALLATION
Connect your client
Add the endpoint to your client.
Server setup
Setup
git clone https://github.com/harshil1712/berlin-transport-mcp
cd berlin-transport-mcp
npm installTo run your own copy locally, start npm run dev — it keeps running and serves http://localhost:8787/mcp
Or deploy your own copy as a Cloudflare Worker with npm run deploy — this needs a Cloudflare account, and the Worker is published at berlin-transport-mcp.<YOUR_ACCOUNT>.workers.dev/mcp
Hosted endpoint
https://berlin-transport.mcp-tools.app/mcpMCP Clients
Claude Desktop
{
"mcpServers": {
"berlin-transport": {
"command": "npx",
"args": [
"mcp-remote",
"https://berlin-transport.mcp-tools.app/mcp"
]
}
}
}