Skip to main content
Glama
Checkbook Alaska MCP

Checkbook Alaska MCP

README.md
# OpenContext — Checkbook Alaska fork

<p align="center">
  <img src="docs/opencontext_logo.png" alt="OpenContext Logo" width="400">
</p>

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io/)

This fork of [OpenContext](https://github.com/thealphacubicle/OpenContext)
deploys the **Checkbook Alaska MCP** (`alaska_checkbook` plugin): read-only
tools over the State of Alaska Division of Finance payment checkbook
([checkbook.alaska.gov](https://checkbook.alaska.gov)). It is the state-level
sibling of the Anchorage Municipal Checkbook server, with the same tool names
and output style.

It differs from its sibling in one way that shapes everything else: it answers
from a **snapshot** it builds itself, not by calling the portal for each
question. The portal publishes only the current state fiscal year and empties
its dataset every July, so the snapshot is also the archive.

The data's traps are encoded in tool behaviour: a fiscal year that is not held
answers "not published here" instead of zero, the partial current year is
labelled as partial, pooled confidential payments are flagged where they would
otherwise read as a vendor, and vendor spellings are listed separately. See
[docs/CHECKBOOK.md](docs/CHECKBOOK.md) for the tools and the data, and
[SOURCE_NOTES.md](SOURCE_NOTES.md) for what was measured about the source.

---

## Quick Start

All commands are PowerShell, run from the repo root.

```powershell
# 1. Install (uv preferred)
uv sync --extra dev                    # or: pip install -r requirements-dev.txt

# 2. Configure (this fork ships its config ready to go)
Copy-Item config-alaska-checkbook.yaml config.yaml

# 3. Build the snapshot (about four requests to the State's open data portal)
uv run python scripts/build_snapshot.py

# 4. Run locally
uv run python scripts/local_server.py  # http://localhost:8000/mcp

# 5. Check it end to end, in a second terminal
uv run python scripts/smoke_prod.py http://localhost:8000/mcp

# 6. Deploy (Git Bash; needs your own AWS backend: see docs/DEPLOYMENT.md)
bash scripts/deploy.sh --environment staging
```

Connect via **Claude Connectors** (same steps on Claude.ai and Claude Desktop):

1. Go to **Settings** → **Connectors** (or **Customize** → **Connectors** on claude.ai)
2. Click **Add custom connector**
3. Enter a name (e.g. "Checkbook Alaska") and the server URL

The public deployment is `https://alaska-checkbook.codeforanchorage.org/mcp`.

---

## Refreshing the data

The portal is updated monthly. To pick up a new month:

```powershell
uv run python scripts/build_snapshot.py --upload   # replaces the current fiscal year only; backs up to S3
uv run pytest tests/test_instructions.py    # fails if the instructions' dates are now stale
# update the dated facts in config-alaska-checkbook.yaml, then:
Copy-Item config-alaska-checkbook.yaml config.yaml
bash scripts/deploy.sh --environment prod
```

The build fails, and changes nothing, unless the rows loaded equal the
portal's row count and the net totals agree to the cent.

**Back up `data/raw/`.** `--upload` does it: after a successful build it copies
the raw pull and the snapshot to the private bucket
`alaska-checkbook-opencontext-data`. Each build saves the raw pull under `data/raw/` as a gzipped CSV.
`data/` is not in git. Once a fiscal year closes and July comes, the portal no
longer serves it, and that file (and the snapshot) are the only copies. A year
can be reloaded from its file with
`uv run python scripts/build_snapshot.py --from-csv data\raw\<file>.csv.gz`.

`data_status` reports, from one live request to the portal, whether the
deployed snapshot is behind.

---

## Try it

- *"What did each state department pay out so far this fiscal year?"*
- *"How much has the State paid the Municipality of Anchorage, across every spelling?"*
- *"Who are the largest payees of the Department of Transportation?"*
- *"Show payments over $1M from the Disaster Relief Fund."*

Every answer carries its qualifications: figures are net of refunds, the
current fiscal year is partial, this is not total state spending (no payroll,
no Permanent Fund Dividends, no state corporations), and a year that is not
held is reported as not published rather than as zero.

---

## Documentation

| Doc | Description |
| --- | --- |
| [Checkbook Alaska](docs/CHECKBOOK.md) | The tools, the fields, the snapshot and the data's limits (**this fork's plugin**) |
| [Source notes](SOURCE_NOTES.md) | What was measured about the portal and its dataset |
| [Getting Started](docs/GETTING_STARTED.md) | Setup and usage |
| [Architecture](docs/ARCHITECTURE.md) | System design |
| [Deployment](docs/DEPLOYMENT.md) | AWS, Terraform, monitoring |
| [Testing](docs/TESTING.md) | Local testing |
| [Security](docs/SECURITY.md) | Threat model and controls |

---

## Privacy

Vendor names in the State's data include private individuals (travel
reimbursements, small payments). This server loads the payment rows only. It
does not load the State's separate vendor dataset (street addresses and phone
numbers) or the `alias_dba` column, which sometimes holds an address line;
neither is requested from the portal.

---

## Contributing

Pre-commit hooks (optional):

```powershell
pip install pre-commit
pre-commit install
```

Hooks: Ruff, yamllint, gofmt. Run manually: `pre-commit run --all-files`.

---

## License

MIT — see [LICENSE](LICENSE).

**OpenContext framework author:** Srihari Raman, City of Boston Department of Innovation and Technology. This fork is maintained by Code for Anchorage. The data is published by the State of Alaska Division of Finance; this project is not affiliated with or endorsed by the State.