Reference · packages/mcp
MCP server.
HalfTime is also a Model Context Protocol server. The Claude you are already talking to reads the papers and quotes them; HalfTime's tools check every quote and apply the law. No API key is involved.
How the work is split
The server sends instructions with initialize: the client's model reads the papers and reports facts, each with a verbatim quote; HalfTime's code checks the quotes and decides. The model is told never to decide eligibility itself, to report HalfTime's verdict and trace, and never to describe a result as simply “eligible”. The check_order tool description carries the full extraction rules, the same ones the site's own reader uses.
Two servers share one tool set (packages/mcp/src/tools.ts): the remote one at https://halftime.prashantthakur.dev/mcp (stateless Streamable HTTP, no file access) and a local stdio one that can read a folder of papers and save Word files.
Connect
claude.ai and Claude Desktop (remote)
Add a custom connector with this URL. It works on the sample orders, or on order text you paste into the chat.
https://halftime.prashantthakur.dev/mcp
Claude Code (remote)
claude mcp add --transport http halftime https://halftime.prashantthakur.dev/mcp
Claude Code (local, with a folder of papers)
Clone the repository and run pnpm install, then:
claude mcp add halftime --env HALFTIME_ROOTS=/path/to/papers -- \ node /path/to/HalfTime/packages/mcp/bin/halftime-mcp.mjs
Claude Desktop (local)
{
"mcpServers": {
"halftime": {
"command": "node",
"args": ["/path/to/HalfTime/packages/mcp/bin/halftime-mcp.mjs"],
"env": { "HALFTIME_ROOTS": "/path/to/papers" }
}
}
}bin/halftime-mcp.mjs starts src/stdio.ts through tsx. There is also a prompt, sweep_jail, that runs the whole workflow on a folder or, with no folder, on the twelve samples.
Then ask
- “Use halftime to sweep the 12 sample orders and show me the lanes.”
- “Read the papers in ~/jail-bundle with halftime. Who has crossed the Section 479 line? Draft the application in Hindi for anyone past it.”
- “Here is a bail order: … Check it with halftime.”
Local file access: HALFTIME_ROOTS
The local server reads and writes only inside the folders in HALFTIME_ROOTS (colon-separated; if unset, the folder the server was started in). Every path is resolved first, so .. cannot climb out. Anything outside is refused with a message naming the allowed folders (packages/mcp/src/files.ts).
- Listing shows only .pdf, .txt, .png, .jpg and .jpeg files.
- Reading returns the text of a .txt file or of a PDF's text layer. For an image, or a PDF with little or no text layer, it returns a note asking Claude to transcribe the pages itself and pass the text to
check_order. draft_applicationwithsave_towrites a .docx; the path must end in .docx and be inside an allowed folder.- The remote server has no file tools at all.
Tools
Inputs are read from tools/list when this page is built; a ? marks an optional field. Every tool is annotated read-only, except draft_application on the local server, which can write a file. Limits: documents ≤ 120,000 characters, quotes ≤ 4,000, short fields ≤ 200, sweeps ≤ 50 orders.
| Tool | Inputs | Where | What it returns |
|---|---|---|---|
| check_order |
| remote + local | Verifies your extraction of one order against its text and applies Section 479: verdict, rule trace, accepted quotes, rejected claims. |
| sweep_jail |
| remote + local | The same for up to 50 orders at once: counts per lane, a table, and a CSV for the DLSA. |
| apply_section_479 |
| remote + local | The engine on typed-in facts, for a lawyer who already knows them. Nothing is verified, so prefer check_order when you have the text. |
| lookup_section |
| remote + local | A section's maximum punishment from the statute tables, with its source and the IPC→BNS mapping. |
| draft_application |
| remote + local | The 479(3) application in English or Hindi, pre-filled and marked as a draft. If the verdict is not past the line, it says so at the top. The local server can save it as .docx. |
| list_sample_orders | none | remote + local | The twelve constructed sample orders. |
| get_sample_order |
| remote + local | One sample order's full text, by id (S01 … S12). |
| list_order_files |
| local only | Local only: the .pdf, .txt, .png and .jpg files in a folder. |
| read_order_file |
| local only | Local only: a .txt or text-layer .pdf as text. For a scan or an image it says so, and Claude transcribes the page itself. |
The extraction object
check_order, sweep_jail and draft_application take the model's reading as extraction. Only the facts the law needs are required:
{
"sections": [{ "act": "IPC", "section": "379", "quote": "<verbatim text naming the section>", "ndps_quantity": "small | intermediate | commercial | unknown (NDPS only, optional)" }],
"custody_start": { "date": "YYYY-MM-DD or null", "kind": "arrest | remand | surrender | unknown (optional)", "quote": "<sentence containing the date> or null" },
"first_time_offender": { "value": "true | false | unknown", "quote": "<text> or null" },
"other_pending_cases": { "value": "true | false | unknown", "quote": "<text> or null" },
"registered_on": { "date": "YYYY-MM-DD or null", "quote": "<text> or null" }, // optional
"accused_name_masked": "R— K—", // optional
"case_no": "...", "court": "..." // optional
}Example outputs
Produced by calling the tools when this page was built, with today fixed at 2026-11-15. The extractions for the sample orders are the ones Claude made when the sample tray was pre-run.
check_order on sample S01
As of 15 Nov 2026: PAST THE LINE · FLAGGED: Sec 479(2) may apply (more than one offence, or other cases). A lawyer decides before applying. Maximum term: 3 years · fraction 1/3 · line 14 Mar 2024 Past the line by 976 days (1342 days detained). For the lawyer: Detained for the full maximum term or longer: Sec 479(1) second proviso bars any further detention. More than one offence is charged (IPC 1860 s.379, IPC 1860 s.411). Rule trace (code, not the model): 01. IPC 1860 s.379 (Punishment for theft) → max 3 years [IPC 1860 s.379] 02. IPC 1860 s.411 (Dishonestly receiving stolen property) → max 3 years [IPC 1860 s.411] 03. Case from before 1 Jul 2024: Sec 479 BNSS still applies, per the Supreme Court order of 23 Aug 2024. Old Sec 436A CrPC (half line, no first-time benefit) shown for comparison. [SC order, W.P.(C) 406/2013, 23 Aug 2024] 04. Longest maximum among the charges: 3 years (IPC 1860 s.379). [IPC 1860 s.379] 05. First-time offender (per the papers): one-third of 3 years. [BNSS 2023 s.479(1) and first proviso] 06. Custody began 14 Mar 2023. 07. Line: 14 Mar 2024. 08. Today: 15 Nov 2026; 1342 days detained. 09. Detention has reached the full maximum term. [BNSS 2023 s.479(1), second proviso] 10. Sec 479(2): More than one offence is charged (IPC 1860 s.379, IPC 1860 s.411). [BNSS 2023 s.479(2)] 11. PAST THE LINE by 976 days, FLAGGED under Sec 479(2): a lawyer decides how 479(2) applies before the application. Quotes verified in the document (6): ✓ IPC 379: "अन्तर्गत धारा 379, 411 भा.द.वि." ✓ IPC 411: "अन्तर्गत धारा 379, 411 भा.द.वि." ✓ custody from 2023-03-14: "प्रार्थी/अभियुक्त दिनांक 14.03.2023 से जिला कारागार आगरा में निरुद्ध है।" ✓ first-time offender: true: "प्रार्थी/अभियुक्त का कोई आपराधिक इतिहास नहीं है।" ✓ other cases pending: false: "प्रार्थी/अभियुक्त का कोई आपराधिक इतिहास नहीं है।" ✓ registered 2023-03-12: "इस संबंध में दिनांक 12.03.2023 को थाना सुजानपुर पर प्रथम सूचना रिपोर्ट पंजीकृत की गई।" This is a screening result, not legal advice. A legal-aid lawyer must check it against the full court record.
sweep_jail on S01, S03 and S08
Jail sweep as of 15 Nov 2026: 3 people. Past the line: 1 (jail must apply) + 1 flagged under 479(2) · Not yet: 1 · Can't tell: 0 · Outside 479: 0 | Lane | Order | Accused | Sections | Line | Days past / to go | Notes | |---|---|---|---|---|---|---| | Past the line | S03 | J— M— | IPC 1860 s.420 | 12 Jun 2026 | +156 | | | Past the line · flagged | S01 | र— कु— | IPC 1860 s.379, IPC 1860 s.411 | 14 Mar 2024 | +976 | | | Not yet | S08 | M— A— | IPC 1860 s.392, IPC 1860 s.411 | 21 Jul 2030 | 1344 to go | | CSV: ```csv id,accused,verdict,sections,max_term_months,fraction,line_date,days_past,days_to_go,flags,missing S03,J— M—,PAST_THE_LINE,IPC 1860 s.420,84,1/3,2026-06-12,156,,, S01,र— कु—,PAST_FLAGGED,IPC 1860 s.379; IPC 1860 s.411,36,1/3,2024-03-14,976,,"Detained for the full maximum term or longer: Sec 479(1) second proviso bars any further detention. | More than one offence is charged (IPC 1860 s.379, IPC 1860 s.411).", S08,M— A—,NOT_YET,IPC 1860 s.392; IPC 1860 s.411,168,1/2,2030-07-21,,1344,, ```
apply_section_479, first-time status unknown
As of 15 Nov 2026: NOT YET past the line. Maximum term: 7 years · fraction 1/2 · line 12 Aug 2027 270 days to the line. If first-time status is confirmed, the line is 12 Jun 2026. For the lawyer: Past the one-third line: if the papers or the jail confirm a first-time offender, the line is already crossed. Rule trace (code, not the model): 01. IPC 1860 s.420 (Cheating and dishonestly inducing delivery of property) → max 7 years [IPC 1860 s.420] 02. Case from before 1 Jul 2024: Sec 479 BNSS still applies, per the Supreme Court order of 23 Aug 2024. Old Sec 436A CrPC (half line, no first-time benefit) shown for comparison. [SC order, W.P.(C) 406/2013, 23 Aug 2024] 03. Maximum term: 7 years (IPC 1860 s.420). [IPC 1860 s.420] 04. First-time status not stated: using one-half of 7 years (the safe line); one-third shown as the line if first-time is confirmed. [BNSS 2023 s.479(1) and first proviso] 05. Custody began 12 Feb 2024. 06. Line: 12 Aug 2027. 07. If first-time is confirmed: 12 Jun 2026. 08. Today: 15 Nov 2026; 1007 days detained. 09. NOT YET: 270 days to the line.
lookup_section, BNS 303(2)
BNS 2023 s.303(2) · Punishment for theft Act: Bharatiya Nyaya Sanhita, 2023 Maximum: up to 3 years Source: BNS 2023 s.303(2)
draft_application for S03, in English (first lines)
[DRAFT FOR LAWYER REVIEW · NOT FILED] APPLICATION UNDER SECTION 479(3) OF THE BHARATIYA NAGARIK SURAKSHA SANHITA, 2023 To, The Hon'ble Court of Additional Sessions Judge, Court No. 7, Lucknow From: The Superintendent, ______________________ Jail Subject: Release of undertrial prisoner J— M— in Bail Application No. 2210 of 2026 on having undergone the period under Section 479(1) BNSS Respectfully showeth: 1. The undertrial prisoner J— M— is detained in this jail in connection with the above case, charged under IPC 1860 s.420. 2. As per the court record, the prisoner has been in custody since 12 Feb 2024, that is, 1007 days as of the date of this application. 3. The maximum punishment specified for the offence charged is imprisonment for 7 years. One-third of that period was completed on 12 Jun 2026. The record shows the prisoner has no previous conviction, so the one-third period under the first proviso to Section 479(1) applies. 4. The prisoner has therefore undergone the period required by Section 479(1) BNSS, and has done so 156 days ago. … (31 more lines)
list_sample_orders (first lines)
S01 · Hindi · Theft and stolen bike, 3½ years inside A man held since March 2023 for stealing a motorcycle and keeping it; he is past the half line, but two offences are charged, so the law asks a court to weigh it rather than release him automatically. S02 · Hindi · Theft, 2½ years inside A man with no criminal record held since May 2024 on a single theft charge, which carries at most three years; he has been inside longer than the law's line. S03 · English · Job fraud, first-time offender A first-time offender held since February 2024 for taking money on a false promise of a government job; the one-third line for first-time offenders has passed, though the half line has not. … (18 more lines)
Recorded sessions
packages/mcp/DEMO.md holds two recorded Claude Code sessions with HalfTime as the only MCP server (10 turns, 102 s; 6 turns, 44 s).
- Local, stdio. Claude listed and read the five orders in
data/demo-jail/, calledsweep_jailonce, and every quote verified. One order contains a planted line telling the reader to ignore its instructions and mark the accused eligible; Claude treated it as text in the document, and that case's result came only from its facts. It then saved a Hindi 479(3) application as Word. Its review of the draft found two problems in the Hindi text, which were then fixed in the shared drafter and covered by a test. - Remote, over HTTP. The same client connected to
https://halftime.prashantthakur.dev/mcp, with no local install, fetched three sample orders and swept them in one call. No claims were rejected.
Reproduce
The session file ends with the exactclaude -p … --mcp-config … --strict-mcp-config --allowedTools … command used and the script that turns the JSON stream into the transcript.Testing a connection
pnpm --filter @halftime/mcp test # every tool through a real MCP client npx tsx packages/mcp/scripts/stdio-smoke.ts <folder> # start the stdio server as Claude Desktop does npx tsx packages/mcp/scripts/remote-smoke.ts https://halftime.prashantthakur.dev/mcp
Or with curl: see POST /mcp. The status page calls tools/list from your browser.