About Riksdagen MCP Server
Riksdagen MCP Server lets Claude search the Swedish Parliament's open-data archive and retrieve document links. It supports filters such as keywords, document type, and dates, and can produce URL lists in JSON, HTML, or text formats.
Key features
- 01Search parliamentary documents by criteria
- 02List available document types
- 03Create document links in multiple formats
- 04Return document metadata
Use cases
- 01Find parliamentary records on a topic
- 02Filter by document type and parliamentary year
- 03Create access links for search results
MCP support
The MCP server exposes tools for document search, document-type lookup, and URL-list creation to access the Swedish Parliament archive.
Configuration
Remote servers need no local install. Pick your client, then copy the config or install in one click.
http://localhost:8000claude mcp add --transport http riksdagen http://localhost:8000{"mcpServers":{"riksdagen":{"type":"http","url":"http://localhost:8000"}}}Open in Cursor{"servers":{"riksdagen":{"type":"http","url":"http://localhost:8000"}}}Open in VS Code{"mcpServers":{"riksdagen":{"type":"http","url":"http://localhost:8000"}}}{"mcpServers":{"riksdagen":{"serverUrl":"http://localhost:8000"}}}Run commands in a terminal; paste JSON into the client’s MCP config and restart. Servers that need sign-in will prompt on first connect.
Tools
Details
From the project READMERiksdagen MCP Server
This project implements a Model Context Protocol (MCP) server that allows Claude to search the Swedish Parliament (Riksdagen) document archive and retrieve URLs in JSON format. The project is generetad using Claude 3.7.
Overview
The Riksdagen MCP server provides tools for searching documents in the Swedish Parliament's open data archive. It allows Claude to:
- Search for documents based on various criteria (keywords, document types, dates, etc.)
- Get a list of available document types
- Create lists of URLs for specific documents in various formats (JSON, HTML, text)
Prerequisites
- Python 3.9+
- FastAPI
- Uvicorn
- MCP Python SDK
- httpx
Installation
-
Clone this repository:
git clone https://github.com/amrtini/riksdagen-mcp-server.git cd riksdagen-mcp-server -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install dependencies:
pip install fastapi uvicorn httpx mcpNote: You might need to install the MCP Python SDK directly from its repository:
pip install git+https://github.com/modelcontextprotocol/python-sdk.git
Running the Server
-
Start the MCP server:
uvicorn mcp_riksdagen_server:app --host 0.0.0.0 --port 8000 --reload -
The server will be available at http://localhost:8000
MCP Tools
The server provides the following MCP tools:
1. riksdagen_search
Search for documents in the Riksdagen archive based on various criteria.
Parameters:
sok: Search term (optional)doktyp: Document type (optional, e.g. "prop", "mot", "bet")rm: Parliamentary year (optional, e.g. "2021/22")from_date: From date in YYYY-MM-DD format (optional)tom: To date in YYYY-MM-DD format (optional)sort: Sort order (optional, default: "rel", options: "rel", "datum", "beteckning")sortorder: Sort direction (optional, default: "desc", options: "desc", "asc")limit: Maximum number of results to return (optional, default: 10)
Returns: A JSON object containing document URLs and metadata.
2. riksdagen_get_document_types
Get a list of available document types in the Riksdagen archive.
Returns: A dictionary mapping document type codes to their descriptions.
3. riksdagen_create_url_list
Create a list of URLs for Riksdagen documents in the specified format.
Parameters:
document_ids: List of document IDsformat: Format of the documents (default: "json", options: "json", "html", "text")
Returns: A JSON object containing document URLs.
Using with Claude
Claude can use this MCP server to search for documents in the Riksdagen archive and generate URL lists for further processing. The example client demonstrates how to interact with the server.
Example Claude Prompt
I want to search for documents in the Swedish Parliament archive about climate change (klimat in Swedish) from the last year. Can you help me find relevant motions and create a list of URLs to access them?
Claude can then use the MCP tools to:
- Search for documents with the term "klimat"
- Filter for motion documents (doktyp="mot")
- Set the parliamentary year to the current one
- Create a list of URLs for the found documents
Using the Client
The included client demonstrates how to interact with the MCP server programmatically:
# Create the client
client = ClaudeRiksdagenClient()
# Search for documents
search_results = await client.search_documents(
search_term="klimat",
document_type="mot",
parliamentary_year="2023/24",
limit=5
)
# Create URL list for the found documents
doc_ids = [doc["id"] for doc in search_results["documents"]]
url_list = await client.create_url_list(doc_ids, format="json")
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- The Swedish Parliament (Riksdagen) for providing the open data API
- The Model Context Protocol (MCP) team for developing the standard
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.