Integration

MCP server

Query this dataset from an MCP-compatible AI client — Claude Desktop, Claude Code, and others.

What it is

The repository ships mcp_server.py, a native Model Context Protocol stdio server. It is a thin front end over this public API — it talks to a running server over HTTP, so an AI assistant can explore the DSA transparency data through structured tool calls instead of raw HTTP. No SQL is ever exposed; every query goes through the same validated query layer as the rest of the API.

Tools

  • list_tables
    List the DSA report tables and the dataset period.
  • describe_table
    Show a table's queryable dimensions and measures.
  • dataset_overview
    Headline aggregates for the whole dataset.
  • run_query
    Run a structured (single-table or composite) query and get JSON rows back.
  • ask
    Ask a natural-language question; an LLM translates it into a validated structured query.
  • register
    Mint a demo API key from a name and email — unlocks the authenticated tools below.
  • submit_query
    Submit a full async query job (no row cap, CSV export, composite legs) and get a job id.
  • poll_job
    Poll a submitted job until it finishes and return its result.

submit_query, poll_job, and ask need an API key; register mints a demo one.

Connect it

Add the server to your MCP host (for example Claude Desktop's claude_desktop_config.json). See docs/MCP.md for the full setup, and mcp-config.example.json in the repository for a ready-made example.

{
  "mcpServers": {
    "transparency-report-api": {
      "command": "/absolute/path/to/transparency-report-api/.venv-mcp/bin/python",
      "args": ["/absolute/path/to/transparency-report-api/mcp_server.py"],
      "env": {
        "TRANSPARENCY_API_URL": "https://your-deployment.example",
        "TRANSPARENCY_API_KEY": "momo"
      }
    }
  }
}

Configured via TRANSPARENCY_API_URL, TRANSPARENCY_API_KEY, and TRANSPARENCY_API_TIMEOUT. Its dependencies (mcp + httpx) live in requirements-mcp.txt, separate from the app image. Need a key? Get an API key →