Skip to main content
Glama
dataciviclab

dataciviclab

Official
by dataciviclab

dcl-mcp — il MCP del DataCivicLab

Il modo più rapido per consultare il Lab e partecipare alle sue discussioni da un agente AI, senza clonare nessun repository.

Un solo server, nome dataciviclab, 12 tool.

Cosa ti dà

Puoi…

Con

Cosa ottieni

capire com'è organizzato il Lab

session_bootstrap, lab_map

domini, repo, fonti, stato recente

trovare un dataset o un'analisi

find, explore

slug, anni, colonne, marts, dove sta il parquet

leggere i dati pubblicati

gcs_query

SELECT su clean e mart, read-only (max 500 righe)

capire se due dataset si possono unire

join_suggestions

coppie di colonne, overlap anni, mismatch di tipo

vedere cosa è aperto

workspace_triage, find(include_github=true)

PR, issue, discussioni del tema

partecipare

github_get_discussion, github_create_discussion, github_add_discussion_comment

leggi, apri, commenta

Related MCP server: OpsMCP

Cosa non puoi fare

Il server è read-only sui dati e non esegue pipeline:

  • non scarica né trasforma dati → usa toolkit, sul repo locale

  • non modifica file nei repo né apre PR → usa il server github

  • non pubblica dataset né rigenera il catalogo → lo fa la CI di agent-context-builder

Tre percorsi

1. Mi oriento

session_bootstrap()          # cosa è successo nel Lab
lab_map()                    # domini → repo → fonti
find("rifiuti urbani")       # cerca dataset, analisi, repo, fonti
explore("ispra_ru_base")     # card: anni, colonne, marts, gcs_path

2. Mi serve un numero verificabile

find("irpef comunale")        # trova lo slug
explore("irpef_comunale")     # controlla colonne e periodo
gcs_query(slug="irpef_comunale", sql="SELECT count(*) FROM _data")

clean_rows nella card è il conteggio dell'ultimo snapshot pubblicato, non la serie completa: per un numero citabile usa sempre count(*) via gcs_query.

3. Voglio partecipare

find("appalti", include_github=true)      # cosa è già aperto
github_get_discussion(number=123, include_comments=true)
github_list_discussion_categories()       # prima di creare
github_create_discussion(category_name="…", title=…, body=…)
github_add_discussion_comment(number=123, body=…)

Installazione

pip install "lab-connectors[mcp,duckdb] @ git+https://github.com/dataciviclab/lab-connectors.git"
pip install "dcl-mcp @ git+https://github.com/dataciviclab/dcl-mcp.git"

Config OpenCode (V2):

{
  "mcp": {
    "servers": {
      "dataciviclab": {
        "type": "local",
        "command": ["dcl-mcp"],
        "environment": { "DCL_MCP_ENV_FILE": "/percorso/.env" }
      }
    }
  }
}

Per altri client che usano il formato mcpServers, l'entry è {"command": "dcl-mcp", "env": {...}}.

Env var

Ruolo

Obbligatoria

GITHUB_TOKEN (o GITHUB_PERSONAL_ACCESS_TOKEN / GH_TOKEN)

Discussions e find(include_github=true) — GraphQL richiede auth anche in lettura

sì, per discussions/write

DCL_MCP_ENV_FILE

