GovUK MCP Server
Provides access to 27 UK government data sources and services, enabling queries about transport, business, healthcare, and more via natural language.
README
Gov.uk MCP Server
A comprehensive Model Context Protocol (MCP) server providing access to 27 UK government data sources and services. Built for Claude Desktop and other MCP-compatible clients.
Note: This is a hobby project, expect issues and use for demonstration purposes only.
🌟 Features
- 33 Government APIs: Companies House, Parliament, NHS, Transport, and more
- 15 Visual Widgets: Rich UI components via MCP Apps for data visualization
- Production-Ready: Comprehensive input validation, error sanitization, rate limiting
- Type-Safe: Full input validation with regex patterns
- Secure: Sanitized errors, XSS protection, origin validation
- Fast: Concurrent execution for bulk operations (voting records)
💬 Example Prompts
Try asking:
- "What are the five nearest postcodes to SW1A 1AA?"
- "When is the next Bank Holiday?"
- "How can I get from Brixton to St Pancras?"
- "What's the status of the Circle Line?"
- "Where's my nearest Hospital?"
- "Who's my MP?"
- "What's their voting record?"
📦 Installation
# 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 Keys Setup
Create a .env file in the project root:
# 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 Key Requirements
Required APIs (2):
- Companies House API: https://developer.company-information.service.gov.uk/
- EPC API: https://epc.opendatacommunities.org/
Optional APIs (1):
- TfL API: https://api-portal.tfl.gov.uk/ (works without key but has rate limits)
No Key Required (24 tools): Postcode, Food Hygiene, Bank Holidays, Gov.uk Search, Flood Warnings, Police Crime, Courts, Charity, NHS, Legislation, CQC, Parliamentary tools
🚀 Usage
With Claude Desktop
Add to your 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"
}
}
}
}
Standalone (For Development)
python -m gov_uk_mcp.server
🛠️ Available Tools (33)
Transport (6)
get_tube_status- All Tube lines statusget_line_status- Specific line statusplan_journey- Journey planner with step-by-step directionsget_bike_points- Santander Cycles availabilityget_road_status- Major road conditionssearch_stops- Find bus stops, stations, etc.
Business & Finance (6)
search_companies,get_company,get_company_officers,get_company_filing_historysearch_charities,get_charity
Location & Geographic (5)
lookup_postcode,nearest_postcodessearch_food_establishments,get_flood_warnings,get_crime_by_postcode
Healthcare (5)
find_gp_surgeries,find_hospitals,find_pharmaciessearch_cqc_providers,get_cqc_provider
Parliamentary (5)
find_mp,search_hansard,get_voting_recordsearch_divisions,search_questions,get_questions_by_mp
Other Services (4)
search_epc_by_postcode,find_courts,search_govuk,get_bank_holidays,search_legislation
🎨 MCP Apps Widgets
This server includes 15 visual widgets compatible with MCP Apps-enabled clients. Widgets provide rich, interactive visualizations of API responses.
| Widget | Description |
|---|---|
tube-status |
London Underground status with line colors |
postcode-lookup |
Location information grid |
company-info |
Companies House profile card |
food-hygiene |
FSA ratings with score indicators |
flood-warnings |
Environment Agency alerts |
mp-info |
MP profile with photo and party colors |
bank-holidays |
Upcoming holidays calendar |
crime-stats |
Crime breakdown by category |
cqc-rating |
Care quality ratings display |
charity-info |
Charity Commission details |
voting-record |
Parliamentary voting history |
bike-points |
Santander Cycles availability |
journey-planner |
TfL journey with step-by-step |
road-status |
Major road conditions |
nhs-services |
GP, hospital, pharmacy finder |
Widgets are automatically served when tools are called from compatible clients.
🧪 Testing
# Run all tests
pytest
# With coverage
pytest --cov=gov_uk_mcp --cov-report=html
# Specific test
pytest tests/test_validation.py -v
📝 License
MIT - see LICENSE
🙏 Credits
- MCP by Anthropic
- UK Government Open Data APIs
- Python ecosystem
Built for the UK developer community 🇬🇧
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。