解锁韩国旅游的魅力,直接集成到您的AI助手!该项目提供了一个由官方韩国旅游局(KTO)API驱动的模型上下文协议(MCP)服务器。为您的AI装备发现韩国各地丰富多彩的节日、宁静的寺庙、美味的餐厅、舒适的住宿等的能力。
链接:
在开始之前,您必须从韩国旅游局(KTO)数据门户获得一个API密钥。
areaBasedList、searchKeyword、detailCommon等信息的服务)。您需要申请以下API来为每种语言进行请求。
- 英语: https://www.data.go.kr/data/15101753/openapi.do
- 日语: https://www.data.go.kr/data/15101760/openapi.do
- 简体中文: https://www.data.go.kr/data/15101764/openapi.do
- 繁体中文: https://www.data.go.kr/data/15101769/openapi.do
- 俄语: https://www.data.go.kr/data/15101831/openapi.do
- 西班牙语: https://www.data.go.kr/data/15101811/openapi.do
- 德语: https://www.data.go.kr/data/15101805/openapi.do
- 法语: https://www.data.go.kr/data/15101808/openapi.do
您可以使用uv(一个快速的Python包安装器和运行器)或Docker来运行此MCP服务器。
要通过Smithery自动安装Claude Desktop的韩国旅游API MCP服务器:
npx -y @smithery/cli install @harimkang/mcp-korea-tourism-api --client claude
uv(推荐用于本地开发)克隆仓库:
git clone https://github.com/harimkang/mcp-korea-tourism-api.git
cd mcp-korea-tourism-api
设置API密钥环境变量:
将"YOUR_KTO_API_KEY"替换为您实际获得的密钥。
# 在macOS/Linux上
export KOREA_TOURISM_API_KEY="YOUR_KTO_API_KEY"
# 在Windows(命令提示符)上
# set KOREA_TOURISM_API_KEY="YOUR_KTO_API_KEY"
# 在Windows(PowerShell)上
# $env:KOREA_TOURISM_API_KEY="YOUR_KTO_API_KEY"
注意:为了持久存储,请将此行添加到您的shell配置文件中(例如,.zshrc、.bashrc,或者使用系统环境变量设置)。
安装依赖项并运行服务器:
此命令使用uv基于uv.lock(如果可用)或pyproject.toml安装依赖项,然后运行服务器模块。
# 使用uv安装依赖项
uv sync
# 默认:stdio传输(适用于MCP客户端)
uv run -m mcp_tourism.server
# HTTP传输,适用于Web应用程序
uv run -m mcp_tourism.server --transport streamable-http --host 127.0.0.1 --port 8000
# SSE传输,适用于实时应用程序
uv run -m mcp_tourism.server --transport sse --host 127.0.0.1 --port 8080
# 使用环境变量
export MCP_TRANSPORT=streamable-http
export MCP_HOST=0.0.0.0
export MCP_PORT=3000
uv run -m mcp_tourism.server
服务器将启动并监听指定传输协议的MCP请求。
克隆仓库:
git clone https://github.com/harimkang/mcp-korea-tourism-api.git
cd mcp-korea-tourism-api
构建Docker镜像: 您可以使用不同的传输配置构建镜像:
# 默认构建(stdio传输)
docker build -t mcp-korea-tourism-api .
# 构建带有HTTP传输配置
docker build -t mcp-korea-tourism-api \
--build-arg MCP_TRANSPORT=streamable-http \
--build-arg MCP_HOST=0.0.0.0 \
--build-arg MCP_PORT=8000 \
--build-arg MCP_PATH=/mcp \
--build-arg MCP_LOG_LEVEL=INFO \
.
# 构建带有SSE传输配置
docker build -t mcp-korea-tourism-api \
--build-arg MCP_TRANSPORT=sse \
--build-arg MCP_HOST=0.0.0.0 \
--build-arg MCP_PORT=8080 \
.
运行Docker容器: 您可以使用不同的传输配置运行容器:
Stdio传输(默认-适用于MCP客户端):
docker run --rm -it \
-e KOREA_TOURISM_API_KEY="YOUR_KTO_API_KEY" \
mcp-korea-tourism-api
HTTP传输(适用于Web应用程序):
# 使用运行时环境变量
docker run --rm -p 8000:8000 \
-e KOREA_TOURISM_API_KEY="YOUR_KTO_API_KEY" \
-e MCP_TRANSPORT=streamable-http \
-e MCP_HOST=0.0.0.0 \
-e MCP_PORT=8000 \
mcp-korea-tourism-api
# 检查健康状况:curl http://localhost:8000/health
SSE传输(适用于实时应用程序):
docker run --rm -p 8080:8080 \
-e KOREA_TOURISM_API_KEY="YOUR_KTO_API_KEY" \
-e MCP_TRANSPORT=sse \
-e MCP_HOST=0.0.0.0 \
-e MCP_PORT=8080 \
mcp-korea-tourism-api
使用Docker Compose(推荐):
# 复制并配置环境变量
cp docker.env.example .env
# 编辑.env文件,填写您的API密钥和首选设置
# 使用HTTP传输(默认配置文件)
docker-compose up mcp-tourism-http
# 使用SSE传输
docker-compose --profile sse up mcp-tourism-sse
# 开发设置,带调试日志
docker-compose --profile dev up mcp-tourism-dev
韩国旅游API MCP服务器支持多种传输协议以适应不同的使用场景:
stdio(默认):标准输入/输出传输,直接集成MCP客户端
streamable-http:基于HTTP的传输,适用于Web应用程序
http://localhost:8000/mcpsse:服务器发送事件传输,适用于实时应用程序
http://localhost:8080/mcp您可以使用命令行参数或环境变量来配置服务器:
| 设置 | CLI参数 | 环境变量 | 默认值 | 描述 |
|---|---|---|---|---|
| 传输 | --transport | MCP_TRANSPORT | stdio | 使用的传输协议 |
| 主机 | --host | MCP_HOST | 127.0.0.1 | HTTP传输的主机地址 |
| 端口 | --port | MCP_PORT | 8000 | HTTP传输的端口 |
| 路径 | --path | MCP_PATH | /mcp | HTTP端点的路径 |
| 日志级别 | --log-level | MCP_LOG_LEVEL | INFO | 日志级别 |
# 获取所有可用选项的帮助
python -m mcp_tourism.server --help
# 使用自定义端口的HTTP传输运行
python -m mcp_tourism.server --transport streamable-http --port 3000 --log-level DEBUG
# 使用SSE传输运行
python -m mcp_tourism.server --transport sse --host 0.0.0.0 --port 8080
# 设置环境变量
export MCP_TRANSPORT=streamable-http
export MCP_HOST=0.0.0.0
export MCP_PORT=8000
export MCP_LOG_LEVEL=INFO
export KOREA_TOURISM_API_KEY="your_api_key_here"
# 运行服务器
python -m mcp_tourism.server
对于HTTP和SSE传输,健康检查端点位于/health:
# 检查服务器健康状况
curl http://localhost:8000/health
# 示例响应
{
"status": "healthy",
"service": "Korea Tourism API MCP Server",
"transport": "streamable-http",
"timestamp": 1640995200.0
}
要在Cursor中使用此MCP服务器:
确保Docker容器可运行: 按照上述Docker安装步骤构建镜像(mcp-korea-tourism-api)。您不需要手动运行容器;Cursor会执行此操作。
找到您的mcp.json文件: 此文件配置Cursor中的MCP工具。通常可以通过Cursor的设置找到,或者可能在类似~/.cursor/mcp.json的路径下。
添加或更新MCP配置: 在您的mcp.json文件列表中添加以下JSON对象。如果您已经有此工具的条目,请更新其command。将"YOUR_KTO_API_KEY"替换为您实际的密钥。

