Skip to main content
Glama
RiccardoEudizi

statisticheisa-cli

statisticheisa-cli

CLI e server MCP per le statistiche ISA (Indici Sintetici di AffidabilitΓ ) dell'Agenzia delle Entrate italiana.

πŸ“‹ Caratteristiche

  • Ricerca codici ISA per descrizione o alias colloquiali (es. "tassisti" β†’ DG72U)

  • Dati nazionali: reddito medio, ricavi, componenti per codice ISA

  • Dati regionali: dettaglio per regione

  • Elenco anni disponibili

  • Catalogo sezioni ISA per anno

  • Alias integrati per ricerche naturali (ristoranti, idraulici, commercianti, ecc.)

  • Output flessibile: JSON, tabella, CSV, plain text

  • Filtraggio campi con notazione dot-path (es. totale.redditoMedio)

  • Parsing numeri italiani (es. "39.917" β†’ 39917)

Related MCP server: istat-mcp-server

πŸš€ Installazione

# Da sorgente (richiede Go 1.21+)
git clone https://github.com/your-repo/statisticheisa-cli
cd statisticheisa-cli
go build -o statisticheisa-cli .

# Oppure scarica il binario precompilato dalle releases

πŸ“– Uso CLI

Comandi principali

# Mostra aiuto
statisticheisa-cli --help

# Cerca codice ISA per parola chiave
statisticheisa-cli cerca tassisti
statisticheisa-cli cerca "trasporto passeggeri" --anno 2024 --format table

# Elenco anni disponibili
statisticheisa-cli elenco-anni

# Tutti i dati ISA per un anno
statisticheisa-cli dati 2024

# Dati nazionali per un codice ISA
statisticheisa-cli nazionali 2024 DG72U
statisticheisa-cli nazionali 2024 DG72U --field totale.redditoMedio --format plain
statisticheisa-cli nazionali --anno 2024 --codisa DG72U --field totalePersoneFisiche.redditoMedio --format json

# Dati regionali
statisticheisa-cli regionali 2024 DG72U

# Lista codici ISA (con filtro opzionale)
statisticheisa-cli lista 2024 --cerca trasporto --format table

# Macroaree per un codice
statisticheisa-cli macroaree 2024 DG72U

# Dati multi-anno
statisticheisa-cli nazionali-multi 2024 DG72U Servizi U
statisticheisa-cli regionali-multi 2024 DG72U Servizi

# Grafici
statisticheisa-cli grafico-barre 2024 1 DG72U Servizi redditoMedio
statisticheisa-cli grafico-regioni 2024 1 DG72U Servizi

# Info endpoint e alias
statisticheisa-cli info

Flag globali

Flag

Descrizione

--field <path>

Proietta solo campi specifici (dot-separated, comma-separated)

--format <json|table|csv|plain>

Formato output (default: json)

--parse-numbers

Converte numeri formato italiano "39.917" β†’ 39917

--raw

Dump bytes grezzi API

--output <file>, -o <file>

Scrive su file invece di stdout

--cerca <query>

Filtra lista per query

--anno <year>

Override anno

--codisa <code>

Override codIsa (stile flag)

--macroarea <area>

Override macroarea

Alias supportati

Il CLI risolve automaticamente alias comuni:

# Questi sono equivalenti:
statisticheisa-cli nazionali 2024 tassisti
statisticheisa-cli nazionali 2024 DG72U

# Altri alias: ristoranti, bar, pizzerie, idraulici, elettricisti,
# parrucchieri, commercianti, agenti-immobiliari, medici, dentisti,
# avvocati, commercialisti, architetti, ingegneri, ...

Vedi tutti con: statisticheisa-cli info

πŸ”Œ Server MCP

Il progetto include due server MCP (Model Context Protocol) per integrazione con agenti AI (OpenCode, Claude, ecc.).

1. Server stdio (locale)

Per uso diretto con agenti che supportano MCP su stdio.

# Avvia server
statisticheisa-cli mcp

# Configurazione OpenCode (opencode.json)
{
  "mcp": {
    "servers": {
      "statisticheisa-local": {
        "type": "local",
        "command": ["go", "run", ".", "mcp"],
        "environment": {}
      }
    }
  }
}

2. Server HTTP (remote)

Per connessione remota via HTTP.

# Avvia server su porta 8080
statisticheisa-cli mcp-http

# Oppure specifica indirizzo
statisticheisa-cli mcp-http :9090

# Configurazione OpenCode (opencode.json)
{
  "mcp": {
    "servers": {
      "statisticheisa-http": {
        "type": "remote",
        "url": "http://localhost:8080/mcp"
      }
    }
  }
}

Endpoint HTTP

  • POST /mcp - Endpoint MCP JSON-RPC 2.0

  • GET /health - Health check

Strumenti MCP disponibili

Tool

Descrizione

Parametri

cerca

Cerca codice ISA per query

query (string), anno (int, default 2024)

lista

Lista codici ISA per anno

anno (int, default 2024), cerca (string, opzionale)

elenco_anni

Anni disponibili

anno (int, default 2024)

dati

Catalogo sezioni ISA

anno (int, required)

nazionali

Dati nazionali per codice

anno (int), codIsa (string), macroarea (string, default "Servizi"), field (string, opzionale)

regionali

Dati regionali per codice

anno (int), codIsa (string), macroarea (string, default "Servizi")

info

Info endpoint e alias

(nessuno)

Esempi uso MCP

// Inizializzazione
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}

// Lista strumenti
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}

// Cerca "tassisti"
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"cerca","arguments":{"query":"tassisti","anno":2024}}}

