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.
An MCP server for your AI stack.

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 the core read, aggregation and append tools mirrored over plain HTTP. The server is the enforcement point, not a pass-through: it works behind the MCP gateway you already run, and it checks every tool call itself.
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
Reports
Aggregate
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
{
"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, 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.
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
Over /api/ml/* (REST) or the MCP ML tools
Bring your own models, or point at a hosted API. Nothing has to leave your network:
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 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.
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.
Everything, over HTTP.
The MCP read, aggregation and append surface mirrored over HTTP, 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.
# 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
Search & query
/search · /api/query · /api/query/relationships · /api/query/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).
Reports
/api/reports · /api/reports/{key}/run
List the saved statements you may run, and run one under your own permissions: rows plus the statement that produced them.
Scopes & custody
/api/scopes · /custody/export · /custody/{id}/verify
Matter boundaries, chain of custody, hold and release, lock and dispose. Callable and exportable, not just recorded.
Audit
/api/audit · /api/audit/export
The append-only trail, queryable and exportable, which is what an auditor actually asks for.
Auth & tokens
/auth/login · /refresh · /tokens
Session JWTs and long-lived personal tokens; one jti revocation chokepoint across REST and MCP.
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 the production backends. PostgreSQL, MariaDB, and MongoDB prove the abstraction is portable and are supported for development and small deployments.
Wire your agents to the corpus.
See the MCP, SQL, and REST surfaces against a live index, permission-trimmed end to end.