{
"mcpServers": {
"korea-tourism": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"KOREA_TOURISM_API_KEY=YOUR_KTO_API_KEY",
"mcp-korea-tourism-api"
]
}
}
}
或者使用uv [本地目录]
{
"mcpServers": {
"korea-tourism": {
"command": "uv",
"args": [
"--directory",
"{LOCAL_PATH}/mcp-korea-tourism-api",
"run",
"-m",
"mcp_tourism.server"
],
"env": {
"KOREA_TOURISM_API_KEY": "YOUR_KTO_API_KEY"
}
}
}
}
保存mcp.json。
重启Cursor或重新加载MCP工具: Cursor现在应该检测到该工具,并在需要时使用Docker运行它。
此服务器向AI助手提供了以下工具:
search_tourism_by_keyword:使用关键词搜索旅游信息(例如,“景福宫”,“拌饭”)。按内容类型、地区代码过滤。

get_tourism_by_area:按地理区域代码浏览旅游信息(例如,首尔='1')。按内容类型、区代码过滤。

find_nearby_attractions:发现靠近特定GPS坐标的旅游景点(经度,纬度)。按半径和内容类型过滤。

search_festivals_by_date:查找在指定日期范围内发生的节日(YYYYMMDD)。按地区代码过滤。

find_accommodations:搜索酒店、民宿等。按地区和区代码过滤。

get_detailed_information:使用内容ID检索详细信息(概述、使用时间、停车场等)。按内容类型过滤。

get_tourism_images:使用内容ID获取特定旅游项目的图片URL。

get_area_codes:检索城市/省份的区域代码,以及可选的子区域(区)代码。

uv方法)uv (pip install uv)集成此MCP的AI助手可以处理如下查询: