旅行计划MCP服务器

一个为孟加拉国科克斯巴扎尔提供旅行规划工具和天气信息的模型上下文协议(MCP)服务器,内置AI行程生成和天气资源功能。

  • by code4mk
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 code4mk/coxs-bazar-itinerary-mcp-server

使用说明

生产就绪的MCP沸腾板

Cox's Bazar人工智能路线MCP服务器

一个模型上下文协议(MCP)服务器,为孟加拉国科克斯巴扎尔提供旅行计划工具和天气信息。建于 FastMCP 并由管理 紫外线.

特性

  • 气候资源:温度预报和详细的天气信息
  • 行程工具:人工智能驱动的旅行行程生成
  • 旅游提示:预先配置的旅行计划提示
  • 身份验证支持:通过Clerk进行可选身份验证(可通过env配置)
  • 速率限制:内置限速中间件
  • Docker就绪:包括生产Dockerfile
  • 装订和格式化:Ruff+预提交钩子(参见 _docs/lint-formatting.md)

需求

  • Python 3.13+
  • 紫外线 (包管理器)
  • Node.js 20+(仅适用于MCP检查器)

入门指南

# Install dependencies
uv sync

# Copy environment variables and configure
cp .env.example .env

# (Optional) Install pre-commit git hooks
uv run pre-commit-install

CLI命令

所有命令都在中注册 pyproject.toml 并可通过 uv run:

命令 描述
uv run mcp-server 启动MCP服务器
uv run mcp-server-dev 在开发模式下启动MCP服务器(自动重新加载)
uv run mcp-inspector 启动MCP检查器UI(需要Node.js 20+)
uv run lint 对所有文件运行预提交钩子(lint+format)
uv run pre-commit-install 在git仓库中安装预提交挂钩

开发服务器

通过自动重新加载启动MCP服务器 看门狗:

uv run mcp-server-dev
# or
./scripts/run-mcp-server.sh

MCP检查员

启动交互式MCP Inspector UI以测试工具、资源和提示:

uv run mcp-inspector
# or
./scripts/run-inspector.sh

装订和格式化

# Run lint + format via pre-commit
uv run lint

# Or run individually
./scripts/lint.sh       # ruff check . --fix
./scripts/format.sh     # ruff format .

看 _docs/lint-formatting.md 了解完整的配置详细信息。

测试

./scripts/test.sh

看 _docs/testing.md 用于测试惯例和夹具。

码头工人

docker build -t mcp-server .
docker run mcp-server

服务器通过运行 uv run mcp-server 在容器内。运输和港口可通过环境变量进行配置(TRANSPORT_NAME, SERVER_PORT, SERVER_HOST).

项目结构

.
├── src/mcp_server/
│   ├── server.py                  # Main server entry point
│   ├── mcp_instance.py            # FastMCP instance & auth config
│   ├── cli.py                     # CLI command definitions
│   ├── config/
│   │   ├── auth_provider.py       # Auth provider factory
│   │   └── custom_routes.py       # Custom HTTP routes
│   ├── handlers/                  # MCP handler registrations (auto-discovered)
│   │   ├── tools/
│   │   │   ├── auth_additional.py
│   │   │   └── itinerary.py
│   │   ├── resources/
│   │   │   └── weather.py
│   │   └── prompts/
│   │       └── travel_prompts.py
│   ├── models/
│   │   └── itinerary_models.py    # Pydantic models & schemas
│   ├── services/
│   │   └── itenerary_service.py   # Business logic
│   ├── lib/
│   │   ├── clerk_auth_provider.py # Clerk OAuth provider
│   │   └── httpx_client.py        # Async HTTP client wrapper
│   ├── prompt_templates/
│   │   └── travel.py              # Prompt text builders
│   └── utils/
│       ├── elicitation.py
│       ├── get_weather_forecast.py
│       ├── helpers.py
│       └── http.py
├── tests/
│   ├── conftest.py
│   ├── fixtures/
│   │   ├── context.py
│   │   └── weather.py
│   ├── unit/
│   │   ├── test_auth_additional_tools.py
│   │   ├── test_auth_provider.py
│   │   ├── test_elicitation.py
│   │   ├── test_helpers.py
│   │   ├── test_itinerary_service_extra.py
│   │   ├── test_itinerary_tool_handler.py
│   │   ├── test_models.py
│   │   ├── test_server.py
│   │   ├── test_travel_prompts.py
│   │   ├── test_travel_prompts_handler.py
│   │   ├── test_weather_forecast.py
│   │   └── test_weather_resource.py
│   └── integration/
│       ├── test_itinerary_tool.py
│       └── test_weather_api.py
├── scripts/
│   ├── run-mcp-server.sh          # Dev server with auto-reload
│   ├── run-inspector.sh           # MCP Inspector launcher
│   ├── test.sh                    # Test runner
│   ├── lint.sh                    # Ruff lint --fix
│   ├── format.sh                  # Ruff format
│   └── generate-secrets.sh        # Secret key generator
├── _docs/                         # Documentation & ADRs
│   ├── adr/
│   │   ├── 001-choose-fastmcp.md
│   │   ├── 002-choose-httpx.md
│   │   └── ADR-template.md
│   ├── auth-provider-auth0.md
│   ├── httpx-client.md
│   ├── lint-formatting.md
│   ├── remote-mcp-connect.md
│   └── testing.md
├── .env.example                   # Environment variables template
├── .pre-commit-config.yaml        # Pre-commit hook config
├── Dockerfile                     # Production Docker image
├── pyproject.toml                 # Project config & dependencies
├── ruff.toml                      # Ruff linter/formatter config
├── pytest.ini                     # Pytest configuration
├── glama.json                     # Glama registry config
└── LICENSE                        # MIT License

文档

文档 描述
_docs/lint-formatting.md Ruff和预提交配置
_docs/testing.md 测试设置、夹具和惯例
_docs/httpx-client.md 异步HTTP客户端使用
_docs/auth-provider-auth0.md 身份验证提供者集成
_docs/remote-mcp-connect.md 远程MCP连接指南
_docs/adr/ 架构决策记录

许可证

麻省理工学院