Developer reference
REST & MCP API
All REST responses are JSON with snake_case field names. The MCP endpoint is JSON-RPC 2.0 Streamable HTTP. Source of truth: docs/ARCHITECTURE.md.
REST endpoints
GET /api/search?q=&branch=
Instant search across titles, aliases, act numbers and clause text. branch is optional.
curl 'http://127.0.0.1:8181/api/search?q=BNS&branch=main'GET /api/acts?status=&branch=
List acts, optionally filtered by status (in_force, upcoming, repealed) and branch.
curl 'http://127.0.0.1:8181/api/acts?status=in_force&branch=main'GET /api/acts/:actId
Current text: act metadata, table of contents, sections and revision history.
curl 'http://127.0.0.1:8181/api/acts/constitution-1950'GET /api/acts/:actId/revisions/:sha
A full snapshot at one commit.
curl 'http://127.0.0.1:8181/api/acts/constitution-1950/revisions/<sha>'GET /api/acts/:actId/diff?from=&to=
Word-level diff of two revisions. from and to are commit SHAs.
curl 'http://127.0.0.1:8181/api/acts/constitution-1950/diff?from=<sha>&to=<sha>'GET /api/amendments?branch=main|upcoming
Amendments ordered by commit_date DESC.
curl 'http://127.0.0.1:8181/api/amendments?branch=main'GET /healthz
Liveness check.
curl 'http://127.0.0.1:8181/healthz'MCP client configuration
Add this to your MCP client (the exact key names vary by client). The server runs on port 8181.
mcpServers.bharatlaw
{
"mcpServers": {
"bharatlaw": {
"transport": "streamable-http",
"url": "http://127.0.0.1:8181/mcp"
}
}
}POST /mcp — initialize
curl -X POST 'http://127.0.0.1:8181/mcp' \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"demo","version":"1"}}}'MCP tools
search_indian_laws
{ query: string, branch?: "main" | "upcoming" }
get_act_section
{ act_id: string, section_num: string, revision?: string }
get_amendment_history
{ act_id: string, branch?: string }
diff_act_revisions
{ act_id: string, from: string, to: string }
Configuration
The API listens on 127.0.0.1:8181. Override the server-side base with API_BASE_URL and the browser base with NEXT_PUBLIC_API_BASE_URL. CORS is open (*).