Skip to main content

HEU Legal MCP Server

PyPI Python License: MIT

MCP server (Model Context Protocol) per integrare l'API HEU Legal con Claude (Claude Desktop, Claude Code, e altri client MCP). Gestisce documenti nativi HEU e PDF firmabili end-to-end via conversazione: creazione, condivisione per firma elettronica (valida in 180+ paesi), sollecito firmatari, download PDF.

Funzionalità

27 tool che coprono l'intera API HEU v1 più lettura contenuto e estrazione strutturata delle parti:

Documenti nativi HEUlist_heu_documents, get_heu_document, list_heu_document_placeholders, create_heu_document, prompt_heu_document_signature, extract_heu_document_parties, read_heu_document, download_heu_document_pdf

PDF caricatilist_pdf_documents, get_pdf_document, list_pdf_document_signers, list_pdf_document_signer_placeholders, list_pdf_document_placeholders, create_pdf_document, extract_pdf_document_parties, read_pdf_document, prompt_pdf_document_signature, download_pdf_document, download_pdf_audit_trail, download_pdf_bundle, cancel_pdf_document

Template PDFcreate_pdf_template (da file locale), create_pdf_document_from_upload (invio diretto da file), preview_pdf_template, update_pdf_template, delete_pdf_template

Healthget_heu_health

Lettura del contenuto vs Download

Per ciascun tipo di documento esistono due modalità complementari:

Tool Cosa fa Quando usarlo
read_heu_document / read_pdf_document Estrae il testo del PDF e lo restituisce direttamente nella conversazione Quando vuoi che Claude legga il documento (riassumere, cercare clausole, confrontare)
download_heu_document_pdf Salva il PDF su disco e ritorna il path Quando ti serve il file fisico (archiviarlo, allegarlo a un'email, stamparlo)

I tool di lettura accettano un parametro opzionale pages per leggere solo un range (es. "1-3", "5", "1,3,5-7"). Senza pages leggono fino a un massimo di 100 pagine.

Requisiti

  • Python ≥ 3.10
  • Una API key HEU Legal (Profile → API Keys nella UI HEU; richiede subscription Enterprise)
  • Almeno un template già creato sulla piattaforma HEU (documento nativo o PDF caricato)

Installazione

Da PyPI

pip install heu-mcp

Da sorgenti

git clone https://github.com/Lucav21/heu-mcp.git
cd heu-mcp
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Configurazione

Claude Desktop

Modifica ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) o %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "heu": {
      "command": "heu-mcp",
      "args": [],
      "env": {
        "HEU_API_KEY": "la_tua_api_key_qui"
      }
    }
  }
}

Se hai installato da sorgenti con venv:

{
  "mcpServers": {
    "heu": {
      "command": "/path/assoluto/heu-mcp/venv/bin/python",
      "args": ["/path/assoluto/heu-mcp/server.py"],
      "env": {
        "HEU_API_KEY": "la_tua_api_key_qui"
      }
    }
  }
}

Riavvia Claude Desktop dopo la modifica.

Claude Code (CLI)

claude mcp add heu heu-mcp -e HEU_API_KEY=la_tua_api_key_qui

Variabili d'ambiente

Variabile Descrizione Default
HEU_API_KEY API key HEU Legal (richiesto)
HEU_BASE_URL URL base API https://api.heulegal.com/v1
HEU_DOWNLOAD_DIR Cartella dove salvare i PDF scaricati /tmp

Esempi d'uso

Dopo aver configurato il MCP, chiedi a Claude:

  • "Lista i miei template HEU"
  • "Mostrami i firmatari del PDF con id 26"
  • "Sollecita la firma del documento 15c587e0-1715-45c6-bf72-24bcb86c0f90"
  • "Riassumi il contratto con id ... e dimmi qual è la durata" (usa read_heu_document)
  • "Confronta i contratti X e Y, segnalami le differenze nelle clausole"
  • "Estrai i dati delle parti dal contratto ... — voglio nome, codice fiscale, P.IVA, codice univoco SDI" (usa extract_heu_document_parties)
  • "Scarica il PDF del documento X con layout 220 e includi indice"
  • "Crea un nuovo PDF firmabile dal template 56 per mario.rossi@example.com"

Note operative

  • I tool che creano/inviano (create_*, prompt_*) chiedono sempre conferma esplicita all'utente prima dell'esecuzione.
  • Rate limit dell'API: 300 richieste / 5 minuti. Gli header X-RateLimit-* sono restituiti nelle risposte.
  • prompt_*_signature ha un limite di 1 sollecito ogni 24h per documento (HTTP 429 con Retry-After).
  • download_heu_document_pdf salva il PDF in HEU_DOWNLOAD_DIR e restituisce il path: il binario non passa nel canale stdio.
  • Per create_pdf_document con signature_type=fea serve avere credito FEA sufficiente per tutti i firmatari (altrimenti HTTP 422).

Sicurezza

  • Le API key non sono mai loggate.
  • L'API key è letta solo da variabile d'ambiente: non viene mai scritta nel codice o nelle risposte.
  • Il binario PDF è salvato sul filesystem locale, non viene trasmesso via canale MCP.

Sviluppo

git clone https://github.com/Lucav21/heu-mcp.git
cd heu-mcp
python3 -m venv venv
source venv/bin/activate
pip install -e .

# Avvio manuale per debug
HEU_API_KEY=... python server.py

Licenza

MIT — vedi LICENSE.

Link

Download files

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

Source Distribution

heu_mcp-0.2.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

heu_mcp-0.2.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file heu_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: heu_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for heu_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 488b664906bfb7c4418c49d7ac1deba7d582147829c46b9a4b1d193f05a9619b
MD5 0be0c31129222145545b3135380c8735
BLAKE2b-256 7ca5977ccb7446ec117d40f9d95488cfc3d4c80785a405b9bc41c552c8a0821c

See more details on using hashes here.

File details

Details for the file heu_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: heu_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for heu_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46eaa83a6b6eb34ffe17269696b3d479ea3f9f4829d0051180e6bb188f2376f3
MD5 96f0c6609d6054d1f479309c3f6ee2a3
BLAKE2b-256 770c41837a807e6851bf57ef386394826d5fd63c1309c0505794b3bc5b058a16

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