corpus MCP server
Commit Nov 12, 2026Enables semantic search and structured metadata queries over personal documents, emails, and records using pgvector and OpenAI-compatible embeddings.
Also known as ryanjdillon/corpus
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 12, 2026
- License
- MPL-2.0
What is corpus MCP?
corpus enables semantic search and structured metadata queries over personal documents, emails, and records using pgvector and OpenAI-compatible embeddings.
Summary generated from the project's README
About corpus MCP server
Organizing and querying personal knowledge bases from within an AI client is what corpus enables. It allows developers to transform markdown files, emails, and structured records into a searchable knowledge base using pgvector and Postgres. By connecting to an OpenAI-compatible embedding endpoint, the system creates vector representations of your content to support semantic searches and metadata-driven queries.
Users can set up different storage tiers to manage security boundaries. A sensitive tier provides full access to raw documents and enrichment data, while a sanitized tier projects only specific fields for lower-trust callers like cloud-based agents. This setup ensures that a cloud model can assist with planning or prioritization without accessing the original sensitive files. Setup requires a PostgreSQL database URL, an OpenAI-compatible API base, and an API key.
Integration is handled through specific commands like corpus serve to launch the MCP server. You can ingest data from various sources including Gmail and IMAP to populate your database. The system supports finding items by meaning, filtering by specific facts through SQL-style metadata queries, and querying priority signals like upcoming deadlines or required actions.
What you can do with it
- 1Perform semantic searchesFind specific documents or notes using natural language descriptions instead of exact keywords.
- 2Execute structured metadata queriesRetrieve every single record that matches specific criteria like a certain tag or a specific date range.
- 3Extract priority signals for planningIdentify urgent tasks or time-sensitive items from your records to help an agent organize your schedule.
- 4Securely share data with cloud modelsProvide a cloud-based assistant with sanitized information so it can help you without seeing private content.
Written from the project's README. Every use case is checked against a quote from it.
Configuration
CORPUS_DATABASE_URLCORPUS_OPENAI_API_BASECORPUS_OPENAI_API_KEY
| Name | Description | |
|---|---|---|
| CORPUS_DATABASE_URL | — | |
| CORPUS_OPENAI_API_BASE | — | |
| CORPUS_OPENAI_API_KEY | — |
Automated checks
Ran Nov 15, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachableryanjdillon/corpus is public and reachablegithub.com/ryanjdillon/corpus ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)MPL-2.0spdx.org/licenses/MPL-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-12github.com/ryanjdillon/corpus ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubcorpus is a knowledge base for your own content. Point it at markdown, documents, or structured records — corpus classifies each item, embeds it through an OpenAI-compatible endpoint, and stores the vectors alongside structured metadata in Postgres/pgvector. Then query it by meaning or by fact.
Everything starts from a raw markdown layer that keeps each item verbatim. From it, corpus derives a configurable set of storage tiers: each tier declares its projection, the tool that exposes it, and an access rule naming who may read it. A sensitive tier serves raw plus enrichment to callers you trust with the originals; a one-way sanitize projects only cloud-safe fields into a tier a lower-trust caller — a cloud-model agent — may query. Add as many tiers as your trust boundaries need; access is a property of each tier, not bolted on afterward.
The embedding endpoint is any OpenAI-compatible API. Run a local model and nothing leaves your network; use a hosted provider and the pipeline is the same.
A source is anything that yields records, so one pipeline covers many content types. Email lands first, over IMAP and Gmail; files, notes, and exports fit the same shape — see the sources guide.
What you can ask
corpus answers three kinds of question, over MCP:
- Find by meaning — semantic search: vector similarity with optional metadata filters, so the right item surfaces even when you don't recall a keyword.
- Filter by fact — structured query: exhaustive metadata queries that return every match (every item with a given tag, from an account, in a time window) as plain SQL — not a ranked sample.
- Ask what matters — enrichment distills each item into a priority signal you query directly: what needs an action, what's due or time-sensitive, what you're waiting on, what's happening in a domain like banking, health, or work.
Callers you trust with the raw items get the full surface — search, structured query, whole-document fetch, and stats. A lower-trust caller sees only the sanitized tier's priority signal, projected free of raw content: a cloud-model assistant can plan your day from what needs action and what's due soon without ever touching the underlying documents.
Quickstart
pip install -e .
export CORPUS_DATABASE_URL=postgresql://… # pgvector
export CORPUS_OPENAI_API_BASE=https://…/v1 # embedding endpoint
export CORPUS_OPENAI_API_KEY=…
corpus ingest imap:example # sync one source
corpus pipeline imap:example # ingest, enrich and sync it in one resumable run
corpus serve sensitive # MCP server, full surface (default :9000)
corpus serve sanitized # MCP server, sanitized tier (corpus-index)
Configuring a source takes a handful of env vars — IMAP, Gmail. See Configuration for the rest.
Documentation
Full docs: https://ryanjdillon.github.io/corpus
- Architecture — the pipeline, module by module
- Configuration — every
CORPUS_setting - Sources — the fetcher protocol, IMAP, and Gmail
- Database — the pgvector store and sync state
- Observability — OpenTelemetry traces and metrics
- Development — tests, the pre-PR gate, and builds
Development
nix develop # Python, uv, just, ruff, commitlint
just setup # create the venv, install deps
just check # lint + coverage + architecture gate + commitlint
See Development for the test tiers and release build.
License
corpus is released under the Mozilla Public License 2.0. Use it for anything, commercial work included. If you modify corpus's own source files, publish those changes under the same license and keep the notices — so improvements come back to the project rather than disappearing into a private fork.
corpus MCP questions
What kind of questions can I ask corpus?
You can perform semantic searches to find items by meaning, structured queries to filter by specific metadata facts, or query enriched priority signals like upcoming actions.
Can I run this locally for privacy?
Yes, you can run a local embedding model so that no data leaves your network.
How does corpus handle data security and access control?
It uses configurable storage tiers that allow you to define different access rules, such as providing raw data to trusted callers and sanitized, non-sensitive data to cloud-model agents.