CUF Health Portal MCP Server
Enables users to interact with the CUF health portal to retrieve patient information, appointments, clinical documents, invoices, and prescriptions through natural language.
README
CUF Health Portal MCP Server
An MCP (Model Context Protocol) server that exposes the CUF health portal as tools for Claude and other MCP clients.
Tools
| Tool | Description |
|---|---|
get_patient_info |
Patient profile (name, contacts, NIF, SNS number) |
list_appointments |
Upcoming appointments |
list_past_appointments |
Full appointment history |
list_clinical_documents |
Imaging reports, lab reports, clinical files, etc. |
get_clinical_document |
Download a clinical document PDF by ID |
list_exam_results |
Active lab/exam results from the portal |
list_invoices |
All invoices |
get_invoice |
Download an invoice PDF by payment number |
list_prescriptions |
Exam prescriptions (scrapes www.cuf.pt) |
get_prescription |
Download a prescription PDF by download URL |
Downloaded PDFs are saved to ./downloads/cuf/ by default (configurable via OUTPUT_DIR env var).
Setup
Requirements
- uv
- A CUF portal account (saudecuf.pt)
Install
git clone <repo>
cd cuf-mcp
uv sync
Configure credentials
Create a .env file:
CUF_USERNAME=your.email@example.com
CUF_PASSWORD=yourpassword
OUTPUT_DIR=./downloads # optional
Register with Claude Code
Add to ~/.claude/claude_desktop_config.json (or your MCP settings):
{
"mcpServers": {
"cuf-health": {
"command": "uv",
"args": ["run", "--directory", "/path/to/cuf-mcp", "python", "mcp_server.py"]
}
}
}
Then run /mcp in Claude Code to connect.
Run standalone (MCP Inspector)
uv run mcp dev mcp_server.py
Bulk download all records
uv run python download_cuf.py
Downloads all clinical documents and invoices to ./downloads/cuf/.
Architecture
Authentication
The portal uses two separate auth systems:
-
saudecuf.ptGraphQL API — JWT bearer token obtained viaauthenticationMutation. The JWT containspatientId,usercode, andinternalPatientCode. Headers requirex-channel-type-id: 1and a per-requestx-transaction-idUUID. -
cuf.ptDrupal (prescriptions only) — Separate Drupal session cookie (SSESS*) obtained by POSTing tohttps://www.cuf.pt/mycuf/login. Prescriptions are server-rendered HTML, not available via GraphQL.
Key files
mcp_server.py— FastMCP server; defines all 10 tools; lazy-initializes a shared authenticatedCufClientcuf_client.py— AsyncCufClientclass; wraps all GraphQL queries and the prescription scraperdownload_cuf.py— Standalone bulk downloader script
WAF note
The portal runs behind a Barracuda WAF that blocks headless Chromium. Plain httpx with browser-like headers works fine.
Notes
list_exam_resultscurrently returns an empty list — thegetActiveExamResultsGraphQL endpoint requires a separate auth scope not present in the standard JWT.- Prescriptions use
internalPatientCodeas the client identifier, notpatientId. - Invoice
paymentNumberformat:"CCF2026/45291"→docSeries="CCF2026",docNumber="45291".
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.