OpenContracts

Self-hosted document intelligence with a citation graph, annotation, and MCP server.

Overview

OpenContracts is an open-source, self-hosted document intelligence platform that turns a repository of files into a programmable citation graph. It combines human annotation, structured extraction, AI agents, and a Model Context Protocol server behind a single API, and presents the same graph through a React interface, a GraphQL and REST API, and an MCP endpoint. The project is MIT-licensed and intended for teams working with document sets at scale.

The product is aimed at people who need to navigate what documents cite rather than merely store them: statutory citations, precedent, standards, governing contracts, and similar reference relationships. Once documents are uploaded, agents describe and summarize them and detected citations are resolved and drawn as edges. References the library does not yet hold are tracked as a backlog rather than discarded, and citations are highlighted inline with a References panel that lists what a document cites and what cites it back.

What distinguishes OpenContracts is that the interface is not a closed box. The UI runs on surfaces users can call directly, including document- and corpus-scoped agents in Python, a pluggable MCP server, structured extraction across an entire corpus, and swappable parsing, embedding, and thumbnail components. A corpus-scoped agent answers questions with grounded, cited responses, and every graph element, from corpuses and documents to annotations, relationships, and extracts, is queryable through the typed API.

Best for

  • Legal operations and contract analysts
  • Compliance and policy researchers
  • Knowledge base and research library managers
  • Software engineers building document tooling
  • Data extraction and annotation teams
  • Legal services
  • Financial services
  • Research and academia
  • Engineering and standards
  • Corporate compliance

How to use

  1. Create a corpus and upload your documents.
  2. Click Set up to install the intelligence bundle and begin citation resolution.
  3. Review inline citation highlights and open cites from the References panel.
  4. Ask corpus-scoped questions in the ask bar to get grounded, cited answers.
  5. Define a fieldset and run it across the corpus, then approve or reject each extracted cell.
  6. Connect an MCP client or call the GraphQL and REST API to build your own tooling.

What it can do

Citation graph construction

Uploading documents and completing setup installs an intelligence bundle that has agents describe and summarize each document while statutory and other detected citations are resolved and drawn as graph edges. Citations appear highlighted inline, and a References panel shows everything a document cites alongside everything that cites it back, so readers can move from a filing to the statute at the cited section.

Grounded, cited question answering

An ask bar runs a corpus-scoped agent whose answers are grounded and cited. The same behavior is available programmatically: agents can be created for a single document or a whole corpus, stream chat responses, and return every interaction with sources, metadata, and conversation tracking so answers can be traced back to the underlying annotations and citations.

Structured extraction at scale

A fieldset defines a set of columns, each expressed as a natural-language query with an output type, optional constraints, and instructions. Running the fieldset across a corpus fans extraction out over Celery workers and lands results in a spreadsheet-style grid, covering many documents at a time, with human approve or reject on each cell.

MCP server for external agents

Each corpus is exposed over the Model Context Protocol through anonymous endpoints for public corpuses and authenticated endpoints for private work, with discovery files for clients. Tools include searching a corpus, listing documents, retrieving document text, listing annotations, relationships, and threads, and posting thread messages, so clients can search, walk citation edges, and, when authorized, propose annotations without glue code.

Python agent framework

The agent API, built on PydanticAI with a pluggable architecture, supports document agents for standalone files or files within a corpus, corpus agents, and typed one-shot extraction through Pydantic models. It includes conversation persistence, automatic message storage and retrieval, nested streaming with child-agent visibility, and an extensible tool system for document analysis and data retrieval.

Pluggable ingest pipeline

Parsing, thumbnail generation, and embedding are swappable components behind abstract base classes. An optional file-conversion step can turn office, legacy word-processor, web, and image formats into PDF before parsing, while natively supported formats keep their own parsers. Components are seeded from configuration and then managed from a database-backed settings record, and downstream search, annotation, and agents continue to work when a component is replaced.

Unified graph API

The full graph of corpuses, documents, annotations, relationships, and extracts is queryable over a typed GraphQL API, with REST endpoints for uploads and health checks. The React frontend is one client among others, so teams can point their own applications at the same data and build tooling on top of the documented surfaces.

How it works

Documents enter through uploads; an optional converter can turn eligible non-native formats into PDF ahead of parsing, and the pipeline then parses, thumbnails, and embeds each file using components stored in a database-backed settings record. The default extraction pipeline runs a column's query through the agent framework, while custom extractors can register their own Celery task and call the structured-response API directly. Parsers, embedders, and thumbnailers are swappable, with formats mapped to preferred implementations, and the original upload is preserved when conversion occurs.

