OParl MCP Server
Provides AI models with seamless access to OParl parliamentary data APIs through the Model Context Protocol. Enables natural language queries for parliamentary meetings, documents, organizations, representatives, and other government data across multiple OParl implementations.
README
<div align="center">
OParl MCP Server
<img src="assets/images/oparl-logo.png" alt="OParl Logo" width="120" height="120" style="margin-right: 20px;"> <img src="assets/images/fastmcp-logo.png" alt="FastMCP Logo" width="200" height="80">
A Model Context Protocol (MCP) server for accessing OParl parliamentary data APIs
📚 Documentation • 🚀 Quick Start • 🏛️ OParl API • 🔧 Configuration • 🐳 Docker
</div>
⚠️ Project Status
This project is currently in development and requires additional validation and testing. While the core functionality is implemented, it has not been thoroughly tested in production environments. Please use with caution and report any issues you encounter.
🎯 Overview
The OParl MCP Server provides AI models and applications with seamless access to OParl parliamentary data APIs through the Model Context Protocol. It enables natural language queries and structured access to parliamentary information systems across multiple implementations.
✨ Features
- 🔌 MCP Integration: Full Model Context Protocol compliance
- 🏛️ OParl 1.1 Support: Complete support for all OParl object types
- 🌐 Multi-Implementation: Works with various OParl implementations
- 🔐 Authentication: Flexible API key and Bearer token support
- 📊 Rich Data Access: Parliamentary meetings, documents, organizations, and more
- 🔍 Advanced Search: Query parameters and filtering capabilities
- 🐳 Docker Ready: Containerized deployment with Docker Compose
- 🧪 Comprehensive Testing: Unit tests and integration tests included
- 📚 Extensive Documentation: Complete API reference and usage guides
🏛️ OParl API
The server provides access to all standard OParl 1.1 object types:
| Object Type | Description | Key Properties |
|---|---|---|
| System | Root system information | oparlVersion, body, created |
| Body | Parliamentary bodies | name, shortName, organization |
| Organization | Political parties & groups | name, shortName, member |
| Person | Representatives & officials | name, givenName, familyName |
| Meeting | Parliamentary sessions | name, start, end, location |
| AgendaItem | Meeting topics | name, meeting, order |
| Paper | Documents & resolutions | name, reference, date |
| Consultation | Public consultations | name, paper, start, end |
| File | Attachments & media | name, mimeType, accessUrl |
| Location | Meeting venues | name, geojson, postalCode |
🚀 Quick Start
Prerequisites
- Python 3.11 or higher
- pip (Python package manager)
Installation
-
Clone the repository
git clone https://github.com/jtwolfe/oparl-mcp-server.git cd oparl-mcp-server -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install dependencies
pip install -r requirements.txt -
Run the server
python -m oparl_mcp.server
Development Setup
For development, install additional dependencies:
pip install -r requirements-dev.txt
⚙️ Configuration
The server can be configured using environment variables or programmatically:
Environment Variables
export OPARL_BASE_URL="https://api.oparl.org"
export OPARL_API_KEY="your-api-key" # Optional
export OPARL_TIMEOUT="30.0"
export OPARL_LOG_LEVEL="INFO"
export OPARL_SERVER_NAME="OParl MCP Server"
Programmatic Configuration
from oparl_mcp import OParlConfig, OParlMCPServer
# Create configuration
config = OParlConfig(
base_url="https://oparl.muenchen.de",
api_key="your-munich-api-key",
timeout=60.0,
server_name="Munich OParl Server"
)
# Create and run server
server = OParlMCPServer(config)
server.run()
🌍 OParl Implementations
The server works with various OParl implementations:
| Implementation | URL | Description |
|---|---|---|
| Generic OParl API | https://api.oparl.org |
Standard OParl implementation |
| Munich City Council | https://oparl.muenchen.de |
Munich parliamentary data |
| Cologne City Council | https://oparl.koeln.de |
Cologne parliamentary data |
| Hamburg Parliament | https://oparl.hamburg.de |
Hamburg parliamentary data |
Each implementation may have different:
- Authentication requirements
- Available data
- API endpoints
- Rate limits
🐳 Docker
Using Docker Compose
-
Create environment file
cp .env.example .env # Edit .env with your configuration -
Run with Docker Compose
docker-compose -f docker/docker-compose.yml up -d
Using Docker directly
# Build the image
docker build -f docker/Dockerfile -t oparl-mcp-server .
# Run the container
docker run -p 8000:8000 \
-e OPARL_BASE_URL=https://api.oparl.org \
-e OPARL_API_KEY=your-key \
oparl-mcp-server
📖 Usage Examples
Basic MCP Client Usage
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def main():
async with stdio_client(StdioServerParameters(
command="python",
args=["-m", "oparl_mcp.server"]
)) as (read, write):
async with ClientSession(read, write) as session:
# List all meetings
meetings = await session.list_resources()
print(f"Found {len(meetings)} resources")
# Get specific meeting
meeting = await session.read_resource("oparl_meeting_123")
print(f"Meeting: {meeting['name']}")
Advanced Configuration
from oparl_mcp import OParlMCPServer, OParlConfig
# Custom configuration for Munich
config = OParlConfig(
base_url="https://oparl.muenchen.de",
api_key="your-munich-api-key",
timeout=45.0,
server_name="Munich OParl MCP Server"
)
server = OParlMCPServer(config)
info = server.get_server_info()
print(f"Server: {info['name']}")
print(f"Features: {info['features']}")
🧪 Testing
Run the comprehensive test suite:
# Run all tests
pytest
# Run with coverage
pytest --cov=oparl_mcp --cov-report=html
# Run specific test file
pytest tests/test_server.py
# Run integration tests
python test_integration.py
📚 Documentation
Comprehensive documentation is available at https://jtwolfe.github.io/oparl-mcp-server/:
- Getting Started - Quick setup and basic usage
- OParl API Guide - Complete OParl API reference
- FastMCP Integration - Technical integration details
- Architecture - System design and data flow
- API Reference - Complete API documentation
- Contributing - Development and contribution guide
🔧 MCP Components
Resources
- System Information: Root system data and metadata
- Body Collections: Lists of parliamentary bodies
- Meeting Schedules: Upcoming and past meetings
- Document Collections: Papers and reports
- Person Profiles: Elected officials and staff
Resource Templates
- Individual Objects: Specific meetings, people, papers, etc.
- Parameterized Access: Dynamic resource access with IDs
- Structured Data: Consistent data format across all objects
Tools
- Search Operations: Find specific data across the system
- Filter Operations: Filter data by various criteria
- Export Operations: Export data in different formats
🏗️ Architecture
The server uses FastMCP to transform the OParl API into MCP-compatible components:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ AI Model │ │ MCP Client │ │ MCP Server │
│ │◄──►│ │◄──►│ (FastMCP) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ OParl API │
│ (HTTP/REST) │
└─────────────────┘
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Install development dependencies:
pip install -r requirements-dev.txt - Make your changes
- Add tests for new functionality
- Run the test suite:
pytest - Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- OParl Initiative for the standardized parliamentary data API
- FastMCP for the excellent MCP framework
- Model Context Protocol for the AI integration standard
- The open-source community for inspiration and support
📞 Support
- Documentation: https://jtwolfe.github.io/oparl-mcp-server/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
🔗 Related Projects
- OParl Specification - Official OParl documentation
- FastMCP Framework - MCP server generation framework
- Model Context Protocol - AI integration standard
<div align="center">
Made with ❤️ for open government and AI accessibility
</div>
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。