trips-flights

trips-flights

Enables tracking flights and grouping them into trips, with tools to create, list, and manage trips and flight bookings.

Category
访问服务器

README

trips-app

Tracks flights and groups them into trips, with a CLI and an MCP server on top of a shared repository layer. Runs against its own isolated Postgres instance (Docker) — does not touch any pre-existing travel schema/database.

Stack

  • Node.js + TypeScript (ESM)
  • pg (node-postgres) for DB access
  • node-pg-migrate for git-committed schema migrations
  • commander for the CLI
  • @modelcontextprotocol/sdk for the MCP server (stdio transport)
  • zod for input validation
  • vitest for tests

Database

This app owns a dedicated Postgres instance, started via Docker:

docker compose up -d

This starts a postgres:16-alpine container (trips-postgres) on port 5433, with a persistent named volume trips_pgdata. Schema/tables live under the trips schema inside a database also named trips — fully separate from any other database/schema on the host or in other containers.

Copy .env.example to .env and adjust DATABASE_URL if needed. If running the app from another container on the same Docker host, put both containers on a shared user-defined network (e.g. docker network create trips-net, then docker network connect trips-net <container> for both) so the hostname trips-postgres resolves via Docker's embedded DNS.

Setup

docker compose up -d postgres
docker compose run --rm migrate

Migrations

Migrations live in migrations/ and are committed to git. node-pg-migrate config is in .node-pg-migraterc.json (targets the trips schema for both the migrated objects and the pgmigrations bookkeeping table's search path via PGSCHEMA).

Migrations run inside a container (migrate service, profile tools), built from the same image as app/mcp, connecting to the postgres service over the shared trips-net network — no host Node/npx required:

docker compose run --rm migrate                    # apply all pending migrations (up)
docker compose run --rm migrate down                # roll back the most recent migration
docker compose run --rm migrate create <name>       # scaffold a new migration

Current migrations:

  1. 1700000000001_create-trips.cjs — creates the trips schema and trips.trips table.
  2. 1700000000002_create-flights.cjs — creates trips.flights (with trip_id FK, a status CHECK constraint restricting to confirmed | not_flown | cancelled | completed, and indexes on trip_id, status, departure_datetime).

CLI

npm run cli -- trip create --name "Europe Spring 2026" --start 2026-03-18 --end 2026-05-29
npm run cli -- trip list
npm run cli -- trip show 1

npm run cli -- flight add --number UA70 --from EWR --to AMS \
  --departure 2026-03-18T18:35:00Z --airline "United Airlines" \
  --booking-ref H59RC5 --trip 1

npm run cli -- flight list
npm run cli -- flight list --status not_flown
npm run cli -- flight assign <flightId> <tripId>
npm run cli -- flight mark-not-flown <flightId>
npm run cli -- flight mark-flown <flightId>
npm run cli -- flight delete <flightId>

MCP Server

npm run build
node dist/mcp/server.js

Or for local development without building: npm run mcp (runs via tsx).

Registering with Hermes (containerized, project convention)

Per project convention this MCP server must run inside its container (via docker compose run), not as a bare host node process. Register it with the Hermes CLI:

hermes mcp add trips-flights --command docker --args \
  compose -f /mnt/appdata/hermes/repos/trips-app/docker-compose.yml run --rm -T mcp

Notes:

  • --args takes space-separated tokens (NOT a single comma/space-joined string) — Hermes execs command directly without a shell, so --command "docker compose ... run --rm mcp" as one string will fail with "Connection closed". Split it: command: docker, and put the rest in --args.
  • The -T flag on docker compose run disables pseudo-TTY allocation, required for stdio-based MCP transport to work over the piped stdin/stdout.
  • Verify with hermes mcp test trips-flights and hermes mcp list.
  • Start a new Hermes session (/reset) after registering for the tools to become available.

Exposed tools: list_trips, get_trip, create_trip, list_flights, create_flight, assign_flight_to_trip, mark_flight_not_flown, mark_flight_flown, delete_flight.

Seed Data

migrations/seed_real_data.sql re-creates the real trips/flights from the original data (5 trips, 20 flights, including the 3 genuinely not_flown bookings). It's a plain SQL script, not a node-pg-migrate migration — running it truncates and reinserts, so it's idempotent but destructive to any other data you've added by hand.

docker cp migrations/seed_real_data.sql trips-postgres:/tmp/seed_real_data.sql
docker exec trips-postgres psql -U trips -d trips -f /tmp/seed_real_data.sql

Tests

Locally (against the containerized Postgres on localhost:5433):

npm test

Or fully inside a container (no host Node/npx needed), connected to the postgres service over the shared trips-net network:

docker compose run --rm test

This builds the test target of the Dockerfile (same base image as app/mcp, plus tests/ and dev dependencies) and runs npm test (vitest run) inside the container.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选