Path a un file .env (fallback: .env cercato verso l'alto dal cwd)

no

ACB_REPO / ACB_BRANCH

Sorgente artefatti contesto (default: ACB, branch context)

no

Riferimento tool

Famiglia

Tool

Cosa fa

Context

session_bootstrap

Orientamento rapido (markdown)

lab_map(domain=, view=)

Domini → repo → fonti; view="datasets" elenca i dataset con anni, freschezza e accessibilità GCS

find(query, type=, domain=, include_github=)

Ricerca ranked cross-entity, con total_catalog e returned

explore(ref)

Deep-dive di dataset/repo/domain/source/analysis

join_suggestions(slug, limit=, min_years=, include_names=)

Dataset joinabili dai semantic_type: colonne, overlap anni, type_mismatch

workspace_triage(section=, detail=)

Stato Lab: radar, PR, issue, discussioni; registry compatto, detail=true per i run per dataset

Discussions

github_list_discussions(query=, category_name=)

Elenca o cerca full-text/categoria

github_list_discussion_categories

Categorie valide per la creazione

github_get_discussion(include_comments=)

Legge una discussion, con commenti e reply

github_create_discussion

Apre una discussion

github_add_discussion_comment

Commenta una discussion

GCS

gcs_query(slug, sql, layer=, limit=)

SELECT/CTE read-only sui parquet pubblici

Ogni risposta ha ok (anche gli errori, con error/message). I tool che leggono il catalogo espongono as_of (quando è stato costruito) e le card dataset/mart snapshot_year (anno del file pubblicato). I tool Discussions usano repo_full_name con default dataciviclab/dataciviclab.

Limiti e sicurezza

  • GCS read-only: solo i bucket dataciviclab-clean e dataciviclab-mart, una sola istruzione per chiamata, max 500 righe, tabella _data (view sul parquet). Nessun DML/PRAGMA.

  • È un guardrail, non un sandbox: non eseguire query di terzi non fidati. I dettagli della validazione AST sono in docs/DESIGN.md.

  • Nomi dei tool = contratto cross-repo (skill, config utente, docs): non cambiano senza migrazione.

Altri server del Lab

Server

A cosa serve

dcl-mcp (questo)

org-wide: dove cerco, cosa è successo, come partecipo, dati pubblicati

toolkit

repo locale: pipeline, contratti, SQL su raw/clean/mart del workspace

source-observatory

scouting fonti e inventory

github

leggere/scrivere un issue o una PR specifica

find(include_github=true) qui è scoperta Lab-scoped (issue/PR aperte i cui titoli contengono i token della query), non sostituisce il server github.

Sviluppo

pip install -e ".[dev]"
pytest tests/ -q -m "not smoke"
pytest tests/test_smoke.py -q -m smoke      # golden path in-process, rete
pytest tests/test_e2e_stdio.py -q -m smoke  # spawn del server + protocollo MCP
ruff check src/ tests/
mypy src/dcl_mcp/

Storia e scelte di design: docs/DESIGN.md. Cambi di contratto: CHANGELOG.md.

Licenza

MIT — vedi LICENSE.

Available Tools

11 tools
exploreA

Deep-dive any Lab entity by ref: dataset slug, repo name, domain slug, source id, or analysis slug. Returns card + children + routing hints.

Inputs: ref (required). Returns: object

findA

Ranked search across datasets, repos, domains, sources, and analyses. All query tokens must match (cross-field AND): words may be spread across slug, name, tags, description, source_id and column schema (names/descriptions/semantic types). Filters: type= (dataset|repo|domain|source|analysis), domain=, limit=. Returns type + parent pointers + score. Use explore(ref) for details. include_github=true (needs GITHUB_TOKEN) adds open issues/PRs whose title contains all query tokens, and top open Discussions of the org on the same query.

Inputs: query (required), type, limit, domain, +1 more. Returns: object

gcs_queryA

SELECT read-only su un dataset clean o mart pubblicato sui bucket publici del Lab (dataciviclab-clean / dataciviclab-mart). slug= del dataset (layer=clean, default) o mart dataset__table (layer=mart). La query deve referenziare la tabella _data (es. SELECT anno, count(*) FROM _data GROUP BY anno); sono ammesse anche CTE (WITH … SELECT). Una sola istruzione, limit= max righe in output (default 100, max 500). Scopri gli slug con find()/explore() — explore restituisce anche columns e gcs_path. Serve solo per i dati pubblicati: per raw/contratti/pipeline usa il MCP toolkit.

Inputs: sql (required), slug (required), layer, limit. Returns: object

github_add_discussion_commentC

Aggiunge un commento top-level a una GitHub Discussion.

Inputs: body (required), number (required), repo_full_name. Returns: object

github_create_discussionA

Crea una GitHub Discussion in una categoria del repository. Default: repo hub dataciviclab/dataciviclab. category_name accetta nome o slug della categoria (case-insensitive, es. 'Domanda' o 'domanda') — elenca le opzioni con github_list_discussion_categories.

Inputs: body (required), title (required), category_name (required), repo_full_name. Returns: object

github_get_discussionA

Restituisce una GitHub Discussion. mode=summary restituisce solo un estratto del body (default excerpt_chars=500). mode=full restituisce il body intero (default, backward compat). include_comments=true aggiunge commenti e reply annidate nello stesso round-trip (comments_mode=full|summary, comments_limit, comments_excerpt_chars).

Inputs: number (required), mode, comments_mode, excerpt_chars, +4 more. Returns: object

github_list_discussion_categoriesA

Elenca le categorie discussioni valide di un repository (nome, slug, is_answerable) — usala prima di github_create_discussion per non sbagliare category_name.

Inputs: repo_full_name. Returns: object

github_list_discussionsA

Elenca le GitHub Discussions di un repository (default: hub del Lab). Senza query/category: ordinate per UPDATED_AT discendente, con cursor pagination 'after'/'before'. Con query= e/o category_name: full-text search server-side (mode='search', paginazione 'after'); category_name è un qualifier GitHub, non un filtro lato client.

Inputs: after, limit, query, before, +2 more. Returns: object

lab_mapA

Lab navigation map — domains → repos → sources. Use domain= to focus on one editorial theme: an unknown domain returns ok=false with the list of valid domain slugs.

Inputs: domain. Returns: object

session_bootstrapB

Quick orientation — compact markdown overview of Lab state.

Inputs: no named parameters. Returns: object

workspace_triageA

Machine-readable Lab state. Default: compact summary. Use section= to get a specific part: radar, prs, issues, discussions, registry, git, warnings.

Inputs: section. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 11 tools

    Disambiguation4/5

    Most tools target clearly distinct actions: the four github_* discussion tools are cleanly separated, and gcs_query vs find vs explore have well-drawn boundaries (query data vs search catalog vs deep-dive a ref). The only soft spot is the trio session_bootstrap / workspace_triage / lab_map, which all return 'state of the Lab' in different formats and could be confused on first use, though the descriptions differentiate them (markdown overview vs machine-readable sections vs domain→repo→source map).

    Naming Consistency3/5

    The GitHub subset follows a clean, consistent github_verb_noun pattern (list/get/create/add). The rest mixes bare verbs (find, explore), noun phrases (session_bootstrap, workspace_triage, lab_map), and one verb_noun (gcs_query), so there is no single predictable pattern across the whole set. Names remain readable and snake_case is used uniformly, so it is mixed rather than chaotic.

    Tool Count5/5

    11 tools is well within a comfortable range and each one earns its place: orientation, catalog search/inspection, one read-only SQL endpoint, and a five-tool discussion workflow. Nothing looks redundant enough to be padding.

    Completeness4/5

    The discussion lifecycle is largely covered (list, categories, get with comments/replies, create, comment), and catalog coverage via find/explore/gcs_query is solid. Gaps remain: no update/delete of discussions and no way to reply to a specific comment even though nested replies are returned, and the surface is read-only for issues/PRs and raw/pipeline data (explicitly deferred to another toolkit).

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides read-only access to Confluence, GitHub, Jira, Figma, Outlook, Teams, and browser automation for AI clients, enabling safe discovery, retrieval, and summarization of company knowledge without modifying source systems.
      -
    • F
      license
      A
      quality
      B
      maintenance
      Enables AI agents to safely interact with GitHub, query Postgres read-only, check deployment status, and search/read files within an allowlisted sandbox—all with dry-run writes and SQL/path safety gates.
      8
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables LLMs to safely perform sandboxed file operations, evaluate math expressions, and run read-only SQL queries on a sample database, plus access resources and prompt templates.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Gives coding agents safe, read-only access to a repository's ADRs, tickets, conventions, and searchable project context, with guardrails for path confinement and output redaction; write tools are available only when explicitly enabled.
      466 npm
      MIT