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