NEWPromptev MCP Server: one URL for every tool, every agent and your team’s knowledge. Connect Claude Code, Cursor, or any MCP client.→

Context Engine: guide

Put your documents in, then find the right passages, whole documents and figures with one call. Hosted by promptev and reached with a project API key from the Python SDK, the JavaScript SDK, plain HTTP or MCP.

Overview

The Context Engine is the knowledge layer of promptev. You give it your documents (PDF, Word, Excel, CSV, slides and more). It finds the passages that answer a question, reads whole documents, works out figures from your spreadsheets, and shows how people, companies and things connect. Every answer cites its sources, and each caller sees only what they are allowed to see.

promptev hosts the engine. You use it in two ways: ingestion (put documents in) and retrieval (search them). The same knowledge tool is behind every way in: the SDKs, the HTTP API, MCP and the agents you build in promptev. Every sample comes in Python and TypeScript: pick one with the toggle at the top of the page.

You get

Search by meaning and keywords, whole documents, figures over every row of a spreadsheet, and a Context Graph of who and what is connected. Answers cite the documents they came from.

Your data, your models

A workspace can use its own embedding, OCR and vision, and extraction models, and keep its knowledge in its own database. Enterprise can run all of promptev in its own cloud or on premises.

The 30-second version: API key → upload_document() → search_knowledge_base("discover") → search_knowledge_base("search", query=...). Your agents in promptev use the same knowledge base on their own, with nothing to wire.

1 · Get a project API key

Open your project in the promptev console and create a key under the project’s API keys. It starts with fk_. A key belongs to one project: it reads and writes that project’s knowledge base and nothing else, so no call names a project.

Send it as Authorization: Bearer fk_.... Keep it on your server. Never put it in a browser or a mobile app.

2 · Install an SDK

Both SDKs are version 1.3.0. The Python SDK needs Python 3.8 or later.The JavaScript SDK runs anywhere fetch does.

Shell
pip install promptev
Shell
npm install @promptev/client
Python
from promptev import PromptevClient

client = PromptevClient(api_key="fk_...")
TypeScript
import { PromptevClient } from "@promptev/client";

const client = new PromptevClient({ apiKey: "fk_..." });

3 · Upload documents

An upload goes into the project’s knowledge base, in the same Uploads source the console writes to. The project’s agents can use it on their next turn. Each file gets its own result: one file that fails never fails the others.

Python
result = client.upload_document("handbook.pdf")
print(result.status, result.document_id, result.chunks)

# Up to 20 files per call, 25 MB each
results = client.upload_documents(["refunds.pdf", "pricing.xlsx"])
for r in results:
    print(r.filename, r.status, r.error or "")

# Also extract people, companies and how they connect (the Context Graph)
client.upload_document("org-chart.pdf", mode="graph")
TypeScript
import { readFile } from "node:fs/promises";

const { results } = await client.uploadDocument(
  { name: "handbook.pdf", content: await readFile("handbook.pdf") },
  { mode: "hybrid" } // or "graph" to build the Context Graph as well
);
for (const r of results) console.log(r.filename, r.status, r.error ?? "");

Limits

Up to 20 files per call, 25 MB each. The call returns when every file is ready, so give large files a longer client timeout than the 30 second default.

Graph mode

mode="graph" also extracts entities and relationships into the Context Graph, for the graph actions. Leave it out for the workspace’s default.

For a large or changing set of files, connect the source in the console instead (Google Drive, SharePoint and OneDrive, Slack, Dropbox, Atlassian and more). promptev keeps it in sync, and the same calls search it.

5 · Knowledge actions

The same actions work from the SDKs, the HTTP API and MCP. The SDKs list them in KNOWLEDGE_ACTIONS. The graph actions need documents uploaded in graph mode; discover says which actions your project can run.

