Trip Planner

Trip Planner

MCP server for creating day-by-day trip itineraries in SQLite, with a planner agent that uses a Tavily search scout via tool boundaries. Enforces guard rails like rejecting activities on out-of-range days.

Category
访问服务器

README

Trip Planner — two agents, one enforced boundary

A trip planner built on the Model Context Protocol. You name a place and a number of days; a planner agent researches it and builds a real day-by-day itinerary in SQLite.

The interesting part isn't that it plans trips. It's how the two agents are kept apart.

The boundary

Local Scout  ──▶  tavily-mcp          can search the web, cannot touch the trip
Planner      ──▶  itinerary_server    can write the trip, has no internet

The Planner has no search tool. Its only route to the outside world is calling research_place — which is the Scout, attached to it as an ordinary tool via .as_tool(). The Scout, in turn, has no itinerary tools, so it structurally cannot write to the trip no matter what it decides to do.

Neither restriction is a prompt. Each agent is handed a different set of MCP servers, and that's the whole enforcement mechanism. Prompts can be talked around; a tool that isn't in the list cannot be called.

Guard rails live in the server

add_activity rejects a day outside the trip's length:

> add_activity(trip_id=1, day=99, title="...")
Rejected: Day 99 is outside this 3-day trip - use a day from 1 to 3

That check is in db.py, not in the instructions. The agent gets a real error back and has to correct itself — which it does.

Setup

uv sync
cp .env.example .env      # add your keys

Two keys are needed: OPENAI_API_KEY (or another provider via PLANNER_MODEL) and TAVILY_API_KEY for the Scout's search. npx must be on your PATH — the Tavily MCP server runs through it.

Run it

uv run main.py              # create a trip, plan it, print it
uv run main.py --list       # list existing trips
uv run main.py --show 1     # re-print one itinerary

Point it at a different model with one env var:

PLANNER_MODEL=gpt-4o-mini

What a run looks like

Two days in Porto, planned from scratch:

=== Trip 2: Porto, Portugal (2 days) ===

Day 1
  - São Bento Railway Station
      Iconic tiled station hall and an easy first stop in the historic centre.
      Allow 15–20 minutes. No booking needed.
  - Sé do Porto (Porto Cathedral)
      Main old-city cathedral and a strong historic anchor. Allow 30–45 minutes.
  - Ribeira
      Porto's classic riverfront old quarter. Allow 1–2 hours.
  - Palácio da Bolsa
      Ornate 19th-century interiors; one of the best paid visits in the centre.
      Book ahead for guided tours.
  - Torre dos Clérigos
      The classic bell tower and city panorama. Booking ahead helps at busy times.

Day 2
  - Dom Luís I Bridge
  - Port wine cellars in Vila Nova de Gaia
  - Jardim do Morro
  - Jardins do Palácio de Cristal

Day 1 is the historic centre, Day 2 is Gaia and the west side — grouped so a day doesn't zig-zag across the city.

The MCP server

Tool What it does
get_itinerary(trip_id) The trip, its days, and every activity grouped by day
add_activity(trip_id, day, title, details) Adds one activity — rejects out-of-range days
remove_activity(activity_id) Removes one by id

It speaks stdio, so the agent launches it as a subprocess. The Scout's server, tavily-mcp, is filtered down to just tavily_search — hiding crawl, map and extract keeps its tool list small and its behaviour predictable.

Layout

db.py                 SQLite schema and access — trips, activities, guard rails
itinerary_server.py   MCP server: the only way the trip gets written
planner.py            Scout on Tavily, wrapped via .as_tool(); Planner on itinerary
main.py               CLI

Four files, about 330 lines.

Notes

  • The project sets link-mode = "copy" and passes UV_LINK_MODE=copy to every spawned MCP server, so it works on a cloud-synced drive (OneDrive, Dropbox), where uv's default hardlinking fails with os error 396.
  • main.py reconfigures stdout to UTF-8 — accented place names would otherwise print as mojibake in the Windows console.

Verified

Both parts were tested for real, not assumed:

  • The MCP server over stdio: tool listing, an itinerary read, and the day guard rail correctly rejecting day=99 on a 3-day trip.
  • A full end-to-end run on a 2-day Porto trip — the Scout searched, the Planner wrote nine activities, grouped geographically, with booking notes on the two that need them.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选