N7M-提名MCP服务器
 
基于模型上下文协议的人工智能地理编码
N7M通过模型上下文协议(MCP)提供OpenStreetMap的Nomination地理编码服务,使AI助手能够将地址转换为坐标、搜索位置并执行反向地理编码。
特性
- 位置搜索 -查找任何地址或位置名称的坐标
- 反向地理编码 -将坐标转换为详细地址
- OSM查找 -获取特定OpenStreetMap对象的详细信息
- 速率限制 -自动遵守Nominim的1个要求/秒政策
- 全球覆盖 -基于OpenStreetMap的全球数据
- 异步设计 -使用现代异步Python构建
入门指南
使用N7M的最快方法是 uvx (无需安装):
适用于克劳德桌面
将此添加到您的MCP设置文件中:
{
"mcpServers": {
"n7m": {
"command": "uvx",
"args": ["n7m-mcp"]
}
}
}快速测试
配置后,询问您的AI助手:
"Find the coordinates for the Eiffel Tower"
"What's the address at coordinates 40.7128, -74.0060?"
"Search for coffee shops near Times Square, NYC"使用示例
搜索位置
# Ask your AI: "Find the White House"
# Returns: coordinates, address, and details逆地理编码
# Ask your AI: "What's at 51.5074 N, 0.1278 W?"
# Returns: Detailed address for London coordinatesOSM查找
# Ask your AI: "Look up OSM relation R146656"
# Returns: Details for New York City环境变量
使用环境变量配置N7M行为(全部使用 N7M_ 前缀):
| 变量 | 默认值 | 描述 |
|---|---|---|
N7M_NOMINATIM_BASE_URL | https://nominatim.openstreetmap.org | 指定服务器URL |
N7M_REQUEST_TIMEOUT | 30 | 请求超时(秒) |
N7M_USER_AGENT | n7m-mcp/0.1.0 | API请求的用户代理 |
N7M_LOG_LEVEL | 信息 | 日志记录级别 |
码头工人
在容器中运行N7M:
# Pull the image
docker pull ghcr.io/jonpspri/n7m-mcp:latest
# Run with stdio transport
docker run -i ghcr.io/jonpspri/n7m-mcp:latest
# Run with HTTP transport
docker run -p 8000:8000 ghcr.io/jonpspri/n7m-mcp:latest --transport http --host 0.0.0.0发展
# Clone the repository
git clone https://github.com/jonpspri/n7m-mcp.git
cd n7m-mcp
# Install dependencies
uv sync
# Run the server locally
uv run n7m-mcp
# Run tests
uv run pytest
# Run quality checks
uv run ruff check
uv run mypy src/n7m/速率限制
N7M自动执行Nominim的每秒1个请求的使用策略。所有请求都受到费率限制,以确保符合OpenStreetMap的合理使用准则。
数据归因
所有地理编码数据均来自OpenStreetMap贡献者。使用N7M时,您访问的数据来自:
版权所有OpenStreetMap贡献者
在向最终用户显示结果时,请包含此归因。
许可证
Apache 2.0-请参阅 许可证 文件。
支持
- 问题:
- 仓库:
