docs: guide for wrapping MCP tools with Skyflow de/re-identify - #27
Conversation
Add docs/wrapping-mcp-tools-with-skyflow.md, a developer guide showing how outside teams can embed Skyflow's de-identify (on request) and re-identify (on response) round-trip inside their own remote HTTP MCP server's tools using reversible vault tokens. Covers the skyflow-node SDK approach (mirroring src/lib/tools/*) and a Detect REST API alternative for other stacks, plus vault-token semantics, prerequisites, credentials, and common gotchas. Links the guide from README (Learn More) and CLAUDE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
Review —
|
Address review feedback: the previous `search` example re-identified the provider's results, but a search response does not echo the tokenized query, so re-identify there is usually a no-op and gives a misleading mental model. Switch the flagship example to a summarize/LLM tool whose output is derived from the tokenized input (tokens flow through and are restored), and add a note clarifying that re-identify only restores tokens that actually appear in the response — keeping search as the request-side-protection caveat. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
Review — docs PR (de/re-identify wrapping guide)I verified the guide's technical claims against the current source. This is a well-crafted, accurate doc. Approving in spirit; a few suggestions below, none blocking. ✅ Verified accurate
Suggestions
Nits
No source-code changes, no test impact. Docs-only, and the parts that touch real APIs are either verified or clearly flagged. |
Address second review pass: - Clarify that re-identify matches tokens verbatim, and that a paraphrasing/reformatting LLM may alter or drop bracketed tokens and silently break the round-trip (not just the search no-op case). - Note that production code should validate the vault URL rather than assert with `!`, pointing to extractClusterId / validateVaultConfig. - Add an inline "illustrative — confirm against the API reference" marker to the REST curl body so copy-pasters can't miss the caveat. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
PR Review — docs: guide for wrapping MCP tools with SkyflowThanks for this — it's a genuinely useful, well-written guide that fills a real gap (folding the Skyflow round-trip into a developer's own tools rather than calling the standalone tools). This is docs-only with no source changes, so the review focused on technical accuracy against the code it references. I verified the claims against the repo, and they hold up well. ✅ Verified accurate
Quality notes
Minor / optional suggestions
Test coverageN/A — docs-only, no runtime surface. No tests needed. Overall: Accurate, appropriately hedged where it can't verify (REST), and mirrors the real code. Recommend merge after (optionally) tightening the REST caveats and the cluster-ID snippet. 👍 🤖 Generated with Claude Code |
Address third review pass: - Replace the `?.[1]!` cluster-ID assertion with an inline guard that throws on a missing/malformed vault URL, so the copy-paste path is the safe one rather than the pattern the surrounding prose warns against. - Resolve the apparent tension in the "stateless per call" gotcha: note the token<->value mapping lives in the vault, so re-identify still resolves in a later call or separate process. - Name the specific unverified REST pieces (endpoint path, entity_types / token_type body fields, X-SKYFLOW-ACCOUNT-ID) in the warning box. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Review — docs: guide for wrapping MCP tools with Skyflow de/re-identify Nice addition. This is a docs-only PR ( Accuracy — verified against source ✅
The verbatim-token / paraphrasing-LLM caveat and the same-authenticated-vault requirement for re-identify are both correct and are exactly the traps a first-time integrator would hit — good that they're called out prominently. Minor suggestions (non-blocking)
Test coverage N/A — documentation only, no source changes. The doc's snippets mirror code already unit-tested in Great work keeping the snippets tied to the real handlers and being explicit about the unverified REST pieces rather than inventing fields. 👍 |
Address fourth review pass: - Change the example Vault ID so it no longer shares the cluster ID as a literal prefix, which could imply the cluster ID is a substring of the vault ID rather than derived from the vault URL. - Note that the other required env vars deserve the same fail-loudly validation as the cluster ID guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
Review — docs: guide for wrapping MCP tools with Skyflow de/re-identifyThanks for this — it's a genuinely useful, well-structured guide. I verified the technical claims against the repo source rather than just reading for prose, and the accuracy is high. Summary: approve, with a few minor suggestions. What I verified ✅
The iterative self-review across the 5 commits paid off — the summarize-vs-search reframing (tokens must survive verbatim through a paraphrasing LLM) and the fail-loudly cluster-ID guard are exactly the right things to call out, and the guard now makes the copy-paste path the safe one. Suggestions (all minor / non-blocking)
Test coverageDocs-only change with no runtime surface — no tests needed or expected. ✅ Nice work. The one thing I'd want a human to eyeball before merge is the REST example (#1). 🤖 Generated with Claude Code |
Using Skyflow's own Detect OpenAPI spec (from the call-rest-apis skill) as
the source of truth, replace the previously-hedged REST section with a
verified one:
- Remove the bogus X-SKYFLOW-ACCOUNT-ID header (and the Account ID
prerequisite / env var) — the Detect API authenticates with the Bearer
token alone.
- Keep token_type as a TokenTypeMapping object ({ "default": "vault_token" }),
now confirmed against the spec.
- Add a verified re-identify example (POST /v1/detect/reidentify/string
takes { text, vault_id } and returns { text }) instead of prose.
- Show real response shapes (processed_text / entities / word_count /
character_count) and note the v1 vs v2 (beta) split and where the REST
bearer token comes from.
- Drop the "illustrative / unverified" warnings now that the shapes are
confirmed.
Note: the entity names for REST entity_types are the lowercase ENTITY_MAP
keys; token_type.default accepts vault_token / entity_unq_counter /
entity_only.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
Review — docs: guide for wrapping MCP tools with SkyflowDocs-only PR (new guide + two link pointers, no source changes). I verified the technical claims against the current source. Overall this is a high-quality, accurate guide — nicely scoped and honest about what's verified vs. illustrative. ✅ Verified accurate against the codebase
🔎 Suggestions
Not applicableNo perf/security-code surface and no tests to add (docs only). The prose correctly steers users toward reversible vault tokens and authenticated credentials, which is the safe default. Nice work — the accuracy of the SDK snippets against the live handlers is exactly right, and points 1–2 are the only things I'd tighten before merge. |
Flag at the point of copy — not only in the closing section — that the deidentify/reidentify helper snippets skip error handling, and point to how the repo handlers catch SkyflowError and surface http_code/details. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Review — docs: guide for wrapping MCP tools with Skyflow Nice, well-crafted developer guide. I verified the technical claims against the current codebase and they hold up well. Docs-only PR, no source changes. Verified accurate against the repo
Suggestions
Test coverage: N/A — documentation only, no runtime surface to test. Overall this is accurate, clearly written, and honest about its own uncertainty. The only real risk is the hand-authored REST field names; tightening the inline caveat there would make it merge-ready. |
The v1 wire format is asymmetric (de-identify returns processed_text, re-identify returns text) and uses entity_type/entity_scores/location; note that the skyflow-node SDK surfaces both responses as processedText and exposes entity/scores/textIndex/processedIndex, so readers moving between Approach A and B aren't surprised. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Review — PR #27: docs guide for wrapping MCP tools with Skyflow Reviewed as a documentation-only change (3 files, +339/-0: new docs/wrapping-mcp-tools-with-skyflow.md, plus link edits in README.md and CLAUDE.md). No source code changes, so the review focused on technical accuracy against the live implementation rather than runtime behavior. Verified accurate ✅ I cross-checked every code claim in the guide against the repo:
The commit history shows unusually careful iteration: the re-identify verbatim-match caveat, the cluster-ID guard, and the REST-section correction (dropping the bogus X-SKYFLOW-ACCOUNT-ID header after verifying against the Detect OpenAPI spec) all address real correctness traps. Nicely done. Minor suggestions (non-blocking)
Test coverage N/A — docs only. No handler/schema changes, so the CLAUDE.md Modifying Tools checklist does not apply. The CLAUDE.md pointer was added appropriately. Overall: High-quality, accurate documentation that fills a real gap. Approve after the reviewer confirms the REST wire-format field names. 🤖 |
Summary
Adds a new developer guide,
docs/wrapping-mcp-tools-with-skyflow.md, explaining in simple terms how an outside developer can integrate Skyflow's de-identification and re-identification into their own remote HTTP MCP server.Today this repo exposes
de-identify/re-identifyas standalone MCP tools. There was no guidance for the more common ask: folding the same Skyflow round-trip directly into a developer's existing tools — de-identify on the request, re-identify on the response, using reversible vault tokens so PII never leaves their server in the clear.What's in the guide
VAULT_TOKEN(reversible, persisted) vsENTITY_UNIQUE_COUNTER(one-way), and the "same authenticated vault" requirement for re-identify.skyflow-nodeSDK (recommended) — client setup, two smalldeidentify/reidentifyhelpers, and a generic tool wrapper. Snippets mirror the live reference implementation insrc/lib/tools/deIdentify.tsandsrc/lib/tools/reIdentify.ts.Changes
docs/wrapping-mcp-tools-with-skyflow.mdREADME.md— link the guide from Learn MoreCLAUDE.md— pointer to the guide from the Tool Implementations sectionNo source-code changes. Uses current tool names (
de-identify/re-identify) throughout.Notes for reviewers
skyflow.detect().deidentifyText(...)/reidentifyText(...),TokenFormat→VAULT_TOKEN, response fields).🤖 Generated with Claude Code
https://claude.ai/code/session_01L1HGToAv1T8agSECYUA39F
Generated by Claude Code