ActionWhat you getFields
discoverWhat is in the knowledge base: each document and what is inside it (a sheet’s columns, a document’s sections), the extracted fields, and which actions this project can run. Call it first.source_ids, document_ids, limit, cursor
searchPassages by meaning or keywords. For an ID, code or invoice number, search the bare identifier.query, top_k, mode, source_ids, document_ids
get_docOne whole document by id.document_id
get_docsSeveral whole documents at once.document_ids, max_chars
get_chunksOne long document in order, a range at a time. Start at a search hit’s chunk_idx to read around it.document_id, start, end
listBrowse the documents without searching.source_ids, document_ids, limit, cursor
query_metaThe structured fields a question names (dates, amounts, parties) and each document’s value.query, source_ids, limit
computeA figure from your spreadsheets (total, average, count, ranking) or the exact row for one value, over every row.query, source_ids, document_ids
map_reduceThe same question asked of every document in scope, one answer per document.query, source_ids, document_ids
get_neighborsWhat is one step from a named thing in the Context Graph.entity, limit
traverseEverything within a few steps of a named thing, or how two things connect.entity, depth, category, limit
find_relatedConnections of one kind across the whole knowledge base.category, label, entity_type, limit
community_summaryThe main themes and groups the knowledge base falls into.query, limit

top_k defaults to 10. mode on a search is "hybrid" or "graph"; leave it out and the right one is chosen for you. Full field notes are on the knowledge tool page.

6 · HTTP

No SDK needed. The base URL is https://api.promptev.ai, with the same Bearer key.

Upload: POST /api/v1/documents
curl https://api.promptev.ai/api/v1/documents \
  -H "Authorization: Bearer $PROMPTEV_API_KEY" \
  -F "[email protected]" \
  -F "[email protected]"
Search: POST /api/v1/knowledge
curl https://api.promptev.ai/api/v1/knowledge \
  -H "Authorization: Bearer $PROMPTEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action": "search", "query": "how many days do customers have to ask for a refund", "top_k": 5}'

Every field, response and status code is on the HTTP API page.

7 · MCP

Every promptev project has its own MCP server. Add it to any MCP client with the project’s URL and key from the console. Its search_knowledge_base tool is the same tool, with the same actions and fields, and its upload_document tool adds a file. The tool describes itself to the model, so the model knows to call discover first.

8 · Permissions

Each search returns only what the caller may see. A project API key reads its whole project and nothing outside it. People in the promptev app see only what their access allows, also when an agent searches for them. Answers cite their sources, so every claim can be checked.

9 · Your models, your database

A workspace can bring its own:

Embedding model

Your own embedding provider and model for search.

OCR and vision model

Your own model to read scanned pages and images.

Extraction model

Your own LLM to extract entities and relationships for the Context Graph.

Database

Your knowledge is stored in your own database.

These are workspace settings in promptev. The SDK and API calls on this page stay the same. To run the whole platform in your own cloud or on premises, ask about Enterprise.

10 · Cost

Calls are paid in credits, at $0.005 a credit.

WhatCredits
Upload a document1 per page, slide or MB (minimum 1)
A knowledge call1
A search+1, or +5 when the graph is searched

Knowledge calls from the SDKs and the HTTP API cost the same as on MCP, with no extra API-call charge. The rates are the same for every workspace, including one on its own database and models.

11 · Errors

The SDKs raise one error class per status. Each carries the message, the status code and, when the server said which, the field at fault. A 502, 503 or 504 is retried for you, then raised as ServerError.

StatusSDK errorMeaning
401AuthenticationErrorThe API key is missing, revoked or expired.
402InsufficientCreditsErrorThe workspace has no credits left. Top up; a retry does not help.
404NotFoundErrorThe key reaches no project.
422ValidationErrorAn unknown action, a field the action does not take, no files, too many files, a file too large or of a type that is not accepted. The error names the field.
429RateLimitErrorToo many requests. Wait for the number of seconds in Retry-After (retry_after / retryAfter on the error).
1,000 free credits for a 30-day trial · No card required · No subscription1,000 free credits · 30-day trial · No card