Skip to content

docs(mcp): surface KV store on crates.io README + fix error mapping (follow-up to #185)#188

Merged
StefanSteiner merged 3 commits into
tableau:mainfrom
StefanSteiner:fix/mcp-kv-readme-and-error-mapping
Jul 10, 2026
Merged

docs(mcp): surface KV store on crates.io README + fix error mapping (follow-up to #185)#188
StefanSteiner merged 3 commits into
tableau:mainfrom
StefanSteiner:fix/mcp-kv-readme-and-error-mapping

Conversation

@StefanSteiner

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #185. Three commits that were finished locally but never
pushed before #185 merged, so they missed the v0.6.0 cut. Two are the
human-facing KV docs (the reason the crates.io page
shows no key-value store even though v0.6.0 ships the tools), and one is
a real error-mapping fix.

Why the docs were missing from v0.6.0

crates.io renders hyperdb-mcp/README.md. In #185, the KV documentation
landed only in hyperdb-mcp/src/readme.rs (the LLM-facing get_readme
string) — no commit in the merged PR touched README.md. So get_readme
returns full KV docs, but the rendered crate page has zero KV mentions.
This PR carries the README.md edits that were left behind.

What's in this PR

Fixed

  • fix(mcp): caller-fixable argument errors now map to INVALID_ARGUMENT,
    not INTERNAL_ERROR.
    An invalid identifier from the hyperdb-api layer
    (e.g. a KV store/key with a disallowed byte or over the 512-byte limit)
    previously fell through to the catch-all INTERNAL_ERROR, mislabeling a
    caller-fixable validation failure as a server bug. InvalidName /
    InvalidTableDefinition now map to INVALID_ARGUMENT. Message text
    unchanged. (error.rs + 62 lines of error_tests.rs coverage.)
  • docs(mcp): README.md --read-only flag table no longer claims
    Hyper-format export is disabled.
    The row wrongly listed "Hyper-format
    export" among disabled operations, contradicting both actual behavior
    (export has no read-only gate — a .hyper export is a read-only file
    copy and stays allowed) and the same doc's Read-Only "Allowed" list.

Docs

  • docs(mcp): surface the KV store across all human-facing doc surfaces.
    Adds the ### Key-Value Store tool section (8-tool table, example, key
    properties), the Features bullet, the hyper://schema/kv Resources row,
    and the mutator/reader split across the three read-only enumerations in
    hyperdb-mcp/README.md; adds the top-level README.md KvStore /
    AsyncKvStore bullet. (Also touches readme.rs/server.rs doc strings
    for the kv_pop lexicographic-order and kv_list_stores no-registry
    wording nudges.)
  • docs(mcp): add an on-demand KV smoke-test guide (SMOKE_TESTS.md).

Verification

CI-exact toolchain (1.97.0-aarch64-apple-darwin, HYPERD_PATH set):

  • cargo fmt --all --check → clean
  • cargo clippy --workspace --all-targets --all-features -- -D warnings → clean
  • cargo test -p hyperdb-mcp --test error_tests → 12 passed
  • cargo test -p hyperdb-mcp --test readme_tests → 3 passed
  • cargo test -p hyperdb-mcp --test kv_tools_tests → 11 passed

Note for the maintainer

The hyperdb-mcp CHANGELOG's [Unreleased] section still holds the
v0.6.0 KV / TCP-keepalive bullets — release-please appears not to have
promoted [Unreleased][0.6.0] for this crate at the v0.6.0 cut
(there is no ## [0.6.0] heading on main). This PR's two new ### Fixed
bullets are stacked above that content under [Unreleased], so a
v0.6.1 release will sweep the whole section into the new version heading.

An invalid KV `store`/`key` (a disallowed byte or over the 512-byte
limit) surfaced from the hyperdb-api layer as `Error::InvalidName` and
fell through the catch-all arm to `INTERNAL_ERROR` — telling an LLM
caller "server bug, give up" for something it supplied and can fix.
Map `InvalidName` and `InvalidTableDefinition` to `INVALID_ARGUMENT`,
which carries a self-correction suggestion; the human-readable message
naming the offending byte or length is unchanged.

`InvalidOperation` is deliberately left out: it is hyperdb-api
caller-API misuse where the caller is this MCP's own Rust code, not the
LLM, so it correctly stays `INTERNAL_ERROR`. A regression test locks in
that distinction.

Caught during the KV MCP smoke run.
Capture the manual, tool-driven smoke tests that exercise the eight
`kv_*` tools against a live MCP server: CRUD/upsert, listing and
discovery, value fidelity, destructive semantics, input validation
(now INVALID_ARGUMENT), read-only mode, database routing/isolation,
the LEFT JOIN enrichment pattern, the hidden backing table, and
single-process atomicity. Includes a safety section: the persistent
database may hold real data, so scratch names are `smoke_`-prefixed
and every run ends by verifying the persistent DB is untouched.

The existence-check safety rule is scoped to the target database —
a bare `describe` inspects only the ephemeral primary and `status`
never lists table names, so neither alone protects a persistent write.

Cross-linked from DEVELOPMENT.md's Test section.
The key-value scratchpad tools shipped without documentation in the
user-facing MCP README, the LLM-facing get_readme, or the workspace
READMEs. Add coverage in the right places so an LLM told "remember X"
considers kv_set instead of always reaching for CREATE TABLE:

- hyperdb-mcp/README.md: new "### Key-Value Store" tool section; a
  "Table or key-value store?" decision rule in Queryable Memory for AI;
  the hyper://schema/kv Resources-table row; KV tools in the Features
  bullet; and the KV mutator/reader split across all three read-only
  enumerations (flag table, Allowed, Blocked).
- src/readme.rs (get_readme): "KV store vs. a custom table" decision
  subsection; kv_pop lexicographic-order clarification; a describe
  persistent-DB signpost (status reports counts, not names); a
  back-link completing the bidirectional cross-link.
- src/server.rs: kv_pop and kv_list_stores #[tool(description)] strings
  clarify lexicographic pop order and the no-store-registry behavior.
- README.md (top-level): KvStore / AsyncKvStore Key Features bullet.

Also fix a pre-existing false claim on the --read-only flag-table row
(carried forward on a line this change edited): Hyper-format export is
NOT disabled in read-only mode (export has no writable gate; it's a
read-only file copy), matching the Read-Only "Allowed" list and the
HyperMcpServer::new doc comment.
@StefanSteiner StefanSteiner merged commit 5042d80 into tableau:main Jul 10, 2026
11 checks passed
StefanSteiner added a commit that referenced this pull request Jul 10, 2026
…#188 (#189)

fix(mcp): release KV README docs + INVALID_ARGUMENT error mapping (#188)

#188 landed the human-facing KV store documentation (the crates.io
README section that was missing from v0.6.0) and mapped caller-fixable
identifier errors to INVALID_ARGUMENT. It merged with a docs(mcp):
squash title, so release-please saw no releasable commit and cut no
version. This empty fix(mcp): commit gives release-please a user-facing
change to bump, so the already-merged #188 content ships as v0.6.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant