Listed from the MCP registry; nobody on Odel publishes it.
Official documents, pipeline health, RAG search and company data from the MyOpenFund bricks.
Runs on your machine from its package; the steps are below.
At most: only reads or looks up information.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
uvx myopenfund-mcp
MCP client config
{
"mcpServers": {
"myopenfund-mcp": {
"command": "uvx",
"args": [
"myopenfund-mcp"
]
}
}
}Created and maintained by Marc Jeulin, part of MyOpenFund.
One MCP server over the MyOpenFund bricks: official documents and pipeline health, cited passage search over the embedded corpus, and company data.
Any MCP client (a desktop assistant, a coding agent, your own agent, a local model) gets outcome-oriented
tools over MyOpenFund's data: find official primary-source documents, read their facts with provenance
(doc_id, dates, source URLs), search the text of the documents by meaning and get passages to cite, count
the corpus, check the ingestion pipeline's health. Toolsets are
enabled per deployment: a toolset whose environment variables are not set is not configured, so it is not
mounted, and server_info says so. A toolset whose variables are set but whose extra is not installed
stops the server at start with a clear configuration error (it never runs silently without it).
MyOpenFund manages nobody's money and gives no investment advice. This server returns documents and facts from official sources, with their provenance. What you do with them is your decision.
MOF_* environment variables.No database, no store, no server to run: the company tools read the SEC's public EDGAR data directly, keep what they fetch in a cache folder on your machine, and search the filings with a small embedding model that runs locally. You need Python 3.12+ (through uv), an MCP client, and about 2 GB of free disk space and memory for the model.
1. Install and run. Straight from PyPI, nothing to clone (the MCP client runs it for you, see step 2):
uvx --from "myopenfund-mcp[companies,filings]" myopenfund-mcp serve
or install it in a virtual environment:
python -m venv .venv
.venv/bin/pip install "myopenfund-mcp[companies,filings]"
2. Add it to your assistant and give your own SEC contact. In an MCP client that reads an mcpServers
block (Claude Desktop, Claude Code's .mcp.json, and most others):
{
"mcpServers": {
"myopenfund": {
"command": "uvx",
"args": ["--from", "myopenfund-mcp[companies,filings]", "myopenfund-mcp", "serve"],
"env": { "MOF_SEC_CONTACT": "Your Name your.email@example.com" }
}
}
}
Replace the placeholder with your own name and e-mail. The SEC's fair-access rules ask every automated
client to identify who is behind it, and it blocks the ones that do not. The value stays on your machine:
it is sent only to sec.gov, in the User-Agent of each request, and it is never logged, shown in a tool
result or put in an error. Without it the company tools are not mounted. Over stdio there is no token and
nothing listens on the network.
3. Ask a question. The scenario the MyOpenFund README suggests:
Since 2022, how have the big cloud providers financed their AI spending? Show me their capital expenditure and their debt quarter by quarter, how their shares performed after each annual report, and quote what each one says about it.
The assistant resolves the companies (companies_resolve), reads their capital expenditure and debt
(companies_fundamentals, companies_facts), gets the date each annual report became public
(companies_filings, the accepted_utc of each 10-K is the event date), and quotes the reports
(companies_fetch_filings, then companies_search_filings and companies_read_filing). Share prices are
not in this server: they come from the market-data toolset, which is not part of this server yet, so the
"how did the shares perform" part needs another source of prices; the event dates are what this server
gives it.
companyfacts and submissions endpoints, at most
MOF_SEC_MAX_RPS requests per second (SEC's own limit is 10). Filings come from SEC's archive and are
converted to text, then split into passages and embedded locally.MOF_CACHE_DIR (default: ~/.cache/myopenfund-mcp on Linux,
~/Library/Caches/myopenfund-mcp on macOS, %LOCALAPPDATA%\myopenfund-mcp on Windows): HTTP answers,
the local filings index and the model. Facts and filing lists are reused for 24 hours
(MOF_CACHE_TTL_COMPANYFACTS_H, MOF_CACHE_TTL_SUBMISSIONS_H); the HTTP part is capped at
MOF_CACHE_MAX_GB (20 GB), the model and the index are never evicted. Delete the folder to start over.warm, on the same MOF_CACHE_DIR answers [index_unavailable] for the filings tools
(the other tools work). Give each its own MOF_CACHE_DIR, or stop the first.<MOF_CACHE_DIR>/index/ is named after the
model and the chunker version; builds before the chunk titles stated the period (chunker version ending
ttl2) wrote folders that are no longer read: their documents are fetched and indexed again, and the
old folders are orphaned, safe to delete.MOF_CACHE=off keeps no HTTP entries and no index between runs: they live in a temporary folder
removed at exit, so warm refuses to run. The model files (1.1 GB) still stay in the persistent cache
folder, which is created even with off, so the model is not downloaded again. Use it for a throwaway
test only.MOF_COMPANIES_SOURCE)auto (the default) uses your own company store when you have one and SEC otherwise; with no store
configured, as here, everything comes from SEC. store reads only the store, sec only SEC (needs
MOF_SEC_CONTACT). Every row of a company tool says its source (store or sec_live) and, when the choice
needs explaining, a reason (for example freshness_unchecked: SEC could not be asked, so the store's
answer is not checked for freshness). A store is optional: if you run one, point MOF_COMPANIES_CATALOG and
MOF_COMPANIES_DATA_ROOT at it (see Companies and datasets).
The first question about a filing is slow because the filing is downloaded, converted and embedded on your machine; later questions about it are answered from the index. Measured on 4 CPU cores in a container (2026-11, Microsoft, Amazon, Alphabet, Meta and Oracle, their 22 10-Ks since 2022):
| Step | Time |
|---|---|
| Embedding model download (once, 1.1 GB) | 18 s on a fast connection; minutes on a home one |
Facts (companies_fundamentals), first call for a company | 17 to 26 s; later calls under 1 s |
| One 10-K downloaded, converted and indexed (390 to 720 passages) | 95 to 216 s, median 159 s |
First quotable passage (Item 7) after companies_fetch_filings of one company (its 4-5 10-Ks) | 24 to 45 s |
| First quotable passage of each company when the five are fetched in one call (22 10-Ks) | Microsoft 42 s, Amazon 55 s, Alphabet 67 s, Meta 80 s, Oracle 93 s (fetch call 3 s) |
| The five companies' 22 10-Ks, fetched in one call, all indexed | 56 min |
| A search once indexed | 0.25 s |
(First-passage times measured 2026-11-26 with the model already on disk; the model download is not
counted.) The indexer takes the companies in turn: first one batch (MOF_INDEX_BATCH_SIZE, 32 passages,
about 10 s) of the MD&A (Item 7) of each company's newest document, then the rest of the MD&As, newest
documents first, then everything else (MOF_INDEX_FIRST_BATCHES). So each of the five companies
fetched in one call got quotable passages within two minutes (42 s, then about 13 s per extra company
on 4 CPU cores), while the full documents take longer. The order covers the documents fetched and cut
ahead, at most MOF_INDEX_FETCH_AHEAD (default 40, the default MOF_FILINGS_MAX_DOCS, so a whole
fetch call): beyond the bound, documents cut later get their MD&A only after the remainders of the
documents already cut. For several companies
over several years, run warm beforehand. On Apple Silicon, set
MOF_RAG_ONNX_PROVIDER=coreml to run the embedding on the Mac's accelerator instead of the CPU (cpu
is the default). MOF_RAG_ONNX_THREADS limits the CPU threads. While a filing is still being prepared,
the tools say so and which documents are not ready; ask again a little later.
warm)Fetch and index the filings of the companies you will ask about before you ask, with the same code the
tools use. Use the same MOF_SEC_CONTACT and the same cache folder as your assistant's configuration:
export MOF_SEC_CONTACT="Your Name your.email@example.com"
uvx --from "myopenfund-mcp[companies,filings]" myopenfund-mcp warm \
--companies MSFT,AMZN,GOOGL,META --forms 10-K,10-Q --since 2022-01-01
Progress goes to stderr; run it again to resume, documents already ready are not fetched again. Stop
your assistant's MCP server first, as only one process can hold the index. More in
Warming the cache ahead of questions.
A small local model (for example one served by Ollama, through an MCP-capable client) can call these
tools; see Local models. Ask one question at a time, name the companies and the period,
and check the quoted passages and figures against the url link of each result's source, as reading
long filings and combining numbers is where small models struggle most.
MyOpenFund manages nobody's money and gives no investment advice. What you do with these documents and facts is your decision.
Prerequisites:
vault_readonly (never a writing role).Run it straight from PyPI, nothing to clone:
uvx --from "myopenfund-mcp[vault]" myopenfund-mcp serve
or install it in a virtual environment:
python -m venv .venv
.venv/bin/pip install "myopenfund-mcp[vault]"
The extras pick the toolsets: [vault] (documents and pipeline health), [companies] (company data:
pip install "myopenfund-mcp[companies]"), [rag] (passage search: pip install "myopenfund-mcp[rag]")
and [filings] (the filing-text tools over a local index, with [companies]:
pip install "myopenfund-mcp[companies,filings]"), combinable ("myopenfund-mcp[vault,companies,rag,filings]"). The server is listed in the official MCP Registry as io.github.MyOpenFund/myopenfund-mcp. The PyPI distribution is myopenfund-mcp; the
command (myopenfund-mcp), the import name (myopenfund_mcp) and the repository name are unchanged. The
MyOpenFund packages it builds on (myopenfund-vault-query, myopenfund-open-data-store,
myopenfund-company-corpus, myopenfund-rag-engine) are installed from PyPI by the extras.
Migration. If this environment installed the packages under their former names (from a clone or a git
URL), run pip uninstall -y vault-query open-data-store company-corpus rag-engine before installing
myopenfund-mcp: the old and the new distributions own the same import packages.
Upgrading from 0.1.0. 0.2.0 adds the no-vault mode (see Try it at home):
[filings] (the filing-text tools, myopenfund-rag-engine[local,graph]); [companies] now
installs myopenfund-company-corpus[live] (live SEC reads), and [rag] and [filings] both need
myopenfund-rag-engine 0.2. Reinstall with the extras you use, e.g.
pip install -U "myopenfund-mcp[vault,companies,rag,filings]".MOF_SEC_CONTACT (your name and e-mail) mounts the company tools without a store and is needed for the
filing-text tools. A deployment with a store and no MOF_SEC_CONTACT keeps reading the store only; one
that sets it may also ask SEC, as MOF_COMPANIES_SOURCE (default auto) decides.MOF_CACHE_DIR (default under your user cache directory; in a
container, point it at a writable volume), holding HTTP answers, the filings index and the 1.1 GB model.vault-query, open-data-store, company-corpus,
rag-engine)? Uninstall them first, as in the migration line above.To try the latest main before a release (the dependencies still come from PyPI):
pip install "myopenfund-mcp @ git+https://github.com/MyOpenFund/myopenfund-mcp"
Register it with your MCP client. With Claude Code:
claude mcp add myopenfund \
-e MOF_VAULT_DATABASE_URL='postgresql://vault_readonly:<password>@<host>:5432/documents?sslmode=verify-full' \
-- /path/to/.venv/bin/myopenfund-mcp serve
Any other client: run the command myopenfund-mcp serve (stdio is the default transport) with the same
environment. Over stdio there is no token: the local user owns the process and gets every tier
(MOF_MCP_TOKENS, if set, is ignored with a warning on stderr). Then ask the client to call server_info.
The snippet above stores the database URL, password included, in the MCP client's configuration file. Use the read-only role
vault_readonlyonly, and keep that file private.
MOF_MCP_TRANSPORT=http serves Streamable HTTP at MOF_MCP_PATH (default /mcp). It requires
MOF_MCP_TOKENS: the HTTP server never runs unauthenticated, and refuses to start without tokens.
The server speaks plain HTTP. Network exposure and TLS are the deployment's job, never the public
internet by default. The repository ships a generic Dockerfile,
compose.example.yaml and .env.example; nothing host-specific
lives in it.
cp compose.example.yaml compose.yaml
cp .env.example .env # never committed
.venv/bin/myopenfund-mcp hash-token alice # once per client, see Tiers and tokens
.venv/bin/myopenfund-mcp hash-token agent-1 --tier read
# edit .env: MOF_MCP_TOKENS, MOF_VAULT_DATABASE_URL, MOF_MCP_BIND_ADDR ...
docker compose up -d --build
No venv on the deployment host? Run hash-token in the container instead (after cp .env.example .env,
which compose needs, and with the image built):
docker compose build
docker compose run --rm mcp myopenfund-mcp hash-token alice
hash-token prints the token on stderr (copy it to the client) and only the MOF_MCP_TOKENS
entry on stdout, so redirecting stdout (>> entries.txt) never writes the clear token into a file.
The image runs as a non-root user (uid 10001), listens on 0.0.0.0:8000 inside the container, and
the compose file publishes it on 127.0.0.1 of the host unless MOF_MCP_BIND_ADDR says otherwise. In
.env, leave MOF_MCP_TRANSPORT and MOF_MCP_HOST unset: the image sets them. The compose file also runs it with a
read-only root filesystem (writable /tmp only), no Linux capabilities and no-new-privileges.
Every rebuild of the image and every start of the install service installs the same Python packages,
the ones the CI tested:
PYTHON_IMAGE in the Dockerfile, a tag and a digest
(python:3.13.<patch>-slim-<debian>@sha256:...); the variant without a built image in
compose.example.yaml uses the same value. The image's Python and pip come with it.constraints.txt, the exact version of every
dependency of [vault,companies,rag,filings] on that image (fastmcp and everything below it), passed with
-c.-c does not reach; build-constraints.txt pins its
backend (hatchling and its dependencies, plus editables, which hatchling needs for the CI's editable
install), passed with --build-constraint. The locked job runs scripts/check_constraints.py --build,
which fails when a build requirement is not pinned in the file at a version its specifier allows.myopenfund-vault-query, myopenfund-open-data-store,
myopenfund-company-corpus, myopenfund-rag-engine): ordinary PyPI dependencies, capped in
pyproject.toml below their next breaking release (>=0.m.0,<0.(m+1), e.g.
myopenfund-rag-engine>=0.2.0,<0.3) and pinned to one exact version in
constraints.txt.The install service passes both files of the release's tag as URLs and pins the package itself (the constraints files of the release's tag v<version>):
pip install -c https://raw.githubusercontent.com/MyOpenFund/myopenfund-mcp/v<version>/constraints.txt \
--build-constraint https://raw.githubusercontent.com/MyOpenFund/myopenfund-mcp/v<version>/build-constraints.txt \
'myopenfund-mcp[...]==<version>'
so the host also needs outbound HTTPS to raw.githubusercontent.com at each start, besides PyPI.
Not covered: file hashes (pins are == versions, not --require-hashes) and, outside Python, the DuckDB extensions the companies toolset downloads at start and the embedding model
(pinned by its own revision, see Deploying the rag toolset).
The CI runs the tests twice: floating within the ranges of pyproject.toml (Python 3.12 and 3.13, so a
coming break shows early) and locked (locked job: the image's Python, both constraint files, then
scripts/check_constraints.py, which fails when a runtime dependency of the server is missing from
constraints.txt or installed at another version, e.g. a new dependency brought by a release, and when an
extra it is asked to check does not exist, then scripts/check_constraints.py --build, which checks the build backend's pins). A test checks that the job's Python is
the patch of PYTHON_IMAGE.
Upgrading is a deliberate change in a pull request: for the base image, look up the digest of the new
tag (docker buildx imagetools inspect python:<tag>) and replace PYTHON_IMAGE in the Dockerfile and the
image lines of compose.example.yaml; for the packages, run python3.13 scripts/update_constraints.py (on
linux x86_64, the image's platform) and commit both regenerated files. The locked job then tests the new set.
A client connects with its token, e.g. with Claude Code:
claude mcp add --transport http myopenfund https://<your-host>/mcp \
--header "Authorization: Bearer <token>"
Each MyOpenFund code repo ships a .mcp.json holding variables only, never an address or a token. Clone one
repo or all of them: each works on its own, including in new worktrees, and projects outside MyOpenFund do not
see the server. Set these two client-side variables once, in your shell profile or a private file it loads:
export MOF_MCP_URL=https://<your-host>/mcp
export MOF_MCP_TOKEN=<token> # your client token, the one from hash-token
MOF_MCP_TOKEN is the client's clear token; MOF_MCP_TOKENS is the server's list of digests. Claude Code asks
you to approve the server once per project. Start it from a shell that has the variables. Without them, it
warns about the missing variables and everything else keeps working.
A home server, a NAS or an office machine reachable only over a VPN or a private interface.
MOF_MCP_BIND_ADDR to the host's private address (the VPN or LAN interface), never 0.0.0.0
on a host that also has a public interface.networks blocks in compose.yaml, set
MOF_VAULT_DOCKER_NETWORK) and use the database service name as <host> in MOF_VAULT_DATABASE_URL.
On that private Docker network, sslmode=disable is acceptable.MOF_MCP_BIND_ADDR=127.0.0.1 and terminate TLS at a reverse proxy on the same VM
(Caddy, nginx, Traefik) proxying to 127.0.0.1:8000, or run the container behind the provider's load
balancer with a TLS listener and a security group that only admits the balancer.GET /health answers 200 with the body ok,
without a token (it reveals no version and no data); /mcp keeps requiring one. The image's Docker
HEALTHCHECK uses the same endpoint.sslmode=verify-full and the
provider's CA certificate (sslrootcert=...). sslmode=require is a fallback: it encrypts but does not
authenticate the server.The rag_search tool needs a Qdrant collection already filled by the ingestion (rag-engine through the
data-orchestrator) and the embedding model intfloat/multilingual-e5-base as an ONNX file. The server only
reads: it never creates a collection, an index or a point. Angle brackets are placeholders: no real host
name, address or key belongs in this repository or in a compose file under version control.
The steps below work as they are for the two ways compose.example.yaml runs the server: the image built
from this repository, or its variant without a built image, where an install service puts the package
into a volume at each start of the stack.
A read-only API key on the Qdrant side. In the Qdrant stack, set a read-only key next to the main
one (QDRANT__SERVICE__READ_ONLY_API_KEY) and restart Qdrant. The MCP gets that key only. Check it
from any host that reaches Qdrant. The key is typed at a prompt that shows nothing (read -s, in bash
and in zsh) and kept in a variable of that shell: it is written neither in a command nor in the
shell history.
# Run this first line alone and type the key: pasted with the lines below, some shells
# (bash before 5.1, the bash of macOS) take the next pasted line as the key.
printf 'read-only key: '; read -rs MOF_KEY_CHECK; echo
curl -s -o /dev/null -w '%{http_code}\n' -H "api-key: $MOF_KEY_CHECK" http://<qdrant-host>:<qdrant-port>/collections/<collection>
curl -s -o /dev/null -w '%{http_code}\n' -H "api-key: $MOF_KEY_CHECK" -H 'Content-Type: application/json' -X PUT -d '{"vectors":{"size":4,"distance":"Cosine"}}' http://<qdrant-host>:<qdrant-port>/collections/mof-key-check
The first request is a read: it must print 200 (401 or 403: Qdrant does not accept the key;
404: no collection of that name).
The second is a write: it must print 403. The key cannot write, and nothing was created.
If the second prints 200, the key can write: it is not a read-only key, and the request has
just created an empty collection named mof-key-check. Delete that collection, then give the MCP a
real read-only key and run the two checks again:
curl -s -o /dev/null -w '%{http_code}\n' -H "api-key: $MOF_KEY_CHECK" -X DELETE http://<qdrant-host>:<qdrant-port>/collections/mof-key-check
At the end: unset MOF_KEY_CHECK.
Qdrant behind TLS: write https:// in these URLs, with the port TLS is served on; add
QDRANT_HTTPS=true to the command of step 2 and set MOF_RAG_QDRANT_HTTPS=true in step 6. The key
then no longer travels in clear.
Payload indexes, once, from the data side. The filters and the list of valid filter values use
Qdrant's payload indexes. Whoever owns the collection creates them, once per collection, with a key
that can write, from an environment where rag-engine is installed (the ingestion's own, or any venv
with pip install "myopenfund-rag-engine>=0.2.0,<0.3",
the range this server is built on). Give the host AND the port: the engine's default port is 6333.
The key is typed at a prompt here too:
# Alone first, as in step 1.
printf 'key that can write: '; read -rs QDRANT_API_KEY; echo; export QDRANT_API_KEY
QDRANT_HOST=<qdrant-host> QDRANT_PORT=<qdrant-port> python -c "from rag_engine.store import QdrantStore; print(QdrantStore().ensure_payload_indexes('<collection>'))"
unset QDRANT_API_KEY
It prints the indexes it created ([] when they were all there: running it again does nothing). The MCP
never does this (its key cannot). Without the indexes rag_search still answers, more slowly: a
filtered search reads every point (about 0.15 s on 34,000 points), and the valid filter values are
read by one scroll of the collection, in the background (up to 100,000 points; beyond that, filter
values are no longer checked).
The engine (myopenfund-rag-engine 0.1) also creates the datetime indexes on date_start and date_end (payload
schema version 2). Once they exist, auto mode applies date bounds to the intervals (within
MOF_RAG_DATE_FILTER_REFRESH_S seconds, without a restart of the MCP). That is safe before the payloads
carry their intervals (a point without one is still found by its date), but a month or a year
document is found by its whole period only once the orchestrator's sync-metadata has written the
intervals; sync-metadata creates the two indexes itself (see Dates).
The [rag] extra in the install line. With the built image: MOF_EXTRAS=vault,rag as a build
argument (compose.example.yaml). Without a built image: 'myopenfund-mcp[vault,rag]==<version>'
in the install service. From PyPI: pip install "myopenfund-mcp[vault,rag]". No PyTorch is installed: queries
are embedded on the ONNX runtime, on CPU. Without the extra the server refuses to start as soon as
MOF_RAG_QDRANT_HOST is set.
Fill the model cache, once. The model is about 1.1 GB. It is pinned to one revision and every file
is hash-checked at each start, so a changed or damaged file is refused. The fill is a one-shot
container with the cache volume mounted read-write; it needs outbound HTTPS to huggingface.co and
to the hosts it redirects downloads to (under hf.co), and a writable HOME. The exact line it runs:
python -c "from rag_engine.config import Settings; from rag_engine.embedding import make_embedder; make_embedder(Settings(backend='onnx', model_cache='/models')).release(); print('model cache ready')"
It succeeded when its last line is model cache ready and its exit code is 0. Anything else
(a traceback, another exit code) is a failed fill: the service would start without the model.
docker run --rm -v myopenfund-mcp-rag-models:/models myopenfund-mcp python -c "..."
with the line above (the image owns /models as its service user and sets HOME).rag-model-fill service of compose.example.yaml runs it for the first start
of the stack (the install service gives the volume to the service user). Check both signs with
docker compose logs rag-model-fill (last line model cache ready) and docker compose ps -a rag-model-fill (Exited (0)), then delete that service./models.Run again on a filled cache, the line downloads nothing, verifies the files and prints the same line. A filled
directory can be copied from another host instead, keeping its symbolic links (snapshots/ links
into blobs/): cp -a, rsync -a or tar, never a copy that follows or drops links.
The service (compose.yaml):
/models;mem_limit: 3g or more: the process peaks at about 2 GB at every start, while the model loads, and
stays around 1.5 GB afterwards; with a CPU limit, also set MOF_RAG_ONNX_THREADS to it;ORT_DISABLE_TELEMETRY=1 and HF_HUB_OFFLINE=1 in its environment (see
Outbound connections);HEALTHCHECK has it);MOF_RAG_QDRANT_HOST=<qdrant-service>, MOF_RAG_QDRANT_PORT=6333
unless that stack changed it), without publishing anything. Otherwise use a host port Qdrant
publishes on a private interface (MOF_RAG_QDRANT_HOST=<private-address>,
MOF_RAG_QDRANT_PORT=<published-port>). Without TLS the key travels in clear: private network only.The variables, in .env: MOF_RAG_QDRANT_HOST (the host alone: qdrant:6333 is refused),
MOF_RAG_QDRANT_PORT, MOF_RAG_QDRANT_API_KEY (the read-only key of step 1), MOF_RAG_COLLECTION,
MOF_RAG_MODEL_CACHE=/models; MOF_RAG_QDRANT_HTTPS=true when Qdrant is behind TLS; optionally
MOF_RAG_DESCRIPTION_NOTES (see Passage search). The others have defaults
(Configuration and limits); the date settings
(MOF_RAG_DATE_FILTER_MODE=auto, MOF_RAG_DATE_FILTER_REFRESH_S=300, MOF_RAG_DATE_FILTER_RETRY_S=30) need
no value of their own.
Restart and check.
GET /health answers 200 within the start period.rag: embedding model intfloat/multilingual-e5-base ready in ... s,
rag: collection <collection> checked, searches are served and rag: filter values read from the collection (source_codes: ..., doc_types: ..., languages: ...), then (logger rag_engine.store)
Qdrant collection '<collection>' has no datetime index on both date_start and date_end: date filters in auto mode use the date field (legacy) (before sync-metadata) or ... has datetime indexes on date_start and date_end: date filters in auto mode use the intervals (after). It holds no line with the word
Downloading: the running service never downloads. An error line naming MOF_RAG_MODEL_CACHE means
the cache is incomplete, unreadable or not the pinned model.server_info: toolsets.rag is enabled, rag.status is ready, and rag.source_codes /
rag.doc_types list the collection's codes. If rag.status is unavailable, rag.reason and the log
say why (see Passage search).rag_search with a short query and one valid code, e.g. {"query": "inflation outlook", "source_codes": ["<a code of rag.source_codes>"]}: passages come back.rag_search with the same code in the wrong case: the answer is [invalid_argument] source_codes: unknown value "..." (did you mean "..."? values are matched exactly); valid values: ....rag_search with a date bound, e.g. {"query": "inflation outlook", "date_from": "2016-07-14", "date_to": "2016-07-14", "include_undated": false}: passages come back (or none, for a day nothing is
dated to), filters.include_undated is false, and each hit has date_precision and date_kind
(null until sync-metadata has run).Never run this repository's integration tests against a production Qdrant.
tests/integration/test_real_qdrant.py creates and deletes collections: it is for a throwaway Qdrant
only (see Development).
Redeploying a new version (such as the one that moved to myopenfund-rag-engine 0.1 and added the date
settings): the same steps, from step 3. Rebuild the image, or point the install service at the new
<version> (and the constraints URLs of its tag v<version>); restart; check as in step 7. No new volume, no new variable to set (the date settings have
defaults), and the model cache is kept: the pinned model revision did not change. Step 2 is not needed
again for the server: the indexes the new version uses are created by the orchestrator's sync-metadata,
and until they exist date bounds behave as before.
Once the model cache is filled, the server makes no outbound connection besides its requests to Qdrant (checked behind a recording proxy that refuses everything: no request in the first minute):
ORT_DISABLE_TELEMETRY: the ONNX runtime installed by the [rag] extra sends usage events to its
publisher (mobile.events.data.microsoft.com) and keeps a device id under
$HOME/.cache/Microsoft/DeveloperTools unless this variable is 1. The server sets it to 1 in its own
process before the runtime can be imported, and so do the image and compose.example.yaml. A value you
set yourself is kept (0 allows the telemetry).HF_HUB_OFFLINE=1 is recommended for the running service. With a complete cache the server asks
huggingface.co nothing; with an incomplete one it would try a download at every start, fail on a
read-only volume, and leave rag_search answering [rag_unavailable] model_unavailable. The variable
turns that attempt into an immediate, local error. Leave it unset for the fill of step 4.Tool names carry their toolset prefix. Every tool is read-only (readOnlyHint) except
companies_fetch_filings, which downloads and indexes filings (act tier). Only
vault_search_documents is paged: it returns next_cursor to pass back unchanged with the same filters.
vault_corpus_stats, vault_runs_status and vault_vocabulary only bound their lists with limit (no cursor). Every
limit defaults to MOF_MCP_DEFAULT_ROWS; a value outside [1, MOF_MCP_MAX_ROWS] is refused, not
clamped. String arguments doc_id, text, cursor and the corpus of vault_get_document and
vault_vocabulary are at most 200 characters.
| Tool | Purpose | Key arguments |
|---|---|---|
server_info | What this deployment offers: enabled toolsets, your tier, version, data freshness (last vault ingest). Call it first. Open to every authenticated caller. | none |
vault_search_documents | Find official documents (metadata, not text). Start here: filter, then open one with vault_get_document. Rows are ordered by sort_by in sort_dir; equal sort values are ordered by doc_id, then corpus, ascending, whatever sort_dir (a total order: on an unchanged vault, pages never repeat or skip a row). total counts the whole filtered set. Cursors are offsets: if the vault is ingesting between two pages, a row can shift (seen twice or skipped). Rows carry, besides the identity, title, dates, type and URLs, the documents-contract columns date_precision (day, month, year, or null = not stated: a month or year date is the period's first day), date_kind (publication, meeting, period) and entity_scheme / entity_value (the issuing entity, e.g. cik / 0000320193). | corpus (e.g. central-bank), source_code (publisher, e.g. us for the Fed), doc_type (a code within its corpus: needs corpus, see below), language, year, mime_type, date_from / date_to (YYYY-MM-DD, inclusive), text (case-insensitive substring of the title, matched literally: % and _ are ordinary characters), sort_by (date default, year, corpus, source_code, doc_type, title, created_at), sort_dir (desc default), limit, cursor, include_deleted (also return withdrawn documents, with deleted_at set) |
vault_get_document | Every stored fact of a document: dates (with date_precision, date_kind), the document's URL (document_url, PDF preferred, HTML accepted) and the page it was found on (source_url), publisher, type, issuing entity, extra. A doc_id is unique within its corpus only, so it returns a list: with corpus, at most one document (the one of that corpus); without, one per corpus holding that doc_id, ordered by corpus, each with its corpus. None: [not_found] (with corpus, the message says to omit it to look in every corpus). The text block is the JSON list; structuredContent is {"result": [...]} (MCP structured output must be an object). | doc_id, corpus (pass the corpus of the search row) |
vault_corpus_stats | Live-document counts grouped by one field, largest first (NULL is a real group). Grouping by doc_type needs corpus. | group_by (source_code default, corpus, doc_type, language, year, provenance, mime_type), corpus, limit |
vault_vocabulary | What the codes mean: each corpus's declared codes with their labels, rows {corpus, kind, code, label, family} ordered by corpus, kind, code, with returned and truncated (true when limit cut the list: filter by corpus and kind). For turning the user's words ("10-K", "rate decision") into a corpus's doc_type. A corpus that has not declared its codes yet has no rows: vault_corpus_stats(group_by="doc_type", corpus=...) shows the codes its documents use. | corpus, kind (doc_type, source_code, provenance, entity_scheme), limit |
vault_runs_status | Is the pipeline healthy? Four lists, newest first unless stated: runs (one row per run, with outcome and totals; a run that crashed before reaching any source appears only here), source_runs (one row per run and source: counts, outcome, bounded error samples; bad_content is the part of docs_failed where the server sent the wrong bytes, e.g. an HTML page for a PDF, NULL = not reported, never 0), open_discovery_errors (unresolved discovery failures; while seen_at_is_ingestion_time is true, last_seen_at is approximate), source_health (expected-vs-observed publication cadence per series, the least healthy first: cadence_status overdue, then soon, then the rest, each by most days_late first, unknown last; each row also carries source_bad_content_7d, the 7-day sum, NULL when no run of the window reported it, and last_run_bad_content), and source_health_total (every series matching corpus / source_code, so a shorter list means limit left some out). A result over MOF_MCP_MAX_RESULT_CHARS is refused with [result_too_large]: lower limit or filter by source_code. | corpus, source_code, since (ISO 8601, UTC if no offset, an explicit offset is kept: whole minutes, at most ±15:59; keeps runs finished at or after it, leaves out runs still in flight; applies to runs and source_runs only), until (same form; keeps runs finished at or before it, so old runs are reachable under limit), limit (applies to each of runs, source_runs, open_discovery_errors, source_health) |
doc_type needs corpus. A doc_type code means something only within its corpus (central-bank A1
and company A1 are different document types). vault_search_documents with doc_type and no corpus,
and vault_corpus_stats grouped by doc_type without corpus, answer [invalid_argument] doc_type needs corpus: ... with vault-query's message, which lists each corpus's codes and labels. The tool descriptions
tell the model to ask the user which corpus when the conversation does not make it clear, or infer it.
Resource: vault://documents/{doc_id}, the metadata of the documents with that doc_id as a JSON list, one
per corpus holding it (same content as vault_get_document without corpus).
Changes for clients (vault-query 0.5.0, vault 12ffd11). vault_get_document and the resource return
a list (was one object); vault_get_document takes corpus; doc_type without corpus is refused (see
above); search and document rows carry date_precision, date_kind, entity_scheme, entity_value; new
tool vault_vocabulary.
The vault_* tools and the resource exist only when MOF_VAULT_DATABASE_URL is set; the [vault] extra
must then be installed, or the server refuses to start (MOF_VAULT_DATABASE_URL is set but the [vault] extra is not installed). Timestamps in results are UTC: the server's database session runs with
timezone=UTC, whatever the database or role default.
Minimum vault schema. This server needs a vault at or after 12ffd11 (vault-query 0.5.0; this server needs myopenfund-vault-query >=0.1.0,<0.2, the former 0.6.0, which takes until on run reads and breaks search sort ties by doc_id, corpus: documents
keyed (corpus, doc_id), columns date_precision / date_kind / entity_scheme / entity_value, table
vocabulary; runs_sources.bad_content). Deploy the vault (and run its ingestion, which applies the
schema) before this server. Against an older schema, a tool that reads a missing column or table answers
[schema_outdated] the vault lacks a column or table this server reads (see README, Minimum vault schema),
not backend_unavailable; the server log names the missing column or table, and server_info reports
"freshness_error": "schema_outdated".
If the vault database is down, server_info still answers (version, tier, toolsets) with freshness
null and freshness_error set to the error's code (backend_unavailable, timeout, schema_outdated);
the server log names the exception class only.
rag_search exists only when MOF_RAG_QDRANT_HOST, MOF_RAG_COLLECTION and MOF_RAG_MODEL_CACHE are set;
the [rag] extra must then be installed, or the server refuses to start (MOF_RAG_QDRANT_HOST is set but the [rag] extra is not installed). It searches the text of the embedded documents by meaning (one dense
search over the chunks, with rag-engine) and returns passages, best first. It does not write an answer:
the client's model reads the passages and cites them. Read tier.
| Argument | Meaning |
|---|---|
query (required) | What to look for, in plain language, in any language; at most 2000 characters (the model reads the first 512 tokens). |
source_codes | JSON array of source codes, exact (case matters). The valid ones: server_info, rag.source_codes. |
doc_types | JSON array of document-type codes, exact. The valid ones: server_info, rag.doc_types. |
languages | JSON array of language codes as stored, e.g. ["en"]. The valid ones: server_info, rag.languages. |
date_from, date_to | Date bounds, YYYY-MM-DD, both inclusive. A document known only to the month or the year matches any range overlapping its period (see Dates for when). As soon as one bound is set, a document without a date is left out, unless include_undated is true. |
include_undated | JSON boolean, default false. true: with a date bound, also keep the documents without a date (the dated ones outside the range stay out). Without a date bound it changes nothing and is accepted. A string ("true") or a number is refused. |
limit | Number of passages; default MOF_RAG_DEFAULT_LIMIT (8), at most MOF_RAG_MAX_LIMIT (20). |
The values of one array are alternatives (OR), the arguments combine (AND). An omitted argument does not restrict; an empty array is refused.
What the client's model is told. The tool description states how to call the tool, the default and
the maximum limit of this deployment, what a date bound does (with a bound, a document known only to the
month or the year matches any range overlapping its period, and documents without a date are left out
unless include_undated is true; with MOF_RAG_DATE_FILTER_MODE=legacy it says instead that such a
document is found only at the first day of its period), and the hit fields, date_precision and
date_kind included. It stays under 1800 characters before the notes. It is corpus-neutral: it names no source
and gives no meaning to any code, because such facts go stale when the collection changes. The codes
themselves are read from the collection (server_info, and every refusal lists them). What they mean is
the deployment's to say, in MOF_RAG_DESCRIPTION_NOTES: one line of text (at most 1500 characters),
appended to the description after About this collection:. Suggested value for the central-bank
collection:
MOF_RAG_DESCRIPTION_NOTES=Central-bank monetary-policy documents. source_codes: "ecb" European Central Bank, "us" Federal Reserve, "gb" Bank of England, "au" Reserve Bank of Australia, "ca" Bank of Canada, "jp" Bank of Japan. doc_types: "A1" rate-decision press release; "A2" policy statement (for the ECB: the press-conference page, with its questions and answers); "A3" minutes or accounts of the meeting; "B1" press-conference material (Federal Reserve: transcript; ECB: the combined decision and statement, without the Q&A); "E1" monetary policy report or staff projections; "F1" economic projections.
Example call and result (text shortened):
{"query": "Why did the ECB raise interest rates in July 2022?", "source_codes": ["ecb"], "date_from": "2022-07-01", "limit": 1}
{
"query": "Why did the ECB raise interest rates in July 2022?",
"filters": {"source_codes": ["ecb"], "doc_types": null, "languages": null, "date_from": "2022-07-01", "date_to": null, "include_undated": false},
"count": 1,
"hits": [
{
"rank": 1,
"score": 0.8189,
"text": "The Governing Council decided to raise the three key ECB interest rates by 50 basis points. ...",
"doc_id": "ecb/A1/2022-07-21",
"title": "Monetary policy decisions",
"date": "2022-07-21",
"date_precision": "day",
"date_kind": "meeting",
"source_code": "ecb",
"doc_type": "A1",
"language": "en",
"page": 1,
"chunk_number": 0,
"citation": "Monetary policy decisions (ecb A1, 2022-07-21), p. 1"
}
]
}
score is the cosine between the query and the passage (4 decimals; higher is closer). Several
hits may come from one document; nothing is grouped. filters echoes the filters as applied,
include_undated included. The point id and the rest of the stored payload are not returned.date is the stored date, YYYY-MM-DD. date_precision says how much of it is known:
day, month or year (a month or a year is stored as the first day of its period: 2016-07-01 with
month is July 2016), or null when unknown. date_kind says what the date marks, as the producer
labels it (meeting, publication, period), or null. Both are read from the stored payload as they
are: null is normal for a collection whose payloads do not carry them yet (the production
collection until the orchestrator's sync-metadata has run), and an unknown precision is read as a day.page is the page the passage starts on as a reader counts it: the first page is 1 (the
collection stores pages from 0; the server adds one). It is null for a document without pages, and the
citation then has no page part. citation is <title> (<source_code> <doc_type>, <date>), p. <page>,
each missing part left out (the doc_id stands for a missing title). The date is written at its
precision: July 2016 for month, 2016 for year (English month names), the stored date for day,
for an unknown precision and for a date not written YYYY-MM-DD.source_codes must be a JSON array of strings, e.g. ["ecb"]; omit it for no restriction, the example being the caller's own value), an empty
array (... omit the argument for no restriction), a date in another form (date_from must be "YYYY-MM-DD", e.g. "2016-03-10"), a boolean written otherwise (include_undated must be a JSON boolean, true or false without quotes, not "true"; omit it for false). Nothing is corrected silently.source_code,
doc_type and language values from the collection and keeps them MOF_RAG_CODES_TTL_S seconds. A
value that is not among them is [invalid_argument] listing the valid values (as JSON strings), with a
hint for a near miss ("ECB": did you mean "ecb"?), instead of an empty result.
MOF_RAG_CODES_RETRY_S seconds): a code ingested since the last read is accepted at once, not after
the TTL.MOF_RAG_CODES_RETRY_S seconds later.limit above MOF_RAG_MAX_LIMIT is [limit_exceeded], never lowered. A result
larger than MOF_MCP_MAX_RESULT_CHARS is refused with [result_too_large], never cut; the message names
the largest limit that fits. Passages are 200 to 400 words: the default 8 are a few thousand tokens.rag_search answers [rag_unavailable] with the reason, and works again by itself
once a collection check passes (see the next point). If the model cannot be loaded (files missing with
no way to download them, or a file that is not the pinned one), the server starts too, logs the cause as
an error naming MOF_RAG_MODEL_CACHE, and rag_search answers [rag_unavailable] until the cache is
fixed and the server restarted.MOF_RAG_CALL_TIMEOUT_S (15 s), its wait included. MOF_RAG_QDRANT_TIMEOUT (10 s) is the limit of
one request to Qdrant, and a call makes several: the search, before it the read of the filter
values when it is due, the collection check after a failure, and, for a call with a date bound in
auto mode, the read of the collection's payload schema when it is due (see
Dates).
[rag_unavailable] and the reason: a call pays for one request timeout at
most, never for two in a row (a failed read of the filter values is not followed by a search).MOF_RAG_CHECK_RETRY_S seconds (5): the calls made meanwhile get its reason at once, without a
request, and so do the calls that arrive while a check is running. Then one call checks again. So
with Qdrant frozen, a burst of 50 calls is answered within one request timeout (only the call that
runs the check after a failed search waits longer, for that check or the end of its own budget),
later calls within milliseconds, and the tool works again at most MOF_RAG_CHECK_RETRY_S seconds
after Qdrant does.[rag_unavailable] search_refused,
nobody else is refused and server_info stays ready. The next call checks the collection before
its search (a few milliseconds): when it is the collection that changed (recreated with another
vector size, every search is refused), that check says so with collection_mismatch. The usual cause is a
collection in strict mode asked to filter on a field that has no payload index (a date bound without
the datetime index on date): the filter cannot be served by the collection as it is indexed. Step 2
of Deploying the rag toolset creates the indexes.MOF_RAG_MAX_CONCURRENCY searches (4) run at once, in threads of the toolset's own: the
calls in excess wait without holding a thread, so the other toolsets and server_info keep
answering whatever Qdrant does. A call whose budget ends answers [rag_unavailable]: busy if it
never got a slot, timeout if its search was still running. Such a search keeps its slot until its
request to Qdrant ends: abandoned searches cannot pile up.server_info adds a rag object: status (ready, or unavailable with a reason), collection,
model, engine_version, default_limit, max_limit, and source_codes, doc_types, languages:
the valid values of each filter as last read from the collection (at most 60 each; null while not
known). It reports the outcome of the last collection check (at start, then by the calls that had to
run one), without a request to Qdrant: a search that failed does not change it, the check that follows
does.qdrant_error) is logged by its class; any other is
answered internal_error and logged at ERROR by its class only, its text and traceback at DEBUG
only, a level the CLI never turns on (a developer who sets it accepts them);rag_engine loggers (present and future modules) through a
filter. A record that carries an error (an exception among its arguments or attached to it) or whose text holds the configured host
(a whole word, as configured or lowercased, alone or with a port: host qdrant is found in
http://qdrant:6333, not in a collection qdrant-docs; the configured collection's name, quoted as the
engine writes it, is not taken for the host unless it is the host) or the key (anywhere, even inside a
longer word) is written with its logger, its level and a fixed message naming the error's class only; the
engine's warning on a failed schema read also keeps its collection, the filter used meanwhile and the
delay before the next try. Other engine lines (the collection and the filter in use) are written as
they are. The error's text is dropped because it can hold the host, a TLS host name, a proxy's error
page naming an upstream host or an internal address, or the engine's hint about its own key variable.
What this changes in the process's logging (for an operator who embeds the server or configures
logging): the rag_engine logger stops propagating and gets one handler that filters each record,
then hands it to the root logger's handlers, or to logging.lastResort (stderr, WARNING and above)
when there is none, as the standard library does. The change is process-wide and lasts as long as the
process. A later logging.config.dictConfig that names rag_engine replaces that handler, and the
engine's records are then written as the engine writes them: leave rag_engine out of such a
configuration, or build the rag toolset after it. The CLI configures logging before it builds the
toolsets.
The HTTP libraries under the Qdrant client are apart: httpx logs one INFO line per request with
the server's address, which is why the CLI raises its logger to WARNING, and httpcore logs the host
and port of each connection at DEBUG only.rag_searchWhat a bound means. A document is dated by date and date_precision; rag-engine stores the period
it covers as date_start and date_end (the same day for day, the whole month for month, the whole
year for year). With intervals in use, a bound keeps a document when its period has at least one day in
common with the range: the minutes of a July 2016 meeting known only to the month are found by
2016-07-14..2016-07-14 and by any range touching July 2016; a document of the year 2015 by any range
touching 2015. A document dated to the day is found on that day, as before. A document without a date is
left out of every bounded search unless include_undated is true. Without intervals (legacy) a month or
a year document is found only at the first day of its period.
When results change. Intervals are used only once the collection's payloads carry date_start and
date_end and both fields have a datetime index. The orchestrator's sync-metadata writes the
intervals (with the corrected dates, precisions and kinds) and creates the two indexes; until it has run,
auto mode finds no index and every bound is applied to date, exactly as before this version, and
date_precision / date_kind are null in the hits. Within MOF_RAG_DATE_FILTER_REFRESH_S seconds after the
indexes appear, the running server uses them, without a restart. A collection whose indexes exist before
all its payloads have intervals loses nothing: a point without its interval yet is still found by its
date.
How a date bound is applied is rag-engine's date_filter_mode, set here by MOF_RAG_DATE_FILTER_MODE
and passed to the engine with every search, with MOF_RAG_DATE_FILTER_REFRESH_S and
MOF_RAG_DATE_FILTER_RETRY_S (the engine's own RAG_ENGINE_DATE_FILTER_* variables are never read).
auto (the default) follows the collection. A call with a date bound asks the collection
whether date_start and date_end both have a datetime index (one read request, which the read-only
key may send), and the answer is kept MOF_RAG_DATE_FILTER_REFRESH_S seconds (300). Indexed: the bound
is applied to the intervals; not indexed: to the date field, as before. A call without a date bound
never asks. The read is also made once at start, after the collection check and the read of the filter
values (not when either failed: then the first date-bounded call makes it), so the log says which
filter is in use (a line of the rag_engine.store logger: ... date filters in auto mode use the intervals, or ... use the date field (legacy)), and it is made again by the first date-bounded call
after the refresh delay: a collection upgraded while the server runs is followed without a restart.MOF_RAG_MAX_CONCURRENCY) and
within its budget (MOF_RAG_CALL_TIMEOUT_S); when it ends after the budget, the search is not sent and
the call has already answered [rag_unavailable] timeout.date field when it never read one, logs one
warning (logger rag_engine.store, naming the error's class only: see Privacy above), and reads
again MOF_RAG_DATE_FILTER_RETRY_S seconds later (30) at the earliest; the calls made meanwhile ask
nothing. The toolset does not remember that failure: no [rag_unavailable] follows from it,
server_info stays ready, and only the search itself says whether Qdrant answers. So with Qdrant
frozen, a date-bounded call may spend one request timeout on that read before its search, once per
retry delay: its budget still bounds it. While no answer has ever been read (a cold start, or a start
that skipped the read), the date-bounded calls that arrive during that first read wait for it,
each in its slot: a burst of them can hold every one of the MOF_RAG_MAX_CONCURRENCY slots for one
request timeout, once, and the calls behind them, with or without a date bound, wait as long (measured
with a 3 s request timeout and 4 slots: 8 date-bounded calls answered in about 3 s, an undated call sent
meanwhile in 2.8 s). Once an answer is known, or the read has failed, the other calls never wait for a
read in progress.interval and legacy never read the collection: always the intervals, or always the date
field. interval on a collection in strict mode without the two indexes is refused by Qdrant
([rag_unavailable] search_refused, the error of that call alone).The companies_* tools exist when a company store is configured (MOF_COMPANIES_CATALOG and
MOF_COMPANIES_DATA_ROOT) or SEC can be read (MOF_SEC_CONTACT, with MOF_COMPANIES_SOURCE not store);
the datasets_* tools only with a store. The filing-text tools (companies_fetch_filings,
companies_search_filings, `companies_read