政府数据协议服务器

Gov.uk MCP Server是一个全面的模型上下文协议(MCP)服务器,提供对27个英国政府数据源和服务的访问,适用于Claude Desktop和其他MCP兼容客户端。

  • by Stealth-Labs-LTD
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 brummiesteven/GovUK-MCP

使用说明

Gov.uk MCP服务器

一个全面的模型上下文协议(MCP)服务器,提供对27个英国政府数据源和服务的访问。专为Claude Desktop和其他MCP兼容客户端构建。

注: 这是一个业余项目,预计会出现问题,仅供演示之用。

🌟 特性

  • 33个政府API:公司大厦、议会、英国国家医疗服务体系、交通部等
  • 15个视觉小部件:通过MCP应用程序实现数据可视化的丰富UI组件
  • 生产就绪:全面的输入验证、错误清理、速率限制
  • 类型安全:使用正则表达式模式进行完全输入验证
  • 安全:山宁泰错误、XSS保护、原产地验证
  • 快速:批量操作的并发执行(投票记录)

💬 示例提示

试着问:

  • “距离SW1A 1AA最近的五个邮政编码是什么?”
  • “下一个银行假日是什么时候?”
  • “我怎样才能从布里克斯顿到圣潘克拉斯?”
  • “环线的状态如何?”
  • “我最近的医院在哪里?”
  • “谁是我的议员?”
  • “他们的投票记录是什么?”

📦 安装

# Clone the repository
git clone https://github.com/brummiesteven/GovUK-MCP.git
cd GovUK-MCP

# Install dependencies
pip install -e .

# Or with dev dependencies
pip install -e ".[dev]"

🔑 API密钥设置

创建一个 .env 项目根目录中的文件:

# Required for Companies House tools
COMPANIES_HOUSE_API_KEY=your_companies_house_key

# Required for EPC tools
EPC_API_KEY=your_email:your_epc_key

# Optional (works without but has lower rate limits)
TFL_API_KEY=your_tfl_key

API关键要求

所需API (2):

  • API公司大厦: https://developer.company-information.service.gov.uk/
  • EPC API: https://epc.opendatacommunities.org/

可选API (1):

  • 伦敦交通局API: https://api-portal.tfl.gov.uk/(无钥匙工作,但有费率限制)

无需钥匙 (24个工具): 邮政编码、食品卫生、银行假日、Gov.uk搜索、洪水警告、警察犯罪、法院、慈善机构、英国国家医疗服务体系、立法、CQC、议会工具

🚀 用法

使用Claude桌面版

添加到您的 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

🛠️ 可用工具(33)

交通(6)

  • get_tube_status -所有管路状态
  • get_line_status -具体线路状态
  • plan_journey -带分步指导的行程计划
  • get_bike_points -桑坦德自行车可用性
  • get_road_status -主要道路状况
  • search_stops -查找公交车站、车站等。

商业与金融(6)

  • search_companies, get_company, get_company_officers, get_company_filing_history
  • search_charities, get_charity

地理位置(5)

  • lookup_postcode, nearest_postcodes
  • search_food_establishments, get_flood_warnings, get_crime_by_postcode

医疗保健(5)

  • find_gp_surgeries, find_hospitals, find_pharmacies
  • search_cqc_providers, get_cqc_provider

议会(5)

  • find_mp, search_hansard, get_voting_record
  • search_divisions, search_questions, get_questions_by_mp

其他服务(4)

  • search_epc_by_postcode, find_courts, search_govuk, get_bank_holidays, search_legislation

🎨 MCP应用程序小部件

此服务器包括15个与兼容的可视化小部件 MCP应用程序-启用客户端。小工具为API响应提供了丰富的交互式可视化。

小部件 描述
tube-status 伦敦地铁线路颜色状态
postcode-lookup 位置信息网格
company-info 公司简介卡
food-hygiene FSA评级与评分指标
flood-warnings 环境局警报
mp-info MP个人资料,带有照片和派对颜色
bank-holidays 即将到来的假期日历
crime-stats 按类别分列的犯罪情况
cqc-rating 护理质量评级显示
charity-info 慈善委员会详情
voting-record 议会投票历史
bike-points 桑坦德自行车可用性
journey-planner 伦敦交通局一步一步的旅程
road-status 主要道路状况
nhs-services 全科医生、医院、药房查找者

当从兼容客户端调用工具时,小部件会自动提供服务。

🧪 测试

# Run all tests
pytest

# With coverage
pytest --cov=gov_uk_mcp --cov-report=html

# Specific test
pytest tests/test_validation.py -v

📝 许可证

麻省理工学院-见 许可证

🙏 学分

  • 主控程序 通过Anthropic
  • 英国政府开放数据API
  • Python生态系统

专为英国开发者社区打造 🇬🇧