bk-rosetta-mcp
Allows loading the FJC bankruptcy data and rosetta tables into Databricks Unity Catalog, with governed column metadata, and running read-only SQL queries through a Databricks SQL warehouse.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
bk-rosetta-mcp
Three public records of the same bankruptcy case, finally joined, with every answer traceable to the official definition.
An MCP server that resolves any U.S. bankruptcy concept across three public sources that have never been linked:
Spoke | Source | Example |
Official Form line | Official Bankruptcy Forms (U.S. Courts) | B106Sum line 3, "Your total liabilities" |
Hub: NIEM element | Individual Bankruptcy Data Collection IEPD, the published |
|
Statistical variable | FJC Integrated Database, bankruptcy (FY2008–present) |
|
Where the data comes from
All three sources are public. The repo bundles the IEPD (schema, business-rules workbook and sample petitions) and a 20,000-row sample of the FJC data. The Official Form PDFs themselves are not included; their fields reach the server through the IEPD workbook.
Source | Publisher | Get it | In this repo |
Official Bankruptcy Forms | Administrative Office of the U.S. Courts | Form fields come from the IEPD's business-rules workbook, which maps each form field to the schema ( | |
NIEM petition schema (IEPD) | Federal judiciary, NextGen CM/ECF | PACER developer resources → "IEPD for NextGen Bankruptcy Release 1.7" (direct zip) |
|
FJC Integrated Database, bankruptcy | Federal Judicial Center |
|
Ask in plain English. Claude resolves the term, quotes the official definition, names the form line, runs the query against real FJC data, and tells you what the data can't answer.
Built for the GSA MCP Hackathon. See Relation to the GSA template.
Quick start
Requires Node 20+.
npm install
npm run build:rosetta # walk the IEPD schema -> hub/rosetta.generated.json
npm run load:fjc -- data/sample/cpbank_fy2025_sample.tsv # 20,000 real FY2025 filings, bundled
npm test # 16 end-to-end tests over MCP stdioOpen the folder in Claude Code: .mcp.json starts the server. Or add it to any MCP client as node mcp/server.js. The server speaks MCP over stdio.
Related MCP server: bankruptcy
Getting the FJC data
The bundled sample lets everything run out of the box. For real numbers, load a full fiscal year.
1. Download. The FJC publishes the bankruptcy IDB on its dataset page. Under Text files, take FY2018–present (cpbank18on.zip, 887 MB; it unzips to cpbank18on.txt, about 3.6 GB, tab-delimited, 87 columns). Direct link: https://www.fjc.gov/sites/default/files/idb/textfiles/cpbank18on.zip. The codebook defines every variable.
mkdir -p data/raw
curl -L -o data/raw/cpbank18on.zip https://www.fjc.gov/sites/default/files/idb/textfiles/cpbank18on.zip
unzip data/raw/cpbank18on.zip -d data/raw # -> data/raw/cpbank18on.txtOn Windows PowerShell:
New-Item -ItemType Directory -Force data/raw
Invoke-WebRequest https://www.fjc.gov/sites/default/files/idb/textfiles/cpbank18on.zip -OutFile data/raw/cpbank18on.zip
Expand-Archive data/raw/cpbank18on.zip -DestinationPath data/rawdata/raw/ is git-ignored.
2. Load one fiscal year of new filings, locally (PGlite) or on Databricks:
npm run load:fjc -- data/raw/cpbank18on.txt --fy 2025 --filed-only
npm run load:databricks -- data/raw/cpbank18on.txt --fy 2025 --filed-only--fy 2025 keeps cases filed in federal fiscal year 2025 (Oct 2024–Sep 2025). --filed-only keeps new filings (SNAPFILE = 1). Both loaders keep the columns bound in spokes/fjc/bindings.json and one row per case: the FJC's rolling snapshots repeat cases, so each CASEKEY keeps its latest snapshot. Expect 557,540 rows for FY2025 from the September 2026 release. The Databricks load takes about 5 minutes end to end; the local load of a full year has not been timed.
3. Check with select count(*) from fjc_bk through query_fjc, or ask Claude "how many FY2025 filings are loaded?"
Loading other years
Several years from one file.
cpbank18on.txtholds every fiscal year from FY2018 on. Pass a list,--fy 2023,2024,2025, or omit--fyto load every year in the file. Then filter or group onfilefyin SQL. The one-row-per-case rule still holds: a case that appears in several snapshots keeps its latest one.FY2008–FY2017. These are in a separate file,
cpbank08to17.zip, on the same dataset page. Each load replacesfjc_bk, so load one file at a time. Codes changed over the years (see the codebook's "Code Changes Over Time"), and theORG*and Subchapter V columns don't exist for early years. Checkresolvebefore comparing across them.Size. One year of new filings is about 140 MB before upload (43 MB gzipped), so several years scale roughly linearly. Without
--filed-onlythe loader also keeps pending and closed cases, which are much larger.
On Databricks
The FJC data and the rosetta itself can live in Unity Catalog. Copy .env.example to .env and fill in your workspace host, SQL warehouse HTTP path, token, catalog and schema. Then run the Databricks loader above.
The loader streams the FJC file down to the bound columns, gzips it, uploads it to a UC volume, and builds these Delta tables with read_files:
fjc_bkandfjc_district, the FJC data;hub_elements,form_linesandfjc_bindings, the rosetta itself.
Every fjc_bk column carries its codebook meaning, its petition element and any caution as a UC column comment, so the mapping is governed metadata and not just a file in this repo. With BACKEND=databricks set in .env, query_fjc runs on the SQL warehouse. The tool contract is unchanged, and PGlite stays the default so the repo runs anywhere. --dry-run writes the files and SQL without connecting.
For querying, use a credential that can only SELECT on the FJC schema; see SECURITY.md.
Try these
Which form line captures total liabilities, what does the court call it, and what share of chapter 7 filers reported under $50,000?
What are the allowed values for nature of debt, how does the FJC code them, and what's the consumer share in the top five districts?
A debtor says they filed before. Where does that go on the petition, what does the FJC call it, and how many prior filers were there?
What does the FJC dataset NOT know about a petition?
Question 4 matters most. The server knows the limits of its own data.
Tools
All eight tools are read-only and annotated readOnlyHint: true, destructiveHint: false, idempotentHint: true.
Tool | What it does |
| Any handle in: a schema element, an FJC variable ( |
| An Official Form's fields in printed order, with line, element, definition, required flag and allowed values. Covers 30 forms. |
| A coded field's allowed values beside the FJC's coding of the same field. It flags where they diverge. |
|
|
| One read-only |
| Full XSD validation against the IEPD (NIEM 2.0 imports included, libxml2 via WebAssembly). Also reports which fields reach the FJC statistics. |
| Reads a petition back in plain English. Every answer appears with the form line and question it answers, coded values are decoded through the schema's code lists, and repeated items are labelled (Creditor 3). Headline facts come first, each with the FJC variable that counts it. |
| Turns a petition into EAV rows. The entity is the form within the submission, the attribute is the question's XPath, and the value sits in a column typed by the workbook (money, date, integer, boolean, text). Nested repeats carry an indexed path and |
Also exposed: resources rosetta://overview, rosetta://fjc and rosetta://walkthrough/{total-liabilities,nature-of-debt,prior-filing}, and prompts trace, ask_fjc and coverage. Prompt arguments are a single word in Claude Code (/mcp__bk-rosetta__coverage fjc); for longer questions, just ask in plain English.
What joining them turned up
The codebook and the data disagree. The FJC codebook says nature-of-business code
nmeans Non-profit Organization. In FY2025, 62,104 cases carryn, 40,713 of them consumer cases, and 61,881 are marked not tax-exempt in the separateTAXEXEMPTfield. In practicenmeans "None of the above". Filter on it to find non-profits and you get about 62,000 wrong rows. The petition schema adds a third scheme:o= Tax Exempt Entity,O= None of the above."Current" isn't "as filed". The FJC keeps both the first record (
ORGFEESTS) and the current record (FEESTS). The petition is the first record. For filing-fee status they differ in 48.0% of FY2025 filings, and the current value is blank for 173,709 cases filed as paid in full.Asset status changes after filing too. 22,254 FY2025 cases have a different asset-case status (funds for unsecured creditors, Form 101 line 17) on the current record than on the petition as filed (
ORGASSTCASEvsASSTCASE).The petition's own case is a document, not a case. In the schema every form extends NIEM's
nc:DocumentType. Only cited cases (prior, pending, affiliated, lawsuits) arej:CaseType, with disposition and status slots. So the XSD can say how a prior case ended but never how this one does. That's why 11 of the FJC's 87 columns (closing years, both debtors' outcomes and dates, chapter 11 dividend and future payments) have no petition counterpart.The schema carries dead and mislabelled elements.
BankruptcyCaseVoluntaryInvoluntaryCode,Chapter11PlanCode,Chapter11PlanFiledIndicatorandPlanAcceptedIndicatorare declared but used by no petition type.Chapter11PlanCodehas exactly the FJC's prepackaged-plan codes (Y/P/B), and the voluntary/involuntary code list labels its codes "v = Business, i = Consumer".CourtDivisionalOfficeCodeis defined as "an entity to whom money is owed".The codebook doesn't always match the data. Case outcome "discharge withheld, no financial-management course" is printed as zero (
0) but stored as the letterO. Liabilities rangeJ("not valid after 11/30/2015") still appears on an FY2025 filing. Circuit00is the D.C. Circuit, while district00is Maine.Null handling changes answers. "Chapter 13 filers with under $50k in debt" is 25.3% using
TOTLBLTSand 18.9% usingTOTDBTacross all 203,200 FY2025 chapter 13 filings, because 18,093 blank schedules become $0.Snapshots overlap. The FJC's rolling 06/30/2026 snapshot repeats 145,740 cases already in the FY2025 year-end snapshot. Counting FY2025 filings without deduping on
CASEKEYgives 703,280 instead of 557,540. Both loaders keep only the latest snapshot per case.Codebook line numbers are older than the forms. The FJC cites "Schedule J line 22"; the current form splits it into 22a–22c.
The IEPD's own samples drift. The NG1.6 involuntary sample petition fails validation against the NG1.7 schema.
validate_petitionreports exactly where.
Business rules as Schematron
npm run build:schematron turns the IEPD business-rules workbook into ISO Schematron, hub/rules/business-rules.sch, so any XML toolchain can check a petition against the rules the XSD can't express. It uses XPath 1.0, so any processor runs it (Saxon, schxslt, node-schematron). It contains:
Generated asserts: 27 required-field and 159 allowed-value asserts, in one pattern per form. Where several workbook rows share an XPath (one per printed item, such as federal, state and local tax refunds on Schedule A/B line 28), their value lists are merged into one assert. Each carries the workbook rule id (
BCO-101-0064-values) and the workbook's own error message. For value lists written as "code = label", only tokens that are real codes in the schema's code list are kept; 2 lists that can't be parsed safely are skipped and named in the file header.Hand-translated cross-field rules: chapter 12 must be business debt (BCO-101-0102 c), and the SSN/ITIN and EIN formats.
Consistency warnings: the Form 101 estimate ranges are checked against the Form 106Sum schedule totals. On the IEPD's own samples this flags three petitions that estimate $1–10 billion in liabilities against a $303 schedule total.
Of the 181 absolute rule contexts, 152 occur in the seven sample petitions.
Tested with a real Schematron engine. The tests run the rules with node-schematron (a dev dependency) on the two small IEPD samples, and on a tiny petition built from the workbook's own XPaths. On all seven samples the rules report only genuine findings:
Samples | Finding |
Chapter 11 Subchapter V (NG1.6.1 and NG1.7), chapter 7 "complete" | Estimated assets and liabilities on Form 101 contradict the Form 106Sum totals ($1–10 billion vs $303) |
Five of seven | BCO-101-0047 / BCO-105-0021: the workbook requires the county on a business address, but the samples omit it and the XSD doesn't enforce it |
The largest sample takes about 85 seconds in node-schematron, so the tests use the small ones; Saxon is much faster for bulk checking.
Repo structure
bk-rosetta-mcp/
├── README.md # This file
├── SECURITY.md # Vulnerability reporting + hackathon security notes
├── CLAUDE.md # Instructions for coding agents working in this repo
├── package.json # Scripts: build:rosetta, load:fjc, load:databricks, test
├── .mcp.json # Claude Code launches the server from here
├── .env.example # Databricks settings; copy to .env (git-ignored)
├── .github/workflows/ci.yml # Build the rosetta, load the sample, run the tests
├── mcp/
│ ├── server.js # Entry point: stdio transport, server instructions
│ ├── rosetta.js # Loads hub + spokes, joins them, resolve/search logic
│ ├── databricks.js # Databricks connection (query path and loader)
│ ├── validate.js # libxml2 (WebAssembly) XSD validation
│ ├── petition.js # Petition XML -> EAV rows -> plain-English reading
│ ├── tools/ # index.js registers the eight tools; fjc.js is the SQL backend
│ ├── resources/ # rosetta:// resources
│ └── prompts/ # trace, ask_fjc, coverage
├── hub/
│ ├── schema/ # The IEPD (extension + NIEM 2.0 imports), directory shape preserved
│ ├── fixtures/ # The IEPD's seven synthetic sample petitions
│ ├── iepd/ # IEPD README, changelog, document, business-rules workbook
│ ├── rules/business-rules.sch # ISO Schematron, generated by `npm run build:schematron`
│ └── rosetta.generated.json # Generated by `npm run build:rosetta` (git-ignored)
├── spokes/
│ ├── forms/business-rules.json # 2,197 form fields -> XPath, line, rule (from the workbook)
│ ├── fjc/bindings.json # All 87 FJC variables -> hub element or related elements, codebook page, code lists, cautions
│ ├── fjc/districts.json # Codebook Appendix A
│ └── synonyms.json # Curated plain-language phrases for resolve
├── tools/ # build-rosetta.js (XSD walker), build-schematron.js, load-fjc.js, load-databricks.js, extract-business-rules.py
├── data/
│ ├── sample/ # First 20,000 FY2025 filings (bundled)
│ └── raw/ # Full FJC download goes here (git-ignored)
├── docs/ # Overview, FJC notes and caveats, EAV design, three worked walkthroughs
├── eval/ # 10 gold questions (evaluation.xml) + how each answer was derived
└── test/ # End-to-end tests over MCP stdioEvaluation
eval/evaluation.xml holds 10 gold questions in the hackathon template's mcp-builder format. Each has a single verifiable answer from the full FY2025 load, and each is built around a trap an agent would fall into without this server: blank schedules counted as $0, as-filed vs current fee status, the NOB code that doesn't mean what the codebook says, non-individual debtors in the counts, and so on. eval/README.md shows the tool path and SQL behind every answer.
Relation to the GSA MCP hackathon template
The GSA MCP hackathon template is a Python/FastMCP starter. This server is written in Node with the official MCP TypeScript SDK, because its two heaviest pieces are JavaScript: XSD validation runs libxml2 compiled to WebAssembly, and the local database is PGlite (Postgres in WebAssembly). It follows the template's conventions where they apply:
Read-only tool annotations on every tool.
Tool design tips for federal data:
Results are structured JSON with consistent keys, not prose.
The
query_fjcdescription states the data's as-of release and fiscal year.Errors return a
hint, and results are capped at 25 rows.No tool fetches a caller-supplied URL.
No personal data exists to leak: the FJC publishes no names, SSNs or addresses.
SECURITY.mdwith a hackathon note.CI on every push.
An
eval/directory with gold questions in themcp-builderformat. The template'smcp-evalPhoenix harness can run them againstnode mcp/server.jsunchanged.
Next steps
Deploy as a Databricks App. The template's
deploy/databricks/kit runs an MCP server as a Databricks App over streamable HTTP at/mcp, with a/healthcheck. For this server that means three things:Add the SDK's
StreamableHTTPServerTransportwhenDATABRICKS_APP_PORTis set.Add an
app.yamlthat runsnode mcp/server.js.Have the SQL backend use the app's injected service principal (
DATABRICKS_CLIENT_ID/DATABRICKS_CLIENT_SECRET) instead of a personal token.
The server would then run inside the workspace next to the data, behind workspace authentication. This needs Databricks Apps enabled on the workspace.
Semantic search in
resolve. Precompute embeddings of each element's XSD definition, form-field text and codebook meaning at build time. Rank candidates by meaning as well as by words, so "does the debtor rent" findsDebtorRentsResidenceIndicatorwithout a synonym.A
check_rulestool, and the rest of the rules. The Schematron is tested but not yet exposed as a tool; a faster engine (Saxon) would make that practical on large petitions. About 25 of the workbook's conditional rules are still English only.Store petition values.
shred_petitionreturns rows; apetition_valuestable on Databricks (DDL in docs/eav.md) would hold them for querying across submissions.MCP registry. Add
server.jsononce the repository has its public home.More FJC columns. Case outcomes (
D1FDSP, discharge dates) are loaded but not yet joined to the petition's eventual fate;CASETYP(voluntary vs involuntary) would tie cases to B101 vs B105.
Data and caveats
The figures in this README and in docs/ come from all 557,540 FY2025 new filings (FJC cpbank18on.txt, released September 2026), loaded on Databricks. The bundled sample is the first 20,000 FY2025 new-filing rows, not a random sample, so numbers from it are illustrative.
Schedule totals are debtor-reported, not validated, and required only for individuals with primarily consumer debts. The FJC covers every bankruptcy case, while this IEPD covers the individual petition, so filter dbtrtyp = 'i' for petition-level questions. See docs/fjc.md for the full list of caveats.
Everything here is public: no CM/ECF internals, no real debtor data. Write-side features (generating or filing a petition) are out of scope.
Sources
Official Bankruptcy Forms: https://www.uscourts.gov/forms-rules/forms/bankruptcy-forms
IEPD for NextGen Bankruptcy Release 1.7 (PACER developer resources): https://pacer.uscourts.gov/file-case/developer-resources, direct zip https://pacer.uscourts.gov/sites/default/files/files/NGRel1.7_Individual_BK_Data_Collection_new.zip
Bankruptcy case information file (case upload spec): https://pacer.uscourts.gov/sites/default/files/files/Mar_2022_case_upload_spec.pdf
NIEM: https://www.niem.gov
FJC IDB, bankruptcy (dataset page): https://www.fjc.gov/research/idb/bankruptcy-cases-filed-terminated-and-pending-fy-2008-present
FJC IDB, FY2018–present text file: https://www.fjc.gov/sites/default/files/idb/textfiles/cpbank18on.zip
FJC codebook (rev. 02/28/2023): https://www.fjc.gov/sites/default/files/idb/codebooks/Bankruptcy%20IDB%20Online%20Codebook%20rev%2002282023.pdf
Security and license
See SECURITY.md. MIT for the code. The IEPD and FJC materials are U.S. government works, included for convenience.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Search public U.S. federal litigation: companies, cases, dockets and document metadata.
Resolve, search and verify legal citations against the official sources, with provenance.
SEC Financial Statement & Notes data sets — dimensional facts + note text.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceEnables semantic search and exploration of a business glossary knowledge graph, allowing users to query terms, expand related concepts, trace dependencies, and resolve physical table mappings.-
- AlicenseNot gradedqualityBmaintenanceEnables searching and retrieving business bankruptcy filing metadata from US federal courts, including company, court, dates, and judge, without an API key.58 npmMIT
- AlicenseAqualityBmaintenanceEnables users to discover, search, validate and cross-map versioned statistical code systems — including industry, occupation, product, education and questionnaire response hierarchies — with deterministic retrieval and provenance. It supports questionnaire development, survey coding and reproducible statistical harmonisation without running any AI model inside the server.101MIT

aethis-mcpofficial
AlicenseAqualityAmaintenanceEnables clients to run deterministic eligibility and decision evaluations from compiled legislation, policy, contracts, and regulation, inspect schemas and traces, route next questions, and discover rulesets, with optional private-beta authoring tools for rule generation, testing, refining, and publishing.36395 npm2MIT