OpenContracts (Demo)
Open-source document intelligence you can build on.
Point OpenContracts at a repository of documents and get a programmable citation graph — human annotation, structured extraction, AI agents, and a built-in MCP server, all behind one API. Self-hosted, MIT-licensed, and built for teams working at scale.
Same graph, three surfaces: a GraphQL + REST API for your apps, a Model Context Protocol server for your agents, and a React UI for your team.
From documents to a citation graph — in about a minute
Create a corpus, drop in your documents, and click Set up. That one click installs the intelligence bundle: agents describe and summarize every document, and the reference web starts weaving — every statutory citation detected, resolved, and drawn as an edge.

By the end of the clip, 36 SEC filings are a navigable graph — wired to the Delaware General Corporation Law, the Securities Act, and the SEC rules they cite, section by section. Law the library doesn't hold yet isn't dropped on the floor: it's tracked as a backlog, automatically, until you ingest it.
Then explore it — and ask it questions
Citations are highlighted inline on the filings themselves. The References panel lists everything a document cites — click any cite to open the statute, with its own cross-references and everything that cites it back. The ask bar runs a corpus-scoped agent whose answers come back grounded and cited.

Everything in both clips is the stock product against a local install — no custom code, and every surface the UI touches is also reachable over the API and MCP server below.
Here's the artifact those clips produce, frozen so you can read it — every filing wired to the exact section of law it cites, with bodies of law the library doesn't hold yet drawn as dashed nodes, tracked until you ingest them:

Build on it
OpenContracts is a platform, not a black box. Everything the UI does runs on surfaces you can call yourself — point it at the documents you already have and build your own tooling on top.
AI agents in Python
Spin up a document- or corpus-scoped agent in a couple of lines. Stream a chat response, or get a typed object back through a Pydantic model — every answer grounded in the annotations and citations your team has built.
agent = await agents.for_document(123, corpus=45)
async for chunk in agent.stream("Summarize the indemnification clauses"):
print(chunk.content, end="")
See the LLM framework guide.
MCP server — bring your own agent
Every corpus is exposed over the Model Context Protocol, so Claude, Cursor, or any MCP client can search it, walk its citation edges, and (when authorized) propose annotations of its own. No glue code required:
- Endpoints —
/mcp/(anonymous, public corpuses) and/mcp/me/(authenticated) - Discovery —
/llms.txtand/.well-known/mcp.json - Tools —
search_corpus,list_documents,get_document_text,list_annotations,list_relationships,list_threads,create_thread_message
See the MCP documentation.
Structured extraction at scale
Define a fieldset — a set of columns, each a natural-language query — and run it across an entire corpus. Extraction fans out over Celery workers and lands in a spreadsheet-style grid, hundreds of documents at a time, with human approve/reject on every cell.
See Write your own extractors.
A pluggable pipeline
Parsing, embedding, and thumbnailing are swappable components. Register a custom parser, embedder, or thumbnailer for your formats and everything downstream — search, annotation, agents — keeps working unchanged.
See the pipeline overview.
GraphQL + REST
The whole graph — corpuses, documents, annotations, relationships, extracts — is queryable over a typed GraphQL API (with REST for uploads and health checks). The React frontend is just one client; yours is another.
Why OpenContracts
Every document in a serious repository cites other documents. Statutes cite the acts that authorized them. Court opinions cite the precedents that bound them. Research papers cite the work that made them possible. Standards cite the RFCs they build on. Contracts cite the statutes that govern them. Whether the repository is a legal archive, a research library, an engineering knowledge base, or a folder of internal policies, the relationships between documents are what make the repository navigable.
Most repositories store files. They don't store the graph that connects them. A PDF in a folder is a leaf with no edges. A paper in a vendor database is locked behind a paywall. A clause in a contract is treated as text rather than a node. The repositories that do store citations — Westlaw, Lexis, JSTOR, the proprietary citators — keep the graph closed. Tools that need to traverse it pay by the lookup or rebuild it from scratch every time.
AI agents make this worse, not better. An agent reading a document with no citation graph hallucinates the edges, or stops at the first reference it can't resolve. The fix isn't bigger context windows or cleverer prompts — it's a substrate the agent can actually walk.
OpenContracts is that substrate. An open citation graph that any document repository can stand up. Documents are nodes. Citations are edges. Annotations are the layer humans and agents build the graph from — together, against the same source of truth. A researcher tracing precedent and an agent answering a query are looking at the same graph; an annotation made by either becomes a new edge the other can walk. Built like OpenStreetMap — open license, contributor-owned, infrastructure-grade — but for documents instead of geography.
Same graph, two interfaces: a GraphQL and REST API for humans and applications, a Model