Skip to main content

酒店搜索 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.

Metadata

Release files for hotel-search-mcp 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hotel-search-mcp 1.0.6
File Size Uploaded Provenance
hotel_search_mcp-1.0.6.tar.gz 12.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hotel-search-mcp 1.0.6
File Interpreter ABI Platform
hotel_search_mcp-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 23.9 kB

Release files / hotel_search_mcp-1.0.6.tar.gz

Download URL hotel_search_mcp-1.0.6.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
21e344290943e42e6cbc5f17dbcebc39f929e6cebea2d790fc0d253a13ed7f41
BLAKE2b-256 checksum
How to use checksums
648f8851e6fec56de0ef66b75b506231a5d688e1c54fb7375c1752e2e5d6b1db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / hotel_search_mcp-1.0.6-py3-none-any.whl

Download URL hotel_search_mcp-1.0.6-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8248b0ccaac702c28e49f3ed66ed926a6b3a5a9b5b060d874c831e7000e6e89e
BLAKE2b-256 checksum
How to use checksums
ffd8be90d005b4938cf70ccf9e7a0aa6061fabbb1ade24da8a420701394b5938
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Security for hotel-search-mcp 1.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page