一个提供菲律宾标准地理编码(PSGC)API访问的模型上下文协议(MCP)服务器,提供菲律宾的分层地理数据。
npm install -g psgc-mcp
添加到您的MCP配置文件中:
{
"mcpServers": {
"psgc-mcp": {
"command": "npx",
"args": ["-y", "psgc-mcp"],
"transport": "stdio"
}
}
}
添加到您的Claude Desktop配置中:
{
"mcpServers": {
"psgc-mcp": {
"command": "npx",
"args": ["-y", "psgc-mcp"],
"transport": "stdio"
}
}
}
npm installnpm run buildnpm start该服务器提供了一整套工具来访问PSGC数据,按地理级别分类。
get_island_groups:列出所有群岛。get_island_group:通过其代码(例如:"luzon")获取特定群岛。get_island_group_regions:获取特定群岛内的所有地区。get_island_group_provinces:获取特定群岛内的所有省份。get_island_group_districts:获取特定群岛内的所有区。get_island_group_cities:获取特定群岛内的所有城市。get_island_group_municipalities:获取特定群岛内的所有镇。get_island_group_cities_municipalities:获取特定群岛内的所有城市和镇。get_island_group_sub_municipalities:获取特定群岛内的所有次镇。get_island_group_barangays:获取特定群岛内的所有巴朗吉。get_regions:列出所有地区。get_region:通过其代码(例如:"130000000")获取特定地区。get_region_provinces:获取特定地区内的所有省份。get_region_districts:获取特定地区内的所有区。get_region_cities:获取特定地区内的所有城市。get_region_municipalities:获取特定地区内的所有镇。get_region_cities_municipalities:获取特定地区内的所有城市和镇。get_region_sub_municipalities:获取特定地区内的所有次镇。get_region_barangays:获取特定地区内的所有巴朗吉。get_provinces:列出所有省份。get_province:通过其代码(例如:"012800000")获取特定省份。get_province_cities:获取特定省份内的所有城市。[...]:其他工具类似。get_districts:列出所有区。get_district:通过其代码(例如:"133900000")获取特定区。[...]:其他工具类似。get_cities:列出所有城市。get_city:通过其代码(例如:"012805000")获取特定城市。get_city_barangays:获取特定城市内的所有巴朗吉。get_municipalities:列出所有镇。get_municipality:通过其代码(例如:"012801000")获取特定镇。get_municipality_barangays:获取特定镇内的所有巴朗吉。get_sub_municipalities:列出所有次镇。get_sub_municipality:通过其代码(例如:"133901000")获取特定次镇。get_sub_municipality_barangays:获取特定次镇内的所有巴朗吉。get_cities_municipalities:列出所有城市和镇。get_city_municipality:通过其代码获取特定城市或镇。get_city_municipality_barangays:获取特定城市或镇内的所有巴朗吉。get_barangays:列出所有巴朗吉。get_barangay:通过其代码(例如:"012805001")获取特定巴朗吉。search_by_name:通过名称在所有层级中搜索地理实体。get_hierarchy:获取特定PSGC代码的完整层次。validate_code:验证地理代码是否存在并获取其详情。{
"tool": "get_regions",
"arguments": {}
}
{
"tool": "get_provinces",
"arguments": {
"region_code": "130000000"
}
}
{
"tool": "search_by_name",
"arguments": {
"query": "Manila",
"type": "city"
}
}
{
"tool": "get_hierarchy",
"arguments": {
"code": "133900000"
}
}
服务器连接到官方PSGC API位于https://psgc.gitlab.io/api/。
PSGC代码遵循分层格式:
git clone https://github.com/your-username/psgc-mcp.git
cd psgc-mcp
npm install
npm run build
npm run dev
npm test
npm run inspect
git checkout -b feature-namenpm testgit commit -am '添加功能'git push origin feature-nameMIT许可证 - 详情见LICENSE文件。
对于问题和疑问,请在GitHub仓库上打开一个issue。 </中文翻译>