The citation graph is reachable through three surfaces: a React interface for teams, a typed GraphQL API with REST for uploads and health checks, and an MCP server exposed per corpus, with anonymous and authenticated endpoint variants and discovery files. External MCP clients can search corpuses, list documents and annotations, walk relationships, and read or post messages in threads. Humans remain in the loop where the sources say so: extraction results carry per-cell approve or reject decisions, and an MCP client can propose annotations only when it is authorized to do so.

Supervised

Agents handle document- and corpus-scoped tasks and grounded answers, and MCP clients can propose annotations only when authorized, while structured extraction requires human approve or reject on every cell.

Where it fits

  • Map which SEC filings cite specific sections of Delaware corporate law and federal securities rules.
  • Summarize indemnification or other clauses in a contract with cited, grounded answers.
  • Extract defined fields such as contract dates across hundreds of documents into a review grid.
  • Let an external agent search a corpus and traverse citation edges over MCP.

Good fit

  • Building a citation graph from a repository of legal, research, or policy documents
  • Teams needing a self-hosted, MIT-licensed document intelligence platform with API and MCP access
  • AI agent workflows that require grounded answers with citations from documents
  • Structured data extraction across many documents with human review

Not a fit

  • Organizations seeking a fully managed, proprietary citation service with no self-hosting
  • Users who need a pre-built closed citation database like Westlaw or Lexis
  • Deployments where document conversion egress to external services is prohibited without network restrictions

How to evaluate

  1. Confirm whether you need self-hosting and have the infrastructure to run the provided Docker compose services.
  2. Verify that the MCP server endpoints and tools match your agent integration requirements.
  3. Assess whether the pipeline components (parsers, embedders, thumbnailers) support your document formats or can be extended.
  4. Check that the structured extraction workflow with human approve/reject fits your data quality process.
  5. Review the security considerations for file conversion, especially SSRF risks if using Gotenberg.

Our take

OpenContracts is an open-source platform for building a citation graph from document repositories, with APIs, MCP integration, and a React UI. It is self-hosted and MIT-licensed, making it suitable for teams that want control over their data and infrastructure. The platform supports AI agents, structured extraction, and pluggable pipelines, but it requires technical setup and may not suit those seeking a fully managed service. Its focus on citations and relationships between documents differentiates it from simple document storage tools.

Alternatives

AgentPricingAutonomyBest for
ragflow—SupervisedAI developers, RAG engineers, Data engineers, Knowledge managers, Platform engineers
deer-flow—SupervisedSoftware developers, AI and agent engineers, Research engineers, Technical teams building agent workflows, Data pipeline builders
anything-llm—SupervisedIT administrators managing private AI instances, Developers building custom integrations, Teams evaluating local versus cloud model providers, Knowledge workers querying internal documents, Operations staff scheduling recurring agent tasks
Vane—AssistantPrivacy-conscious researchers, AI developers testing local models, Technical writers and documentation specialists, Students doing academic research, Data analysts comparing model outputs
FrontierAgent—SupervisedResearch analysts, Developers building agent workflows, Benchmark and evaluation engineers, Data and file-processing specialists, Technical operations staff
Sidekick—SupervisedResearchers, Students, Writers and editors, Software developers, Knowledge workers, Analysts

FAQ

What is OpenContracts?
OpenContracts is an open-source document intelligence platform that builds a programmable citation graph from document repositories, offering human annotation, structured extraction, AI agents, and an MCP server behind one API.
How is OpenContracts licensed?
OpenContracts is MIT-licensed, as stated in the README.
What are the system requirements for self-hosting?
The sources mention Docker compose services for local and production deployments, but specific hardware or software requirements are not detailed. You should review the documentation for deployment prerequisites.
Can I use my own AI agents with OpenContracts?
Yes, every corpus is exposed over the Model Context Protocol, allowing Claude, Cursor, or any MCP client to search it and interact with citation edges when authorized.
What pricing model does OpenContracts use?
The sources do not provide pricing information. As an open-source project, it is likely free to self-host, but you should check the official repository or website for any commercial offerings.
Does OpenContracts offer a free trial?
No trial information is provided in the sources. Since it is open-source, you can evaluate it by self-hosting without a trial.
What document formats are supported?
The pipeline supports PDF, text, and DOCX natively, and file converters can handle other formats like Office documents via Gotenberg. Custom parsers can be registered for additional formats.
How does structured extraction work?
You define a fieldset with columns as natural-language queries, and extraction runs across a corpus using Celery workers, presenting results in a grid with human approve/reject for each cell.

Comments

No comments yet.

Embed a listing badge

Featured on AI Agents Marketplace
<a href="https://aiagentsmarketplace.dev/agents/opencontracts"><img src="https://aiagentsmarketplace.dev/badges/featured.svg" alt="Featured on AI Agents Marketplace" width="262" height="36"></a>
See badge options