PR

Program Integrity Alliance MCP Server — U.S. Government Datasets

Explore the Program Integrity Alliance MCP server for AI-ready access to U.S. government open datasets, available locally, hosted, and via Docker.

Quick Install
npx -y @Program-Integrity-Alliance/pia-mcp-local

Overview

The Program Integrity Alliance MCP Server provides a lightweight implementation of the Model Context Protocol (MCP) tailored for U.S. federal open datasets. It indexes and exposes AI-friendly dataset manifests and file URLs so models and retrieval systems can efficiently locate and stream government data (public datasets, reports, and metadata) as context for LLM prompts or downstream pipelines.

This server is useful for developers building retrieval-augmented generation (RAG), data catalogs, or offline model training workflows. It can run locally for development, in Docker for reproducible deployments, or as a hosted service. The repository contains tools to build dataset manifests that follow MCP conventions and an HTTP API for programmatic access.

Features

  • Exposes dataset manifests and metadata via a simple HTTP API compatible with MCP-style workflows
  • Pre-built connectors and scripts to gather and index U.S. government open datasets
  • Docker image and docker-compose support for quick deployment
  • Local filesystem and volume-mounted data support for offline usage
  • CORS-enabled endpoints for browser-based experiments
  • Simple configuration via environment variables or a config file
  • Utilities for manifest generation and dataset lifecycle management

Installation / Configuration

Clone the repository, then choose one of the deployment options below.

  1. Clone the repo
git clone https://github.com/Program-Integrity-Alliance/pia-mcp-local.git
cd pia-mcp-local
  1. Local Python (development)
# create a virtual environment
python -m venv .venv
source .venv/bin/activate

# install dependencies
pip install -r requirements.txt

# set env vars (example)
export DATA_DIR="$(pwd)/data"
export PORT=8080

# run the server
python -m pia_mcp_local.app
  1. Docker
# build the image
docker build -t pia-mcp-local .

# run container with local data directory mounted
docker run --rm -p 8080:8080 \
  -v "$(pwd)/data:/app/data" \
  -e DATA_DIR="/app/data" \
  pia-mcp-local
  1. docker-compose (recommended for multi-service setups)
version: "3.8"
services:
  pia-mcp:
    image: pia-mcp-local:latest
    build: .
    ports:
      - "8080:8080"
    volumes:
      - ./data:/app/data
    environment:
      - DATA_DIR=/app/data
      - PORT=8080
docker-compose up --build

Configuration options (common environment variables)

  • DATA_DIR — path to dataset files and manifests (default: ./data)
  • PORT — server listen port (default: 8080)
  • DEBUG — enable debug logging (true/false)

Available Resources

The repository includes several developer-facing resources:

  • Manifest generator scripts to convert raw dataset metadata into MCP-style manifests
  • Example dataset manifests and a sample data directory for offline testing
  • Example Jupyter notebook demonstrating how to query the MCP API and stream files
  • API documentation (openapi/swagger or simple README endpoint) — check /docs or /openapi.json when the server is running

Example directory layout

PathPurpose
data/Local dataset files and generated manifests
scripts/Utilities to fetch and build manifests from public sources
examples/Demo notebooks and curl examples
docker/Dockerfile and compose templates

Use Cases

  • Retrieval-augmented generation (RAG)

    • Run the MCP server locally to expose curated government documents. Use a retriever that queries the manifest metadata and streams the selected documents directly into model prompts.
    • Example: fetch manifest list and download a matching file
      curl http://localhost:8080/datasets | jq .
      curl http://localhost:8080/datasets/{dataset_id}/manifest | jq .
      curl -o doc.json http://localhost:8080/files/{file_id}
      
  • Local, private deployments for data governance

    • Host sensitive or embargoed government data behind your network boundary while keeping the same MCP API surface used in public deployments.
  • Training and fine-tuning workflows

    • Use the server to stage large, structured government datasets and stream shards directly into a training pipeline. Mount the data volume into training containers for low-latency access.
  • Catalog and metadata services

    • Integrate manifests into an enterprise data catalog or search layer to provide dataset-level discovery and provenance for analysts and models.

Quick API Examples

Below are representative examples of typical API interactions. Exact endpoints may vary slightly depending on your build; consult the server /docs endpoint after starting.

List all datasets

curl http://localhost:8080/datasets

Get a dataset manifest

curl http://localhost:8080/datasets/{dataset_id}/manifest

Download a file referenced by a manifest

curl -O http://localhost:8080/files/{file_id}

Python example using requests

import requests

base = "http://localhost:8080"
datasets = requests.get(f"{base}/datasets").json()
manifest = requests.get(f"{base}/datasets/{datasets[0]['id']}/manifest").json()
print(manifest)

Tips and Next Steps

  • Start with the provided example data and manifests to verify the server is configured correctly.
  • Use docker-compose for reproducible local environments and CI integration.
  • If you plan to scale, mount data from a shared filesystem or object storage; update manifest URLs accordingly.
  • Consult the MCP spec and adapt manifest schemas to your downstream retriever or model needs.

For source code, issues, and contributions, see the project on GitHub: https://github.com/Program-Integrity-Alliance/pia-mcp-local.