Skip to main content

MCP server for Swedish statistical data discovery and export

Project description

Data Platform MCP Server

MCP (Model Context Protocol) server for AI agents to discover, fetch, and export Swedish statistical data.

Tools

  • discover_datasets - AI-powered smart search for datasets
  • get_dataset_details - Get measures, breakdowns, and time ranges
  • fetch_data - Fetch actual data rows for direct answers
  • build_export_link - Generate CSV/JSON download links
  • build_session_link - Deep link to preload data in the app

In Apps SDK-compatible clients, discover_datasets also exposes a card-based widget with:

  • dataset cards,
  • field inspection (measures + breakdowns + time),
  • quick line-chart visualization (with bar fallback),
  • loading metrics into a working session before opening the app.

Installation

The package is available on PyPI and installs automatically via uvx:

# No manual installation needed - uvx handles it automatically
# Just add to your MCP client config (see below)

For development:

cd backend/mcp-server
pip install -e .

Usage with MCP Clients

Add to your MCP client config:

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "utforska-data": {
      "command": "uvx",
      "args": ["utforska-data-mcp"]
    }
  }
}

Windsurf (~/.codeium/windsurf/mcp_config.json):

{
  "mcpServers": {
    "utforska-data": {
      "command": "uvx",
      "args": ["utforska-data-mcp"]
    }
  }
}

Cursor/Cline: Same configuration format.

The package installs automatically on first use. No manual installation required!

Configuration

The server connects to the production backend automatically (https://utforskadata.se). No extra configuration is needed for normal use.

For remote/Apps SDK usage, you can run the Streamable HTTP entrypoint:

cd backend/mcp-server
uv run utforska-data-mcp-http

Default endpoint is http://localhost:8080/mcp with health at http://localhost:8080/health. For connector clients, prefer the explicit trailing-slash URL: http://localhost:8080/mcp/.

Optional environment variables:

  • MCP_BACKEND_URL (default https://utforskadata.se)
  • MCP_APP_URL (default https://utforskadata.se)
  • MCP_DEFAULT_LANG (default sv)
  • MCP_HTTP_HOST (default 0.0.0.0)
  • MCP_HTTP_PORT (default 8080)
  • MCP_HTTP_PATH (default /mcp)
  • MCP_HTTP_STATELESS (default true)
  • MCP_HTTP_JSON_RESPONSE (default false)

For ChatGPT connector compatibility, keep MCP_HTTP_STATELESS=true unless you have a specific reason to require stateful transport.

If you have a local shell override like MCP_BACKEND_URL=http://localhost:8000, unset it when testing production behavior.

Example Flows

Quick Answer

  1. discover_datasets("housing prices in Sweden")
  2. get_dataset_details(dataset_id) - check measures/breakdowns
  3. fetch_data(dataset_id, measure="Average price") - get data
  4. Answer the question with the data
  5. Offer build_export_link() and the session_link from discover_datasets

Deep Dive

  1. Same as above
  2. build_session_link(selections=[...]) - create link to continue in app

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

utforska_data_mcp-1.0.2.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

utforska_data_mcp-1.0.2-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file utforska_data_mcp-1.0.2.tar.gz.

File metadata

  • Download URL: utforska_data_mcp-1.0.2.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for utforska_data_mcp-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4fa8201099ff5fa8fd27aef356f3394e566e94540a56965939eb68380d0d9ba3
MD5 cf09563d492d13c3a53c987714513426
BLAKE2b-256 51bbc5aa6bb12d4972152410cd88ad829337a2dafe47520cadd77a51a022b236

See more details on using hashes here.

File details

Details for the file utforska_data_mcp-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for utforska_data_mcp-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 674fcde76c800ce4daabe6de0d4b01f4b4c1268fdcc247c4ab688c2499db7214
MD5 eb4ec3aef974ff845346a494feb584c4
BLAKE2b-256 481259182e1b7ccd8ed2718eed342f220f24b751e75054f0f9877ed72d63a72a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page