Skip to main content
Glama
QuasiModalLabs

Agent-Ready Government

README.md
# Agent-Ready Government

**An unofficial MCP server that lets your own AI assistant handle the Canada Child Benefit: estimate it to the cent, then fill in the official application for you to sign.**

> **Unofficial demo.** Built only from public canada.ca pages. Not affiliated with, endorsed by, or connected to the Government of Canada or the Canada Revenue Agency. The CRA's calculator and services are authoritative. **Use made-up details only.**

https://github.com/user-attachments/assets/ed5b5f42-c911-460b-8cf7-32632d8880f8

## The idea

Most organizations are adding AI to their websites as a chatbot. A site chatbot can be good, but it doesn't know you, it only covers its own site, and when it's done you still fill in the form yourself.

This project tests the other path: people already carry an assistant that knows them. What if a service simply gave that assistant a proper MCP server, with exact rules, exact numbers, and a clear point where the person has to approve? (MCP, the Model Context Protocol, is the standard AI assistants like Claude and Meta's Muse use to connect to outside tools.)

**Instead of every site building its own AI, give people's own assistants an MCP server they can use.**

## Try it

The server is public, read-only and needs no account or key:

```
https://agent-ready-demo.quasimodallabs.workers.dev/mcp
```

**Meta Muse:** open the landing page at https://agent-ready-demo.quasimodallabs.workers.dev, copy the text under "Muse", and paste it into a new Muse conversation. Then ask in plain words, for example:

> My husband and I live in Ontario. Last year I made $40,000 and he made $25,000 (net income). We have a 4-year-old and a 10-year-old. What would our monthly Canada Child Benefit be?

> Can you help me fill out the application?

**Claude Code:**

```
claude mcp add --transport http agent-ready-demo https://agent-ready-demo.quasimodallabs.workers.dev/mcp
```

**Any other MCP client:** streamable HTTP at the URL above. If you get a 403 with error 1010, set a `User-Agent` header on your requests.

## What it does

| Tool | What it does |
| --- | --- |
| `estimate_ccb` | Monthly and annual federal CCB, with every calculation step and the rule it came from |
| `check_eligibility` | Eligible, not eligible, or "can't tell", with reasons |
| `explain_rule` | The rule's text, figures, source URL, access date and hash |
| `benefit_period_info` | Current payment period, base tax year, payment dates |
| `how_to_apply` | The official ways to apply, with links |
| `get_form_info` | Where to get the official RC66, its expected hash, the field list and the fill recipe |
| `prepare_form_fill` | Validates the application and returns a deterministic field map plus a hash |
| `verify_form_fill` | Checks the values read back from the filled PDF against the map |
| `start_review_demo` / `confirm_review_demo` | A human-approval round trip outside the chat |
| `ping` | Health and build |

## How it works

1. **The server decides every value.** Amounts and form fields come from rules encoded from public canada.ca pages. The assistant carries them; it doesn't invent them.
2. **The assistant does the work.** It downloads the official RC66 from canada.ca itself, fills it with the server's field map, reads the values back and asks the server to verify them.
3. **The server checks the result.** Every filled field must match exactly. If the application changes between preparing and verifying, the check fails.
4. **The person approves.** The SINs and signature are never collected. The person checks the printout, writes them in, signs and mails it. Nothing is ever submitted on anyone's behalf.

## Evidence

| Test | Result |
| --- | --- |
| Estimator vs the official CRA calculator | 10 of 10 scenarios match to the cent |
| Rounding rule, predicted before running | 2 of 2 match |
| Claude and Muse, plain-language questions | 3 of 3 each |
| Muse filling the official RC66 | 36 of 36 filled fields verified; printout correct; SINs and signature blank |
| First-time user on a phone | Muse found the form tools unprompted; verified first try |

Full method, results and screenshots policy: `SPIKE_RESULTS.md`, `PHASE1.md`, `PHASE3_FEASIBILITY.md`, `rules.md`, `ground_truth.json`.

## What broke, and what it taught

- **An agent altered a human's input.** Muse turned a six-character approval code into eight and said the user had typed it. Exact server-side checking caught it. Never let the agent be the source of truth for what the person typed.
- **Hosting defaults block agents.** Cloudflare's default bot check on workers.dev blocks Python's built-in HTTP client.
- **Large responses drop.** Muse's connection dropped responses above roughly 4 KB. Every response is now kept under 4 KB.
- **The website disagrees with itself.** A canada.ca worked example and the CRA calculator differ by a cent. A machine interface would have one answer.
- **The CRA's own GenAI chatbot**, tested on October 16 and 17, 2026, answered the first message in 5 of 15 tries. When it answered, it gave about $952.25 (the calculator says $952.24), cited its sources and asked for no personal details. Asked to fill the form, it said it could guide the person but could not complete a form with their personal information. A snapshot, not a verdict.

## Guardrails

- Made-up families only. Nothing is stored; tool arguments are never logged.
- No Government of Canada symbols in this repo or its videos.
- The server never fetches canada.ca's form files (robots.txt disallows that path). The person's own assistant downloads the form at their request.
- Every rule cites its source page, access date and content hash.

## Limits

- **Unofficial**, and it will go stale: figures cover July 2026 to June 2027.
- **Narrow:** federal CCB only, one or two children, no shared custody, the paper route.
- **Small samples:** most agent results are one or two runs.
- **Built with Claude Code.** The code was largely written by an AI coding assistant; the framing, architecture, guardrails and test design were mine.

## Run it locally

```
npm install
npm test
npx wrangler dev
```

Deploy with `npm run deploy` (Cloudflare account required; it stamps the build with the git commit). See `package.json` for all scripts.

## License

MIT. See `LICENSE`.