Expand description
Stateless Streamable HTTP (JSON + SSE) MCP server over the tableski engine.
Everything about tables and tools lives in tableski_core and is re-exported here, so
tableski::AppState and tableski_core::AppState are the same type. This crate adds the
HTTP wiring (app_router) and the CLI (src/main.rs). No Mcp-Session-Id is issued or
required — every POST is independent.
Modules§
- excel
- Excel ingestion: calamine → Arrow
RecordBatch→ registered DataFusion tables. - export
- Result export: run a query and write the result set as CSV or XLSX — only into the operator-configured export directory (no caller-controlled paths outside it).
- guard
- Untrusted-SQL guard: decide on the parsed statement whether a client that we do not trust may run it. Read-only queries over registered tables pass; everything else is rejected before DataFusion sees it.
- limits
- Per-query limits: a memory pool cap on the session, a wall-clock timeout, and caps on the
rows and bytes a result may carry back. Unlimited by default for embedders; the CLI applies
QueryLimits::safeunless told otherwise. - quota
- Quota primitives: what a tenant may use, and an in-memory meter that enforces it.
- register
- Unified file registration: one model for every supported format.
- source
- Where tables come from: the
TableSourceseam between a supplier of tables and the DataFusionSessionContextthat serves them.
Structs§
- AppState
- DataFusion-backed MCP handler: registered tables plus the session context to query them.
- Collected
- What
collect_limitedbrought back. - File
Source - Files on disk: the CLI’s
--file(extension picks the reader, table = file stem),--csvwith an explicit table name, and--xlsx(one table per sheet). - Ingest
Options - Ingestion options for
register_workbook. - Query
Limits - Bounds on what one query may consume and return.
Nonemeans unlimited. - Quota
- The allowance of one tenant.
None= unlimited. - Sheet
Info - One registered sheet: table name, source sheet name, and data dimensions.
- Table
Entry - One registered table and where it came from (CSV path or workbook sheet).
- Usage
- Point-in-time usage, for display and for the hosted server’s metering.
- Usage
Meter - Thread-safe in-memory counters for one tenant, checked against a
Quota.
Enums§
- Header
Mode - How the first row of each sheet is interpreted.
- Quota
Exceeded - Which allowance ran out. The
Displaytext is what the client sees. - Rejection
- Why a statement was refused in untrusted mode. The
Displaytext is what the client sees. - SqlTrust
- How much the server trusts the client sending SQL.
Constants§
- ACCEPT_
STREAMABLE Acceptvalue clients should send (re-exported from the shared transport).Acceptvalue a client should send for Streamable HTTP (JSON or SSE responses).- PROTOCOL_
VERSION - MCP protocol version reported on
initialize.
Traits§
- Table
Source - A supplier of tables. Implementations register whatever they know about into the session and describe it; see the module docs for stateful sources.
Functions§
- app_
router - Build the stateless Streamable HTTP router over the registered tables.
- call_
tool - Run one tool by name with its JSON arguments and return the result text (unframed).
- check_
plan - Second decision, on the physical plan: refuse cartesian products. A cross join or a nested-loop join over registered tables is the one query shape a wall-clock limit cannot stop once it runs (DataFusion yields too rarely inside it), so it never starts.
- check_
untrusted - Parse
sqland decide whether an untrusted client may run it againstregisteredtables. - collect_
limited - Execute
dfas a stream, stop at the row/byte caps, and give up at the timeout. - query_
runtime - The process-wide tokio runtime queries execute on when a timeout is set: one thread per core, separate from whatever runtime serves clients, so a busy query cannot starve the server. Built on first use.
- register_
path - Register
pathby extension. Returns oneTableEntryper registered table (workbooks may produce several — one per sheet). - register_
sources - Build a registry: register
sourcesin order intoctxand collect their entries. - register_
workbook - Open
path(xlsx / xls / ods), convert every non-empty sheet to an ArrowRecordBatch, and register each as a DataFusion table. Returns the registered sheets. - run_
bounded - Run
workundertimeouton thequery_runtime: the caller’s runtime (HTTP, timers) stays responsive however busy the work is, and on expiry the task is aborted (it stops at its next yield point). Without a timeout,workruns inline. - tools_
list - The MCP
tools/listresult: the five tools with their JSON input schemas.