OpenContracts is a free, open source data engineering & integration project written in Python and released under MIT. It has 1,481 GitHub stars, 189 forks and 11 open issues, and was last pushed 8 hours ago. On this registry it ranks #29 of 39 tracked projects in Data Engineering & Integration, with 5 head-to-head comparisons available.

What is OpenContracts?

OpenContracts is an MIT-licensed, self-hosted document intelligence platform that turns a repository of documents into a programmable citation graph, built for builders and hackers who need a document management system for the agentic world as much as a place to store files.

What it is

OpenContracts is an open-source document intelligence platform written in Python and released under the MIT licence. It sits in the Data & Analytics / Data Engineering & Integration space, and its README describes it as "Open-source document intelligence you can build on." Point it at a repository of documents and it returns a programmable citation graph, combining human annotation, structured extraction, AI agents, and a built-in Model Context Protocol server behind one API. The same graph is exposed through three surfaces: a GraphQL and REST API for applications, a Model Context Protocol server for agents, and a React UI for teams.

The concrete problem it solves is that unstructured document sets, such as a stack of SEC filings, arrive without the connective tissue that makes them useful. Citations between documents have to be detected, resolved, and tracked before anything can be reasoned over them, and the law a library does not yet hold creates gaps. OpenContracts replaces the ad hoc scripts and manual citation chasing that teams otherwise write for this work. Its README walks through a corpus of 36 SEC filings that becomes a navigable graph wired to the Delaware General Corporation Law, the Securities Act, and the SEC rules the filings cite, section by section. Material the library does not hold yet is not dropped: it is tracked automatically as a backlog until it is ingested, and drawn as dashed nodes in the governance graph.

Key capabilities

  • A corpus-scoped and document-scoped agent interface in Python: spin up an agent in a couple of lines and stream a chat response.
  • A built-in MCP server for agent frameworks, alongside a GraphQL + REST API, so anything the React UI can do is callable from outside the product.
  • Automatic statutory citation detection and resolution: every detected cite becomes an edge, with inline citation highlighting on the documents themselves.
  • A References panel that lists everything a document cites and opens the statute with its own cross-references and the documents citing it back.
  • One-click corpus intelligence: create a corpus, drop in documents, and click Set up to install the bundle that has agents describe and summarize every document and weave the reference web.
  • Backlog tracking for bodies of law the library does not hold, with un-ingested law drawn as dashed nodes until it is ingested.
  • An ask bar running a corpus-scoped agent whose answers come back grounded and cited.

Who uses it and how

  • Legal, governance, and compliance teams working from dense regulatory corpora, such as SEC filings cross-referenced against Delaware corporate law and SEC rules.
  • Engineering teams building document tooling on top of an API rather than a closed application, using the GraphQL and REST surfaces directly.
  • AI and agent developers who need a citation-grounded retrieval layer and connect through the MCP server instead of a UI.
  • Data and ETL teams in the unstructured-data and vector-database space who need a corpus of documents loaded, annotated, and queryable at scale.
  • Mixed teams where one group annotates in the React UI while another calls the same graph programmatically against the same underlying data.

Getting started

The README shows a local install of the stock product, with no custom code required. A hosted demo is also available at contracts.opensource.legal for anyone who wants to see the corpus and citation graph before self-hosting.

How it compares

No list of paid products this project replaces is provided in the facts, and no comparable tools are named either. On the available evidence, OpenContracts stands alone in this registry.

When to use it — and when not to

Adoption means self-hosting and operating the stack yourself, including whatever database, storage, and supporting services the deployment requires, so teams without that operational capacity should weigh the effort carefully. The README excerpt shows a local install and the in-product Set up flow but does not spell out a package name, Docker image, or compose file in the material provided, so a prospective self-hoster should read the full repository and documentation before committing. Teams wanting a managed, zero-operations legal research product should look elsewhere, as this project explicitly targets self-hosting and building on top of the platform.

project readme (upstream, from github) — read inline

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.

Sponsor

Backend coverage backend
Frontend coverage frontend
Meta code style - black types - Mypy imports - isort License - MIT

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.

Create a corpus and set up collection intelligence in one click

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.

Explore the citation graph — inline citations, the references panel, and grounded answers

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:

The governance graph — filings linked to the statute sections they cite, down to the section, with un-ingested law tracked as dashed nodes


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.txt and /.well-known/mcp.json
  • Toolssearch_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

readme truncated — read the full docs on github

Frequently asked questions

Is OpenContracts free to use?

OpenContracts is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does OpenContracts do?

The open document intelligence platform for builders and hackers - DMS for the agentic world

What is OpenContracts written in?

OpenContracts is primarily written in Python. Its source is publicly available at https://github.com/Open-Source-Legal/OpenContracts, and it has 1,481 GitHub stars.