用于Mapbox API的MCP服务器。
mapbox_directions
coordinates ({latitude: number, longitude: number}[])profile(可选):"driving-traffic", "driving", "walking", "cycling"mapbox_directions_by_places
places (string[]):地点名称数组profile(可选):"driving-traffic", "driving", "walking", "cycling"language(可选):两位字母的语言代码(例如:"zh", "en")mapbox_matrix
coordinates ({latitude: number, longitude: number}[])profile(可选):"driving", "walking", "cycling"annotations(可选):"duration", "distance", "duration,distance"sources(可选):源坐标的索引destinations(可选):目标坐标的索引mapbox_matrix_by_places
places (string[]):地点名称数组(2-25个地点)profile(可选):"driving", "walking", "cycling"annotations(可选):"duration", "distance", "duration,distance"language(可选):两位字母的语言代码sources(可选):源地点的索引destinations(可选):目标地点的索引mapbox_geocoding
searchText (string):要搜索的地点或地址limit(可选):结果的最大数量(1-10)types(可选):按地点类型过滤(国家、地区、地点等)language(可选):两位字母的语言代码fuzzyMatch(可选):启用/禁用模糊匹配在您的 Claude Desktop 配置文件中添加此配置(通常位于 ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"mapbox-mcp-server": {
"command": "node",
"args": ["/absolute/path/to/mapbox-mcp-server/build/index.js"],
"env": {
"MAPBOX_ACCESS_TOKEN": "your-api-key"
}
}
}
}
按照此处的说明获取 Mapbox API 密钥。
设置您的 API 密钥作为环境变量:
export MAPBOX_ACCESS_TOKEN=your_api_key_here
在 mapbox-mcp-server 中,我们使用以下结构来管理服务器的处理器:
src/server/handlers/base.ts:所有处理器的基础类src/server/registry.ts:所有处理器的注册表src/server/main.ts:服务器的主要入口点每个功能模块遵循以下结构:
src/
├── types/ # 类型定义
├── schemas/ # Zod 验证模式
├── tools/
│ ├── definitions/ # 工具定义
│ └── handlers/ # 工具实现
└── server/
└── handlers/ # 处理器类
类图:

流程图:

所有工具都实现了全面的错误处理:
此 MCP 服务器根据 MIT 许可证发布。这意味着您可以自由地使用、修改和分发该软件,但需遵守 MIT 许可证中的条款和条件。更多详情,请参阅项目存储库中的 LICENSE 文件。