// Dati nazionali per DG72U (tassisti)
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"nazionali","arguments":{"anno":2024,"codIsa":"DG72U","field":"totale.redditoMedio"}}}

πŸ—οΈ Architettura

statisticheisa-cli/
β”œβ”€β”€ main.go                    # Entry point CLI
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ aliases/aliases.go     # Risoluzione alias colloquiali
β”‚   β”œβ”€β”€ client/client.go       # Client HTTP per API Agenzia Entrate
β”‚   β”œβ”€β”€ client/testdata/       # Golden files per test
β”‚   β”œβ”€β”€ format/numbers.go      # Parsing numeri italiani
β”‚   β”œβ”€β”€ mcp/
β”‚   β”‚   β”œβ”€β”€ server.go          # Server MCP stdio
β”‚   β”‚   └── http_server.go     # Server MCP HTTP (Gin)
β”‚   β”œβ”€β”€ output/output.go       # Formattazione output (JSON, table, CSV, plain)
β”‚   └── search/search.go       # Ricerca fuzzy codici ISA
β”œβ”€β”€ explore/                   # Script di esplorazione API (non per produzione)
β”œβ”€β”€ go.mod / go.sum
└── opencode.json              # Configurazione MCP per OpenCode

πŸ”§ Sviluppo

# Test
go test ./...

# Build
go build -o statisticheisa-cli .

# Lint
golangci-lint run

# Esegui server HTTP in background per test
./statisticheisa-cli mcp-http &
curl -X POST http://localhost:8080/mcp -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'

πŸ“‘ API Sorgente

I dati provengono dalle API pubbliche dell'Agenzia delle Entrate:

  • Base URL: https://www.agenziaentrate.gov.it/portale/

  • Endpoint ISA: /portale/it/servizi/indici-sintetici-affidabilita

⚠️ Note

  • Il server HTTP MCP usa protocollo 2024-11-05 (compatibile OpenCode)

  • I dati sono soggetti a disponibilitΓ  API Agenzia Entrate

  • Gli alias sono mantenuti manualmente in internal/aliases/aliases.go

  • Per contributi: apri issue o PR

πŸ“„ Licenza

MIT License - vedi LICENSE per dettagli.

Related MCP Connectors

  • Your agent needs to know what people actually search β€” volume, ideas, how hard the term is, and whether interest is rising or was a spike last March. **What you can ask for** β€’ "What is the monthly volume and difficulty for these 200 keywords?" β€’ "Give me keyword ideas around this seed, with questions people ask." β€’ "Which keywords does this competitor rank for that we do not?" β€’ "Is interest in this term growing, and where?" β€’ "What does this page already rank for?" **How to use it** Point any MCP client at https://mcp.aisa.one/seo-keywords/mcp and sign in with OAuth β€” there is no key to create or paste. 49 tools: Google and Bing volume and suggestions, keywords for a site or a URL, clickstream volumes, Google Trends and Ads traffic estimates, plus Semrush difficulty, question keywords, broad match and paid keywords, and Similarweb's keyword and landing page sets. **Why this rather than the source** Three sources for the same number, so a suspicious volume can be checked rather than believed. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Size the demand here, then ask the same agent who ranks for it and who links to them β€” without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/seo/mcp for all of it at once β€” rankings, keywords, backlinks, site health and AI-answer visibility across DataForSEO, Semrush and Ahrefs.

  • Your agent needs live data β€” a competitor's traffic, who to contact there, what people are saying, what Google and ChatGPT answer about you, a company's filings. Normally that is six vendor accounts, six sets of keys and six SDKs. This is one URL. **What you can ask for** β€’ "How much traffic does stripe.com get, where does it come from, and who competes for the same keywords?" β€’ "Find 20 Series-B fintech companies in Germany and the heads of marketing there, with emails." β€’ "Does ChatGPT mention our brand when someone asks for the best CRM β€” and what does it cite?" β€’ "What is X saying about $NVDA today, and what did the stock actually do?" β€’ "Search the web for this, then scrape the three best pages into markdown." **How to use it** Point any MCP client at https://mcp.aisa.one/mcp and sign in with OAuth β€” there is no key to create or paste. Then just ask: the agent calls search to find the right operation and use to run it. **Why this rather than the source** 26 sources behind one account and one bill β€” DataForSEO, Semrush, Ahrefs, Similarweb, Apollo, X/Twitter, Instagram, Reddit, Pinterest, YouTube, Tavily, Exa, Perplexity, Firecrawl, CoinGecko, Kalshi, Polymarket, AgentMail and more, 580+ operations. tools/list returns five tools, not 580, so the introduction does not eat your context window. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** One slice at a time: https://mcp.aisa.one/seo/mcp Β· /finance/mcp Β· /social/mcp Β· /search/mcp Β· /sales/mcp Β· /mail/mcp Β· /gtm/mcp, or a single provider like /twitter-api/mcp. Same account, fewer tools listed, and search still reaches everything. Full list at https://mcp.aisa.one/servers

  • Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.

  • 100+ MCP tools for AI agents: content metadata, trade intelligence, business-expertise analysis.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables querying Italian national statistics (ISTAT) data through natural language questions, with tools for accessing demographic, economic, and social indicators.
    1 npm
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables LLMs to access and analyze Italian statistical data from ISTAT via natural language queries, supporting dataset discovery, exploration, and data retrieval.
    9
    2
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    Enables AI assistants to search, read, and analyze Italian civil court decisions from the Ministry of Justice's Banca Dati di Merito, using CIE authentication.
    11
    -