MCP 地理编码器罗塞塔项目致力于为采用不同编程语言和地理编码服务实现的 MCP(机器学习控制协议)地理编码工具打造一个统一的接口。它支持三种实现方式,能满足多样化的开发需求。
git clone git@github.com:yourusername/mcp-geocoder-rosetta.git
cd mcp-geocoder-rosetta
pip install googlemaps
npm install typescript @types/node @googlemaps/google-maps-services-js --save
在项目根目录下创建 .env 文件,并添加以下内容:
GOOGLE_MAPS_API_KEY=你的API密钥
uv run --with mcp[cli] mcp run path/to/python-urllib/geocoder.py
uv run --with mcp[cli] --with googlemaps mcp run path/to/python-googlemaps/gecoder.py
npx tsx path/to/typescript/googlemaps/gecoder.ts
git clone git@github.com:yourusername/mcp-geocoder-rosetta.git
cd mcp-geocoder-rosetta
pip install googlemaps
npm install typescript @types/node @googlemaps/google-maps-services-js --save
在项目根目录下创建 .env 文件,添加以下内容:
GOOGLE_MAPS_API_KEY=你的API密钥
uv run --with mcp[cli] mcp run path/to/python-urllib/geocoder.py
uv run --with mcp[cli] --with googlemaps mcp run path/to/python-googlemaps/gecoder.py
npx tsx path/to/typescript/googlemaps/gecoder.ts
编辑 claude_desktop_config.json 文件,在 mcpServers 下添加以下内容:
"GeocoderNode": {
"command": "npx",
"args": [
"tsx",
"/path/to/mcp-gecoder-rosetta/typescript-googlemaps/gecoder.ts"
],
"env": {
"GOOGLE_MAPS_API_KEY": "your-api-key-here"
}
}
"GeocoderGoogle": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"--with",
"googlemaps",
"mcp",
"run",
"/path/to/mcp-gecoder-rosetta/python-googlemaps/gecoder.py"
],
"env": {
"GOOGLE_MAPS_API_KEY": "your-api-key-here"
}
}
"GeocoderREST": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"/path/to/mcp-gecoder-rosetta/python-urllib/gecoder.py"
],
"env": {
"GOOGLE_MAPS_API_KEY": "your-api-key-here"
}
}
⚠️ 重要提示
- 一次仅安装一个地理编码实现,以避免工具歧义问题。
- 使用绝对路径配置 MCP 工具。
- 确保 JSON 配置格式正确(无尾随逗号,缩进正确)。
本项目遵循 MIT 许可证。详细信息请查看 LICENSE 文件。
仓库包含多个 temp/ 目录,用于动态生成测试和调试脚本:
/temp/:根临时目录,供主要测试脚本使用。python-urllib/temp/:用于测试 urllib 实现的脚本。python-googlemaps/temp/:用于测试 Google Maps API 实现的脚本。typescript-googlemaps/temp/:用于 TypeScript 测试工具。这些目录已添加到 .gitignore,请勿提交到仓库。
mcp-client/)已弃用,不再维护。