OpenMapTiles MCP服务器
模型上下文协议(MCP)服务器,用于从OpenMapTiles兼容的矢量图块服务中高效提取海岸线数据。
特性
- 🌊 从水多边形边界提取海岸线
- 🚀 并行瓷砖抓取以获得更好的性能
- 💾 智能缓存可减少API调用
- 🔄 自动提供程序回退
- 📏 基于缩放的简化
- 🏝️ 岛屿海岸线探测
安装
来自存储库
# Clone the repository
git clone https://github.com/your-username/openmaptiles-mcp.git
cd openmaptiles-mcp
# Install dependencies
npm install
# Build the project
npm run build在Claude Desktop中安装
- 从源代码构建 (如果尚未完成):
npm install
npm run build- 添加到Claude桌面配置:
编辑您的Claude Desktop配置文件:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 窗户: %APPDATA%\Claude\claude_desktop_config.json - Linux: ~/.config/Claude/claude_desktop_config.json
将服务器添加到MCP服务器列表中:
{
"mcpServers": {
"openmaptiles": {
"command": "node",
"args": ["/absolute/path/to/openmaptiles-mcp/dist/index.js"],
"env": {
"MAPTILER_API_KEY": "your-optional-api-key"
}
}
}
}替换 /absolute/path/to/openmaptiles-mcp 使用克隆存储库的实际路径。
- 重新启动克劳德桌面 加载新的MCP服务器。
在Claude代码中安装
使用Claude Code CLI添加服务器:
# Add to current project
claude mcp add openmaptiles --scope project -- node /path/to/openmaptiles-mcp/dist/index.js
# Add globally for all projects
claude mcp add openmaptiles --scope user -- node /path/to/openmaptiles-mcp/dist/index.js
# With environment variables
claude mcp add openmaptiles -e MAPTILER_API_KEY=your_key --scope project -- node /path/to/openmaptiles-mcp/dist/index.js
# Using npx (if published to npm)
claude mcp add openmaptiles --scope project -- npx openmaptiles-mcp
# Verify installation
claude mcp list用法
作为MCP服务器
npm start发展
npm run devMCP工具
get_coastline_by_bounds
检索地理边界框内的海岸线矢量。
{
"bounds": {
"minLat": 37.7,
"maxLat": 37.8,
"minLon": -122.5,
"maxLon": -122.4
},
"zoom": 12,
"simplify": true,
"includeIslands": true,
"page": 1,
"limit": 50
}获取水特征
从矢量图块中获取原水多边形特征。
{
"bounds": {
"minLat": 37.7,
"maxLat": 37.8,
"minLon": -122.5,
"maxLon": -122.4,
"zoom": 12
},
"page": 1,
"limit": 50
}提取废水
将水多边形特征转换为海岸线LineStrings。
{
"waterFeatures": [...],
"includeIslands": true
}get_tile_info
计算给定位置的图块坐标和覆盖范围。
{
"lat": 37.7749,
"lon": -122.4194,
"zoom": 12
}simplify_coastline
将Douglas-Peucker简化应用于海岸线特征。
{
"features": {...},
"zoom": 12
}环境变量
MAPTILER_API_KEY-MapTiler回退提供程序的可选API密钥MAX_MEMORY_CACHE-最大内存缓存大小(MB)(默认值:100)REQUEST_TIMEOUT-平铺请求超时(毫秒)(默认值:5000)
发展
# Run tests
npm test
# Run linting
npm run lint
# Type checking
npm run typecheck
# Format code
npm run format测试
# Unit tests
npm run test:unit
# E2E tests
npm run test:e2e
# All tests with coverage
npm run test:all数据提供程序
- OpenFreeMap (主要)-无需身份验证
- 多功能 (次要)-无需身份验证
- MapTiler (回退)-需要API密钥
许可证
麻省理工学院
