Skip to content
haystak
Request a demo
Developers

Your corpus, from anything you build.

Agents speak MCP. BI tools speak SQL. Everything else speaks REST — all over the same permission-trimmed engine, with the same audit. Pick whatever fits your stack.

Get started

From zero to first query.

Quickstarts, the full API reference, and client setup for MCP, SQL, and REST are in the docs — copy-paste to a running query.

MCP server

An MCP server for your AI stack.

haystak MCP tools
The MCP server - permission-trimmed tools your AI stack can call.

haystak is a native Model Context Protocol server. Connect Claude, Cursor, or any MCP client and give it the corpus — with every call trimmed to the caller's grants, and full REST parity.

The full MCP tool catalog over one connection — the read, aggregation, and append surface in full below, plus every RAG & ML operation. Hover any tool for what it does:

Read

search_documentsFull-text search across sources; returns matching IDs with snippets and provenance.
get_documentRetrieve one entity's attributes (content text optional).
read_passagesThe most relevant text windows of one document around a query.
get_relatedAn entity's related file, content, and other versions at the same path.
find_similarNear-duplicate detection by SimHash fingerprint.
compare_documentsSimilarity score and attribute-level diff between two entities.
rerankRe-score candidate IDs against a query and sort by relevance.
query_structuredField-filtered query of a source; joins rows across sources.
get_record_bundleOne record plus its full foreign-key subtree in a single call.
list_sourcesEvery ingested source, with entity counts.
get_schemaAttribute names and types for a source.
glossaryLook up a curated domain term and its synonyms.

Aggregate

countCount distinct entities matching filters.
facetDistinct values and counts for an attribute.
aggregateGroup-by with count / sum / avg / min / max.
job_statusPoll a large aggregation returned as a background job until it completes.
sampleRandom N entity IDs from the corpus (seedable).
timelineCount entities by date, bucketed day to year.
manifestEntity id + content hash per item, to prove a set is complete and unaltered.
exceptionsLedger of items that terminally failed extraction.
reconcileCounts-balance: how much of a source actually processed.

Machine learning & RAG

Every ML & RAG operation runs over the same MCP connection — RAG retrieval with cited answers, embeddings, summarize, translate, classify, extract entities, and language detection (detailed in RAG & ML below), plus run_ml_query, a raw-prompt escape hatch. Same RBAC, same audit.

Append

add_tagTag an entity; author server-set, provenance-stamped.
remove_tagRemove a tag from an entity by its tag id.
add_annotationAppend a note; multiple notes accumulate.
append_attributeAppend one EAV row (latest-wins, user provenance).
append_entityCreate a non-content entity (mcp:: namespace).
ingest_documentCreate a content entity from text (mcp:: namespace).
glossary_addAdd or update a shared glossary term (write scope).
tools/call · search_documents
{
  "name": "search_documents",
  "arguments": {
    "query": "q3 revenue by region",
    "sources": ["finance-share", "crm-db"],
    "limit": 10
  }
}
// results trimmed to the caller's scopes
// fail-closed on missing identity
RAG & ML

RAG, embeddings, and enrichment — as an API.

