🌍 MCP本地化引擎
通过MCP(模型上下文协议)获取174个地区的全球定位数据
  
🎯 这是什么?
一个模型上下文协议(MCP)服务器,为全球174个地区提供全面的本地化数据。非常适合需要生成适应文化的多语言内容的AI代理和应用程序。
✨ 特性
- 174当地人:覆盖欧洲、亚洲、美洲、中东、非洲和大洋洲
- 3个MCP工具:
- get_locale_config:技术元数据(时区、货币、脚本等) - get_cultural_data:文化适应数据(价值观、基调、参考文献) - get_rules:全球规则(slug生成、SEO、内容改编)
- 智能缓存:24小时TTL,命中率98%
- 快速:2-5ms响应时间(缓存),50ms(冷)
- 生产就绪:经过验证的模式、错误处理、全面测试
🚀 快速开始
安装
# Clone the repository
git clone https://github.com/supernovae/mcp-localization-engine.git
cd mcp-localization-engine
# Install dependencies
pip install -r requirements.txt
# Verify installation
python src/server.py --version运行MCP服务器
# Start the server
python src/server.py
# Output:
# 🚀 MCP-Localization-Engine v1.0.0
# 📂 Loaded 174 locales
# 💾 Cache initialized (TTL: 24h)
# ✅ Server ready on stdio使用Claude Desktop进行配置
macOS:
nano ~/Library/Application\ Support/Claude/claude_desktop_config.jsonLinux:
nano ~/.config/Claude/claude_desktop_config.json窗户:
notepad %APPDATA%\Claude\claude_desktop_config.json添加此配置:
{
"mcpServers": {
"localization": {
"command": "python",
"args": ["/ABSOLUTE/PATH/TO/mcp-localization-engine/src/server.py"]
}
}
}⚠️ 替换 /ABSOLUTE/PATH/TO/ 与你的实际路径!
重新启动克劳德桌面 加载配置。
克劳德测试
打开克劳德并尝试:
"Use the localization MCP to get the configuration for French (France)"克劳德应该打电话来 get_locale_config("fr-FR") 并返回技术数据!
📚 文档
🔧 用法示例
from src.loader import load_locale_config, load_cultural_data
# Get technical config
config = load_locale_config("ja-JP")
print(config["timezone"]) # "Asia/Tokyo"
print(config["currency"]) # "JPY"
print(config["script"]) # "CJK"
# Get cultural data
cultural = load_cultural_data("ja-JP")
print(cultural["cultural_values"]) # ["Harmony (和)", "Respect for hierarchy", ...]
print(cultural["tone_preferences"]["business"]) # "Formal, polite, humble"🌍 支持的地区
174个地区 穿过:
- 🇪🇺 欧洲:75个地区
- 🌏 亚洲:45个地区
- 🌎 美洲:20个地区
- 🌍 中东:20个地区
- 🌍 非洲:9个地区
- 🇦🇺 大洋洲:5个地区
🧪 测试
# Run all tests
pytest tests/
# Run with coverage
pytest tests/ --cov=src --cov-report=html
# Validate all locale data
python tests/validate_data.py
# Run specific test
pytest tests/test_tools.py -v🛠️ 发展
# Install dev dependencies
pip install -r requirements-dev.txt
# Generate a new locale template
python scripts/generate_locale.py pt-BR
# List all locales
python scripts/list_locales.py
# Benchmark performance
python scripts/benchmark.py📊 项目统计
- 代码:约1000行Python
- 数据:约4.5 MB(174个配置+174个文化+3个规则)
- 测试:20多个测试用例
- 缓存命中率: 98%
- 响应时间:2-5ms(缓存),50ms(冷)
🤝 贡献
我们欢迎捐款!看 贡献.md 作为指导方针。
添加新区域设置
- 生成模板:
python scripts/generate_locale.py xx-YY - 填写数据
data/locales/config/xx-YY.json和data/locales/cultural/xx-YY.json - 验证:
python tests/validate_data.py --locale xx-YY - 提交PR
📄 许可证
MIT许可证-请参阅 许可证
🔗 链接
💡 用例
- 内容生成:生成适应文化的营销内容
- 搜索引擎优化:获取特定于区域的SEO规则
- URL生成:根据地区生成适当的蛞蝓
- 文化适应:避免文化失礼
- 多项目:满足您所有本地化需求的共享基础
🏢 由SuperNovae工作室建造
由以下材料制成❤️ 面向全球开发者社区。
______________________________________________________________________
