1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (c) 2026, Salesforce, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! MCP (Model Context Protocol) server that exposes the Hyper columnar database
//! as an instant SQL analytics engine for LLM workflows.
//!
//! # Architecture
//!
//! The crate is layered bottom-up:
//!
//! - [`error`] — Structured error codes with recovery suggestions for LLM self-correction.
//! - [`attach`] — Registry of additional `.hyper` databases attached to the primary
//! workspace for cross-database JOINs and `copy_query`. Replays attachments
//! after a `ConnectionLost` reconnect.
//! - [`stats`] — Performance telemetry (throughput, timing) attached to every response.
//! - [`schema`] — Three-tier schema inference: exact (Arrow/Parquet), structural (JSON),
//! heuristic (CSV). Also handles user-provided schema overrides.
//! - [`engine`] — Manages the `HyperProcess` lifecycle, connection, table CRUD, and
//! query execution. Supports ephemeral and persistent workspace modes.
//! - [`ingest`] — Loads inline JSON (row-by-row INSERT) and CSV (`COPY FROM`) into Hyper.
//! - [`ingest_arrow`] — Loads Parquet and Arrow IPC files via the Arrow crate.
//! - [`inspect`] — Dry-run file inspection powering the `inspect_file` MCP tool.
//! - [`export`] — Writes query results to CSV, Parquet, Arrow IPC, or `.hyper` files.
//! - [`chart`] — Renders SQL query results as PNG/SVG charts via the `plotters` crate.
//! - [`saved_queries`] — Named read-only SQL queries exposed via tools and `hyper://queries/...` resources.
//! - [`subscriptions`] — Per-URI registry of MCP clients that asked for resource-update notifications.
//! - [`table_catalog`] — User-visible catalog of data tables (`_table_catalog`) tracking
//! source, purpose, and load history so workspaces are self-documenting. Disabled by `--bare`.
//! - [`version`] — Compile-time-captured version strings for the MCP crate and the underlying `hyperdb-api`, with a git-hash suffix.
//! - [`readme`] — Static LLM-facing README returned by the `get_readme` tool.
//! - [`watcher`] — Monitors directories for incremental ingest via a `.ready` sentinel protocol.
//! - [`server`] — MCP tool definitions and the `rmcp` server handler that ties everything together.