Skip to main content

酒店搜索 MCP 服务:搜索周边酒店,获取价格、评分、类型等信息

Project description

酒店搜索 MCP Server

基于 MCP (Model Context Protocol) 的酒店搜索服务,整合高德地图和百度地图数据,提供酒店价格、评分、类型等信息。

功能特性

  • ✅ 搜索周边酒店(基于高德地图 API)
  • ✅ 获取酒店价格信息(来自百度地图)
  • ✅ 显示酒店评分(高德+百度双评分)
  • ✅ 展示酒店类型(星级、快捷、民宿等)
  • ✅ 支持价格范围筛选
  • ✅ 自动按距离排序
  • ✅ 支持 stdio 和 SSE 两种运行模式

安装

使用 uv(推荐)

# 安装并运行(stdio 模式)
uvx hotel-search-mcp

# 或使用 uv tool
uv tool run hotel-search-mcp

使用 pip

安装基础版本

pip install hotel-search-mcp

安装完整版本(包含 SSE 支持)

pip install hotel-search-mcp[sse]

使用方法

  1. Stdio 模式(用于 Cursor、Claude Desktop) 在 Cursor 中配置 编辑 .cursor/mcp.json 或全局配置:
{
  "mcpServers": {
    "hotel-search": {
      "command": "uvx",
      "args": ["hotel-search-mcp"],
      "env": {
        "AMAP_API_KEY": "your_amap_api_key_here"
      }
    }
  }
}

在 Claude Desktop 中配置 编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "hotel-search": {
      "command": "uvx",
      "args": ["hotel-search-mcp"],
      "env": {
        "AMAP_API_KEY": "your_amap_api_key_here"
      }
    }
  }
}
  1. SSE 模式(用于百炼平台、Web 应用) 启动 SSE 服务器
# 设置环境变量
export AMAP_API_KEY="your_amap_api_key_here"

启动服务

hotel-search-mcp --mode sse --host 0.0.0.0 --port 8000 在阿里云百炼平台配置 部署服务到云服务器或函数计算 在百炼平台"MCP 广场"中创建自定义 MCP 服务 配置为 HTTP 模式,填写服务 URL:http://your-server:8000/sse 工具说明 search_hotels 搜索指定地点周边的酒店信息。

参数:

city (必填): 城市名称,如"杭州"、"上海" address (必填): 具体地址或地标,如"西湖"、"外滩" min_price (可选): 最低价格(元/晚) max_price (可选): 最高价格(元/晚) radius (可选): 搜索半径(米),默认 10000 max_results (可选): 返回结果数量,默认 20

示例:

{
  "city": "杭州",
  "address": "西湖",
  "min_price": 300,
  "max_price": 500,
  "max_results": 10
}

返回结果:

{
  "success": true,
  "搜索时间": "2024-01-20 10:30:00",
  "城市": "杭州",
  "地址": "西湖",
  "总数量": 45,
  "返回数量": 10,
  "酒店列表": [
    {
      "名称": "西湖国宾馆",
      "地址": "杭州市西湖区...",
      "距离": "500米",
      "电话": "0571-12345678",
      "高德评分": "4.8",
      "百度评分": "4.7",
      "参考价格": "¥450",
      "评论数": "1200条",
      "高德类型": "星级酒店",
      "百度类型": "五星级酒店",
      "坐标": "120.123,30.456"
    }
  ]
}

环境变量

AMAP_API_KEY: 高德地图 API Key(必需)

开发

bash

克隆仓库

git clone https://github.com/yourusername/hotel-search-mcp.git cd hotel-search-mcp

安装开发依赖

pip install -e ".[sse,dev]"

运行测试

pytest

代码格式化

black src/ ruff check src/ 许可证 MIT License

作者 Your Name - your.email@example.com

5. LICENSE

MIT License

Copyright (c) 2024 Your Name

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hotel_search_mcp-1.0.4.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hotel_search_mcp-1.0.4-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file hotel_search_mcp-1.0.4.tar.gz.

File metadata

  • Download URL: hotel_search_mcp-1.0.4.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for hotel_search_mcp-1.0.4.tar.gz
Algorithm Hash digest
SHA256 ae913f8a4ac1857efd7688f9427e4385e66093d08753d1c8a4645b9b6cc42cc1
MD5 1c14a4cf5f16b63d9d7ccb389d33083b
BLAKE2b-256 4755c389da841a198ff938265fa78f88a1d1322f71859939df8a71f162d4d68c

See more details on using hashes here.

File details

Details for the file hotel_search_mcp-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for hotel_search_mcp-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4f696a948a214a65f1f7366e9b2eedc6970d22b45a2ed91e1fda7777b0ce918d
MD5 6c87d5fc474e6ad8fd1dc7a4d108244a
BLAKE2b-256 dab4ae1d7d534fb2875d8a06dc567c5e31375f3edeb1adfee0019edf0cea01c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page