一个全面的模型上下文协议(MCP)服务器,提供访问27个英国政府数据源和服务。适用于Claude Desktop和其他兼容MCP的客户端。 注意:这是一个业余项目,大约80%是用Vibe编码的,可能会有问题,仅用于演示目的。
尝试: “距离SW1A 1AA最近的五个邮编是什么?” “下一个银行假日是什么时候?” “我如何从Brixton到St Pancras?” “Circle线的状态是什么?” “我最近的医院在哪里?” “我的议员是谁?” “他们的投票记录是什么?”
等等。
# 克隆仓库
git clone https://github.com/YOUR_USERNAME/govmcp.git
cd govmcp
# 安装依赖
pip install -e .
# 或者安装开发依赖
pip install -e ".[dev]"
在项目根目录创建一个.env文件:
# Companies House工具所需
COMPANIES_HOUSE_API_KEY=your_companies_house_key
# EPC工具所需
EPC_API_KEY=your_email:your_epc_key
# 可选(没有密钥也可以工作,但速率限制较低)
TFL_API_KEY=your_tfl_key
必需的API(2个):
可选的API(1个):
无需密钥(24个工具): 邮编查询、食品卫生、银行假日、Gov.uk搜索、洪水预警、警察犯罪、法院、慈善机构、NHS、立法、CQC、议会工具
添加到你的claude_desktop_config.json:
{
"mcpServers": {
"gov-uk": {
"command": "python",
"args": ["-m", "gov_uk_mcp.server"],
"env": {
"COMPANIES_HOUSE_API_KEY": "your_key_here",
"EPC_API_KEY": "your_email:your_key_here"
}
}
}
}
python -m gov_uk_mcp.server
get_tube_status - 所有地铁线路状态get_line_status - 特定线路状态plan_journey - 行程规划,带逐步方向get_bike_points - Santander自行车点可用性get_road_status - 主要道路状况search_stops - 查找公交站、车站等search_companies, get_company, get_company_officers, get_company_filing_historysearch_charities, get_charitylookup_postcode, nearest_postcodessearch_food_establishments, get_flood_warnings, get_crime_by_postcodefind_gp_surgeries, find_hospitals, find_pharmaciessearch_cqc_providers, get_cqc_providerfind_mp, search_hansard, get_voting_recordsearch_divisions, search_questions, get_questions_by_mpsearch_epc_by_postcode, find_courts, search_govuk, get_bank_holidays, search_legislation# 运行所有测试
pytest
# 带覆盖率报告
pytest --cov=gov_uk_mcp --cov-report=html
# 特定测试
pytest tests/test_validation.py -v
MIT - 详见LICENSE
为英国开发者社区打造 🇬🇧