Skip to main content

sns-portugal-mcp

MCP server for official open-data statistics about Portugal's national health service (SNS), so Claude (or any MCP client) can answer "how busy is the emergency department at Santa Maria?", "how many people are waiting for surgery in the Norte region?" or "which SNS hospitals are near me?".

Read-only, no key, no account. It uses only public open data. Not affiliated with the SNS, SPMS or the Portuguese Ministry of Health.

Statistics, not the live queue. The figures are official monthly statistics; the newest month is usually 2-3 months old and provisional. This server does not show live emergency-room waiting times. For those, see tempos.min-saude.pt.

Not medical advice. In an emergency call 112. For health advice call SNS 24 on 808 24 24 24.

Tools

find_institutions

Finds SNS hospitals and local health units (ULS) by name, or the nearest ones to a coordinate. Each result says whether the place reports emergency, consultation and surgery data, and gives stats_entity: the name the statistics use for it. Statistics are published per ULS or hospital group, not per building.

Parameters: query (name, accent-insensitive), lat / lon (sort by distance), emergency_only, limit.

emergency_stats

Emergency-department visits per month, by type (general, paediatric, obstetric, psychiatric) and by Manchester triage colour (red, orange, yellow, green, blue, white, not triaged), with each colour's share of the month. Covers one institution, one region, or the whole country.

Parameters: institution, region (Norte | Centro | LVT | Alentejo | Algarve), period ("YYYY-MM", latest month to include), months (default 6).

surgery_wait_stats

Surgery access per month:

  • the surgical waiting list (LIC) at month end;
  • the % of waiting patients still within the legal maximum guaranteed time (TMRG);
  • the mean days from hospital admission to the operation (scheduled inpatient surgery);
  • surgeries performed: scheduled (inpatient and day surgery) and urgent.

Same parameters as emergency_stats. The open data has no breakdown by specialty.

consultation_wait_stats

Hospital outpatient consultations per month (first and follow-up), plus the % of first specialist consultations (referred by a family doctor) held within the TMRG. Same parameters as above.

search_datasets

Searches the 149 datasets of the SNS Transparency portal by keyword. Titles are in Portuguese, so Portuguese keywords work best: "ocupação", "partos", "rastreios", "SNS 24", "INEM". Returns each dataset's id, description and field names.

query_dataset

Runs an ODSQL query (where, select, group_by, order_by, limit, offset) on any portal dataset. Use it for anything the tools above don't cover.

Year-to-date values

Most hospital-activity datasets publish year-to-date cumulative values, so the December figure is the annual total. The curated tools return both the year-to-date value and a derived in_month value (this month minus the previous one). If you use query_dataset directly, do that subtraction yourself.

Install

Quickest (needs uv): no clone needed, it runs straight from PyPI.

claude mcp add sns-portugal -- uvx sns-portugal-mcp

For Claude Desktop, use "command": "uvx", "args": ["sns-portugal-mcp"].

From source:

Requires Python 3.10+.

git clone https://github.com/ThiagoJacobLannes/sns-portugal-mcp
cd sns-portugal-mcp
python -m pip install -e .

On Windows, if you keep code in a cloud-synced folder (Google Drive, OneDrive), create the virtual environment outside it. Sync clients drop desktop.ini files into folders, which can crash packages on startup.

Add to Claude Code

claude mcp add sns-portugal -- python -m sns_portugal_mcp.server

Add to Claude Desktop

Merge claude_desktop_config.snippet.json into your Claude Desktop claude_desktop_config.json, then restart Claude Desktop:

{
  "mcpServers": {
    "sns-portugal": {
      "command": "python",
      "args": ["-m", "sns_portugal_mcp.server"]
    }
  }
}

Data sources

Source What it gives Access Licence / terms
SNS Transparency portal (Opendatasoft Explore API v2.1) 149 datasets of monthly SNS statistics, published by the SNS Executive Direction (DE-SNS) Open, no key No licence is set in any dataset's metadata (checked 2026-10-31). The portal's terms allow reuse under Portuguese public-sector-information law (Lei n.º 26/2016): cite the source, keep the data's integrity and context, and flag any changes you make. Some of the same datasets are mirrored on dados.gov.pt; there, some copies are marked CC-BY and others "not specified".
tempos.min-saude.pt/institutions.json List of hospitals and ULS with coordinates and which data each reports Public static file, no key No licence stated.

Datasets used by the curated tools:

Tool Datasets
emergency_stats atendimentos-por-tipo-de-urgencia-hospitalar-link, atendimentos-em-urgencia-triagem-manchester
surgery_wait_stats inscritos-em-lic-dentro-do-tmrg-180-dias, demora-media-antes-da-cirurgia, intervencoes-cirurgicas
consultation_wait_stats consultas-em-tempo-real, 01_sica_evolucao-mensal-das-consultas-medicas-hospitalares

Data derived from these sources keeps the source's terms. The code in this repository is MIT-licensed.

What this server does not do. It does not call tempos.min-saude.pt/api/*: that API needs a key embedded in the site's own web app, and this server does not use other people's keys. It also does not scrape the live waiting-time report (an embedded Power BI report).

How it works

The server calls the portal's public Explore API with httpx and aggregates in the query itself (group_by tempo, sum(...)), so regional and national totals are computed on the server side. Hospital names are matched without regard to accents. A hospital such as "Hospital de Faro" is mapped to the ULS it reports under ("ULS do Algarve") using the institution list. The dataset catalog, the institution list and the institution names are cached in memory for 6 hours. If an upstream call fails or a query is malformed, the tool returns a clear {"error": ...} and does not guess.

Environment overrides (optional): SNS_ODS_BASE_URL, SNS_INSTITUTIONS_URL.

License

MIT

Metadata

Release files for sns-portugal-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sns-portugal-mcp 0.1.0
File Size Uploaded Provenance Actions
sns_portugal_mcp-0.1.0.tar.gz 19.2 kB With provenance Details for sns_portugal_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sns-portugal-mcp 0.1.0
File Interpreter ABI Platform Actions
sns_portugal_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for sns_portugal_mcp-0.1.0-py3-none-any.whl

Total release size: 37.7 kB

Release files / sns_portugal_mcp-0.1.0.tar.gz

Download URL sns_portugal_mcp-0.1.0.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
021e9748cb74350d914b338262d888f8da7818510b138e5f6ee4761f5fce9e5f
BLAKE2b-256 checksum
How to use checksums
8327a57ae7b91edbb8ac0f4d713f26b6b87da28751a1f18179216d4b9dc1058a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / sns_portugal_mcp-0.1.0-py3-none-any.whl

Download URL sns_portugal_mcp-0.1.0-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddab2c5665e0215ef58ab308eb106994e8fbba67f8c1a20cf2a155ec8f4e20a1
BLAKE2b-256 checksum
How to use checksums
5ef56d07d32e0229c15fa7968444d37c47ceb6e4c3e8ead5a7527ac2e47be8b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for sns-portugal-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sns_portugal_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page