- name
- riksdag-regering-mcp
- description
- Riksdag-Regering MCP server with 32 specialized tools for Swedish political data (Parliament, Government, MPs, votes, documents)
- license
- Apache-2.0
# Riksdag-Regering MCP Server
## 🔴 AI FIRST Quality Principle
> **Apply the AI FIRST principle: never accept first-pass quality. Minimum 2 iterations. Read all output, improve every section. No shortcuts.**
## Purpose
Provide comprehensive access to Swedish political data through the `riksdag-regering-mcp` Model Context Protocol (MCP) server. Enables intelligence operatives and political analysts to query, analyze, and visualize data from the Swedish Riksdag (Parliament) and Regeringen (Government).
## Core Principles
1. **Authoritative Data Source**: Official Swedish government data (data.riksdagen.se, regeringen.se)
2. **Comprehensive Coverage**: 50+ years of historical data (1971-2024)
3. **Structured API**: 32 specialized tools for different data types
4. **Real-Time Access**: Latest parliamentary and government activities
5. **GDPR Compliance**: Public interest basis (Article 6(1)(e)), no personal data beyond official capacity
6. **Multi-Source Integration**: Riksdag documents + Government publications
7. **Quantitative Context Handoff**: Pair parliamentary evidence with SCB/Riksbank helper outputs when domestic economic transmission matters; keep IMF as cross-country macro canon and SCB/Riksbank as Swedish ground truth.
## Available Tools (32 Total)
### 🔍 Search & Discovery (6 tools)
- **search_ledamoter**: Search for MPs (349 members) by name, party, constituency
- **search_dokument**: Search parliamentary documents (motions, bills, reports)
- **search_dokument_fulltext**: Full-text search across document content
- **search_anforanden**: Search speeches and parliamentary debates
- **search_voteringar**: Search voting records and roll calls
- **search_regering**: Search government documents (propositions, SOU, Dir)
### 📊 Detailed Information (6 tools)
- **get_dokument**: Get complete document with metadata and content
- **get_ledamot**: Get MP profile with assignments, activities, bio
- **get_dokument_innehall**: Get document content and summary
- **get_g0v_document_content**: Get government document in Markdown
- **get_discussion**: Get specific discussion thread
- **get_discussion_comments**: Get comments from a discussion
### 📝 Parliamentary Documents (6 tools)
- **get_motioner**: Latest motions (proposals from MPs)
- **get_propositioner**: Latest government propositions
- **get_betankanden**: Latest committee reports
- **get_fragor**: Latest written questions
- **get_interpellationer**: Latest interpellations (formal questions)
- **get_utskott**: List parliamentary committees (15 committees)
### 🏛️ Government Documents (4 tools)
- **get_regering_document**: Get government document by ID
- **summarize_regering_document**: AI-powered government document summary
- **get_g0v_document_types**: List available government document types
- **get_g0v_category_codes**: List government policy area codes
### 📈 Analytics & Aggregation (5 tools)
- **get_voting_group**: Get votes grouped by party/constituency
- **list_reports**: List available statistical reports
- **fetch_report**: Get statistical report (MP stats, committee data)
- **analyze_g0v_by_department**: Analyze government documents by department
- **get_g0v_latest_update**: Check latest government data update
### 🔄 Advanced Queries (5 tools)
- **fetch_paginated_documents**: Batch fetch with pagination
- **fetch_paginated_anforanden**: Batch fetch speeches
- **batch_fetch_documents**: Multi-year document batches
- **get_calendar_events**: Parliamentary calendar (debates, committees)
- **enhanced_government_search**: Combined Riksdag + Government search
## Data Coverage
### Swedish Riksdag (Parliament)
- **349 MPs**: Current members across 8 parties
- **15 Committees**: AU, FiU, JuU, KU, SkU, SfU, UU, UtU, etc.
- **Documents**: 50+ years (1971-2024)
- Motions (mot): MP proposals
- Propositions (prop): Government bills
- Reports (bet): Committee reports
- Questions (fr): Written questions
- Interpellations (ip): Formal questions
- **Votes**: Complete voting records with party/MP breakdown
- **Speeches**: Parliamentary debates (anföranden)
### Swedish Government (Regeringen)
- **Document Types**: Propositions, SOU (state investigations), Dir (committee directives), DS (department series), Remisser (referrals)
- **Departments**: All 10 ministries
- **Historical Data**: Government documents from 1990s+
- **G0V Integration**: Markdown-formatted documents via g0v.se
### 8 Parliamentary Parties
- **S** - Socialdemokraterna (Social Democrats)
- **M** - Moderaterna (Moderates)
- **SD** - Sverigedemokraterna (Sweden Democrats)
- **MP** - Miljöpartiet (Green Party)
- **C** - Centerpartiet (Centre Party)
- **V** - Vänsterpartiet (Left Party)
- **KD** - Kristdemokraterna (Christian Democrats)
- **L** - Liberalerna (Liberals)
## When to Use
- **Political Intelligence**: Analyze voting patterns, coalition behavior
- **Legislative Monitoring**: Track bills, motions, committee work
- **MP Analysis**: Profile MPs, track activities, voting discipline
- **Coalition Analysis**: Assess government stability, party cooperation
- **Policy Research**: Trace policy development through documents
- **Voting Analysis**: Party cohesion, rebels, cross-party voting
- **Government Oversight**: Track government proposals, investigations
- **Electoral Research**: Historical trends, party evolution
- **Transparency Dashboards**: Real-time political metrics
- **Risk Assessment**: Identify democratic accountability gaps
- **Economic Transmission Analysis**: Combine Riksdag measures with `scripts/scb-fetch.ts` KPI/AKU/HEK/fuel presets and `scripts/riksbank-fetch.ts` policy-rate/minutes context for Swedish-specific impact estimates.
## Calling MCP Tools in Agentic Workflows
In gh-aw agentic workflows, MCP tools are called **directly by name** without any prefix. The MCP gateway routes to the correct server automatically:
```javascript
// Direct tool calls in agentic workflows (no prefix needed):
get_sync_status({}) // Health check — ALWAYS call first
get_propositioner({ rm: "2025/26", limit: 20 }) // Government propositions
get_betankanden({ rm: "2025/26", limit: 20 }) // Committee reports
search_dokument({ doktyp: "prop", rm: "2025/26" }) // Search documents
search_voteringar({ rm: "2025/26", parti: "S" }) // Search votes
get_calendar_events({ from: "2026-04-01", tom: "2026-04-30" }) // Calendar events
```
> **⚠️ Tool names use underscores** (e.g., `get_sync_status`, NOT `get-sync-status`).
> The gateway at `http://host.docker.internal:$MCP_GATEWAY_PORT/mcp/riksdag-regering` (port `8080` for gh-aw v0.69+, port `80` for legacy gh-aw <0.69 — resolved dynamically by `mcp-setup.sh`) handles routing.
> See [`.github/prompts/02-mcp-access.md`](../../prompts/02-mcp-access.md) for MCP server access, direct tool invocation, and tool-naming conventions (and the [`.github/prompts/README.md`](../../prompts/README.md) for the full module catalogue).
## Examples (TypeScript)
### Good Pattern: MP Voting Discipline Analysis
```javascript
// Get all votes from current riksmöte
const votes = await riksdag_regering_mcp.search_voteringar({
rm: "2024/25",
limit: 200
});
// Analyze party cohesion
const partyDiscipline = {};
for (const party of ['S', 'M', 'SD', 'C', 'V', 'KD', 'L', 'MP']) {
const partyVotes = await riksdag_regering_mcp.get_voting_group({
rm: "2024/25",
groupBy: "parti",
limit: 200
});
// Calculate cohesion metric
partyDiscipline[party] = calculateCohesion(partyVotes);
}
```
### Good Pattern: Committee Productivity Analysis
```javascript
// Get reports from all committees
const committees = ['AU', 'FiU', 'JuU', 'KU', 'SkU', 'SfU', 'UU'];
const productivity = {};
for (const committee of committees) {
const reports = await riksdag_regering_mcp.get_betankanden({
organ: committee,
rm: "2024/25",
limit: 100
});
productivity[committee] = {
count: reports.length,
avgProcessingTime: calculateAvgTime(reports)
};
}
```
### Good Pattern: Government Document Analysis
```javascript
// Search government propositions on specific topic
const props = await riksdag_regering_mcp.search_regering({
type: "propositioner",
title: "migration",
dateFrom: "2024-01-01",
limit: 50
});
// Get full content for analysis
for (const prop of props) {
const content = await riksdag_regering_mcp.get_g0v_document_content({
regeringenUrl: prop.url
});
// Analyze policy positions
analyzePolicy(content);
}
```
### Good Pattern: Multi-Language Political Dashboard
```javascript
// Get latest parliamentary activity
const motions = await riksdag_regering_mcp.get_motioner({ limit: 10 });
const props = await riksdag_regering_mcp.get_propositioner({ limit: 10 });
const questions = await riksdag_regering_mcp.get_fragor({ limit: 10 });
// Create bilingual dashboard (Swedish/English)
const dashboard = {
sv: formatDashboardSV({ motions, props, questions }),
en: formatDashboardEN({ motions, props, questions })
};
```
### Anti-Pattern: Over-Fetching Without Filtering
```javascript
// ❌ BAD: Fetching too much data
const allDocs = await riksdag_regering_mcp.search_dokument({
limit: 200 // Default, could be thousands
});
// ✅ GOOD: Targeted query with filters
const recentDocs = await riksdag_regering_mcp.search_dokument({
rm: "2024/25",
doktyp: "mot",
organ: "FiU",
limit: 50
});
```
### Anti-Pattern: Ignoring Pagination
```javascript
// ❌ BAD: Only getting first page
const votes = await riksdag_regering_mcp.search_voteringar({ limit: 20 });
// ✅ GOOD: Handling pagination
const allVotes = await riksdag_regering_mcp.fetch_paginated_documents({
doktyp: "votering",
rm: "2024/25",
fetchAll: true,
maxPages: 10
});
```
## 🔥 MCP Query Best Practices
### ⚡ CRITICAL: Always Check Data Freshness First
**RULE #1: Call `get_sync_status()` before any data queries**
```javascript
// === DATA FRESHNESS CHECK ===
// ALWAYS call this FIRST - validates freshness and warms up server
const syncStatus = get_sync_status({});
console.log("Last data sync:", syncStatus.last_updated);
// Calculate hours since last sync
const lastSync = new Date(syncStatus.last_updated);
const hoursSinceSync = (Date.now() - lastSync.getTime()) / 3600000;
// Warn if data is stale (>48 hours)
if (hoursSinceSync > 48) {
console.warn(`⚠️ DATA MAY BE STALE: ${hoursSinceSync.toFixed(1)} hours since last sync`);
// Include disclaimer in analysis/articles
}
```
**Why this matters:**
1. **Data Quality**: Ensures analysis uses recent data, not stale information
2. **Server Warmup**: Warms up MCP server (avoids 30-60s cold start on first query)
3. **User Transparency**: Readers/stakeholders know when data was last updated
4. **Quality Control**: Prevents publishing analysis with outdated information
### 📅 Date Parameter Support Matrix
**Only 3 of 32 tools support explicit date parameters:**
| Tool | Date Parameters | Example |
|------|----------------|---------|
| `get_calendar_events` | `from`, `tom` | `{ from: "2026-02-17", tom: "2026-02-23" }` |
| `search_regering` | `from_date`, `to_date` | `{ from_date: "2026-02-01", to_date: "2026-02-17" }` |
| `analyze_g0v_by_department` | `dateFrom`, `dateTo` | `{ dateFrom: "2026-02-01", dateTo: "2026-02-17" }` |
**All other 29 tools require post-query date filtering by:**
- `datum` - votes, speeches (voting/speech date)
- `publicerad` - committee reports, propositions (publication date)
- `inlämnad` - motions, questions, interpellations (submission date)
### ✅ Good Pattern: Explicit Date Filtering
```javascript
// === STEP 1: Check data freshness ===
const syncStatus = get_sync_status({});
// === STEP 2: Query with explicit dates (where supported) ===
const govDocs = search_regering({
from_date: "2026-02-01",
to_date: "2026-02-17",
limit: 50
});
// === STEP 3: Filter by date for tools without date params ===
const betankanden = get_betankanden({ rm: "2025/26", limit: 100 });
// Filter results by publication date
const fromDate = new Date("2026-02-01");
const recentBetankanden = betankanden.filter(bet =>
Auf GitHub ansehen