Embed content into vectors, run kNN vector search, and ask questions with RAG — answers come back with cited sources. Each citation opens the exact record the answer was built from, so a reviewer can check it: a citation is provenance you can trace, not a guarantee the sentence is true. Plus classification, summarization, translation, and entity extraction. Drive it over REST or MCP. Behind it: your own models on your own hardware (Ollama or any OpenAI-compatible server), or a hosted API (OpenAI, Anthropic) if you choose — nothing has to leave your network.

  • Embeddings + kNN vector search across your corpus.
  • RAG with citations — grounded answers, not guesses.
  • Enrich — classify, summarize, translate, extract entities.
  • Over /api/ml/* (REST) or the MCP ML tools — same RBAC, same audit.
RAG query · /api/ml/query
POST /api/ml/query
{
  "query": "what changed in the q3 contract?",
  "sources": ["contracts"],
  "mode": "rag"
}

# answer + cited source passages,
# trimmed to the caller's scopes
ML & RAG operations

Over /api/ml/* (REST) or the MCP ML tools

querySemantic kNN retrieval over the corpus; generate=true returns a grounded, cited answer.
embedTurn text into an embedding vector for kNN search or clustering.
summarizeSummarize text or a whole document by id (map-reduces large docs).
translateTranslate text into a target language (ISO 639-1).
classifyScore text against your own label set.
extractNamed entities (people, orgs, locations) with offsets and confidence.
detect-languageIdentify the dominant language of the text.

Bring your own models, or point at a hosted API — nothing has to leave your network:

OllamaOpenAI-compatibleOpenAIAnthropic
T-SQL over the corpus
SELECT a.region, COUNT(*) AS docs
FROM documents d
JOIN accounts a
  ON d.account_id = a.id
WHERE d.body LIKE '%renewal%'
GROUP BY a.region
ORDER BY docs DESC;

-- files and database rows, one query
-- INFORMATION_SCHEMA + sys.* available
SQL endpoint

SQL for your analysts.

haystak speaks the SQL Server wire protocol (TDS), so the whole cross-source corpus shows up as a SQL Server database - tables, columns, a PK/FK graph, INFORMATION_SCHEMA and 60+ sys.* views. Built for aggregate reach across the whole corpus, not OLTP transaction speed.

  • Real T-SQL: joins, aggregates, CTEs (incl. recursive), window functions, PIVOT/UNPIVOT, subqueries.
  • File-derived entities surface as tables — not just your databases.
  • Verified with SSMS, Power BI, sqlcmd, and ODBC Driver 18.
  • UPDATE writes annotations back (tag/flag/code) — source columns stay immutable.
  • Permission-trimmed at the wire, same identity and RBAC as search.
The supported surface

Query

Real T-SQL, not a thin subset: joins, GROUP BY, subqueries, CTEs (incl. recursive), window functions, PIVOT/UNPIVOT, STRING_AGG, FORMAT, JSON functions, table-valued functions, and control-of-flow.

Catalog

INFORMATION_SCHEMA plus 60+ sys.* views and the cross-source PK/FK graph — so tools introspect the corpus like any SQL Server database.

Write-back

UPDATE writes annotations (tag, flag, code) back as new rows; the original source columns stay immutable, gated by source:write.

SSMSPower BIExcelsqlcmdODBC Driver 18TDS / LOGIN7 · :1433pure-Go, no SQL Server
REST API

Everything, over HTTP.

Full REST parity with the MCP surface, plus ingest and render — all behind the same auth, scope, and audit middleware. If a capability exists, it has an endpoint.

  • OpenAPI spec + built-in Swagger UI — browse and try every endpoint at /swagger.
  • JWT auth — short-lived session tokens and long-lived personal tokens, both JWTs sent as a standard Authorization: Bearer header; one revocation chokepoint (jti) across REST and MCP.
  • Same scope & audit as every surface — results trimmed to the caller, every call logged.
  • Search, aggregate, render, ML, and ingest — JSON in, JSON out.
authenticated search
# every call: authenticated, scoped, audited
curl -s https://haystak.example/search \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"q3 revenue","sources":["finance"]}'

# results come back trimmed to the caller's scopes
Endpoint groups

Search & query

/search · /api/query · /relationships · /schema-graph

Full-text, by-ID, structured, and relationship queries with attribute filters and provenance.

Aggregations

/api/mcp/count · facet · aggregate · sample

Counts, facets, and rollups — ACL-stamped with the caller's identity.

ML & RAG

/api/ml/*

Embed, classify, summarize, translate, extract entities, detect language, and RAG query with cited answers.

Render

/api/thumb · /api/preview · /api/render-entity · /api/render-sprite

Thumbnails, page previews, posters, and video sprites served on demand.

Ingest & write

/upsert · /upsert/batch · /api/mcp/ingest-document

Push entities and content; append tags, notes, and attributes — append-only, provenance-stamped.

Auth & tokens

/auth/login · /refresh · /tokens

Session JWTs and long-lived personal tokens; one jti revocation chokepoint across REST and MCP.

Backends

Backend-agnostic by design.

Storage sits behind one interface, so the same engine runs on any supported store and swaps by configuration — no lock-in. Elasticsearch and OpenSearch are recommended for production search; PostgreSQL, MariaDB, and MongoDB suit smaller or embedded deployments.

ElasticsearchOpenSearchPostgreSQLMariaDBMongoDB
accounts
idPK
name
region
documents
idPK
account_idFK
body
Build on haystak

Wire your agents to the corpus.

See the MCP, SQL, and REST surfaces against a live index — permission-trimmed end to end.