npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@chrislaughlin/bus-tracker-mcp

v1.0.1

Published

MCP server for bus departures (home↔bar)

Readme

bus-tracker-mcp

MCP (Model Context Protocol) server that exposes a small set of tools to fetch scheduled bus departures for two directions: home→bar and bar→home.

This repository contains a tiny MCP server that can be run from the CLI (stdin/stdout transport) or started programmatically from other Node code. It normalizes remote departure JSON into a tolerant, predictable shape and exposes both machine-friendly structured results and short human-readable text.

Key files

  • package.json — project scripts & dependencies
  • tsconfig.json — TypeScript config
  • src/cli.ts — CLI entrypoint that starts the MCP server via stdin/stdout
  • src/server.ts — implementation of the MCP tools (exports createServer and fetchDepartures)

What it does

  • Starts an MCP server named bus-tracker-mcp.
  • Registers a primary tool bus_departures which accepts an enum input (homeToBar or barToHome) and returns structured departure data.
  • Registers two convenience alias tools: home_to_bar_departures and bar_to_home_departures.

Install & run

Prerequisites

  • Node.js (LTS recommended) and npm installed.

Development (no build)

# install deps
npm ci

# run in dev mode (uses tsx to run src/cli.ts)
npm run dev

Build and run

# build TypeScript to dist/
npm run build

# run the built CLI directly
node dist/cli.js

# or install locally and run the CLI globally
npm link
bus-tracker-mcp

Using in VS Code

Add the below to the mcp.json config file.

"bus-tracker": {
    "command": "npx",
    "args": ["-y", "@chrislaughlin/bus-tracker-mcp@latest"]
}

You can run and debug the server easily from Visual Studio Code. Here are a few recommended steps and a sample launch configuration.

  1. Open the project folder in VS Code (File → Open...).
  2. Make sure Node.js is installed and npm ci has been run once to install dependencies.
  3. Use the integrated terminal to run the dev script:
npm run dev
  1. (Optional) Add a debug launch configuration so you can start the server from the Run view and see output in the integrated terminal. Create a .vscode/launch.json with the following configuration:
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Run bus-tracker-mcp (dev)",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "npm",
      "runtimeArgs": ["run", "dev"],
      "console": "integratedTerminal",
      "cwd": "${workspaceFolder}"
    }
  ]
}
  1. Start the configuration from the Run and Debug panel (select Run bus-tracker-mcp (dev) and press the green play button). Your server will start in the integrated terminal and communicate over stdin/stdout.

Notes about VS Code environment:

  • You don't need special VS Code extensions to run the server, but extensions that improve Node.js/TypeScript editing (ESLint, TypeScript Hero, npm scripts) can help.
  • If you prefer to run the built JS, change the launch configuration to run node against dist/cli.js after npm run build.

Programmatic usage

You can import and start the server programmatically via the exported factory in src/server.ts:

import { createServer } from './src/server.js';

const server = createServer();
// attach an MCP transport (the CLI uses stdio) and start sending requests

Examples

  1. Dev run (stdin/stdout transport)
  • Start the server:
npm run dev
  • The server uses the stdio transport (see src/cli.ts) and communicates over stdin/stdout using MCP.
  1. Example tool response (structured)

The tools return a result object with both human-readable content and structuredContent. The structuredContent looks like:

{
  "departures": [
    {
      "scheduled": "2025-11-06T18:30:00.000Z",
      "dueMinutes": 12,
      "raw": { "departureTimePlanned": "...", "departureTimeBaseTimetable": "...", "runningLate": false }
    }
  ],
  "meta": { "count": 1 }
}
  1. Example human-readable text returned inside content (simplified)
Departures (homeToBar) — 2 result(s)
 @ 18:30 (due in 12 min)
 @ 19:05 (due in 47 min)

Notes

  • The network fetch logic lives in fetchDepartures (src/server.ts) and normalizes incoming JSON into a tolerant shape (see normalizeDepartures in src/server.ts).
  • The MCP server is implemented using @modelcontextprotocol/sdk (see src/server.ts).

If you need a client example that talks MCP to this server, pick any MCP-compatible client transport and connect to the CLI/stdin-stdout process started with bus-tracker-mcp (or run the server programmatically with createServer and attach your transport).