mirror of
https://github.com/hanzoai/lastpass-mcp.git
synced 2026-11-14 21:30:44 +00:00
3.1 KiB
3.1 KiB
LLM.md — hanzoai/lastpass-mcp
Native LastPass MCP boundary for browser autofill, Hanzo KMS sealing, and hanzoai/egress custodied outbound spend.
Laws
- Never return a credential. Callers ask for metadata (
lastpass_status,lastpass_list), an in-browser fill (lastpass_autofill), a KMS seal (lastpass_seal_to_kms), or a custodied HTTP call (lastpass_egress_fetch). Passwords, notes, cookies, provisioning hashes, and TOTP seeds/codes must never appear in MCP outputs, logs, errors, disk files, or git. - Every credential lives on one call's stack. Decrypted vault items (
VaultCredential) are wrapped withguardCredential()(toJSONreturns strippedVaultEntryMetadata) and discarded immediately after the operation completes. - Scrub every outbound surface. Upstream providers and CLIs sometimes echo rejected keys or partial suffixes.
src/scrub.tsstrips raw, Base64, Basic-Auth Base64, Base64URL, URL-encoded, form-encoded, JSON-escaped, and hex forms — plus 4+ character shared runs on error messages (ERROR_SCRUB_SPAN = 4, matchinghanzoai/egress/call.go). - Sovereign CLI & Zero Shell Interpolation. Always resolve
~/.local/bin/hanzo(resolveHanzoCliPathexplicitly refuses/usr/bin/hanzo) and invoke subprocesses (hanzo,lpass) exclusively viaexecFilewithshell: false. - Redirects and private IPs are refused on custodied fetches.
fetchWithCustodiedCredentialsetsredirect: 'manual', requireshttps://, blocks RFC1918 / loopback / link-local / cloud-metadata IPs, and forbids caller-suppliedAuthorization,Cookie, orHostheaders.
Repository Layout
c-cli/— Vendored upstreamlastpass/lastpass-cli(C99, GPLv2 + OpenSSL exception). Built intobin/lpassbymake build-cwhenlibcurl,openssl, andlibxml-2.0headers are installed.src/scrub.ts— Credential redaction, metadata sanitizer, KMS slugifier, and RFC 6238 TOTP generator (node:crypto).src/vault-protocol.ts— Pure Node/TypeScript LastPass Vault protocol (iterations.php,login.php,getaccts.php, PBKDF2-SHA256 key derivation, AES-256-CBC/GCM/ECB & PKCS#8 RSA-OAEP decryption, binaryLPAV/ACCT/ACFL/SHARparser).src/lpass-cli.ts— Arm's-length subprocess adapter forlpass.src/zap-client.ts— Binary ZAP Unix socket client (/run/user/$UID/zap/zapd.sock) forhanzo.getCookies(cookie names only),lastpass.accounts,lastpass.fill, andhanzo.act(op: "fill").src/enterprise.ts— LastPass Enterprise API (enterpriseapi.php) metadata adapter.src/kms-egress.ts— Hanzo KMS sealer (credentials/<slug>/{USERNAME,PASSWORD,URL,TOTP_SECRET}) andhanzoai/egress/v1/fetch+ in-process custodied HTTP client.src/index.ts&src/cli.ts— MCP JSON-RPC 2.0 server supporting stdio and Streamable HTTP (--http --port 3847,POST /mcp,GET /healthz).test/lastpass-mcp.test.ts— Upstreamc-clicipher vector tests, PBKDF2/blob round-trips, adversarial secret-echo scrubbing tests, mock ZAP socket tests, and KMS/Egress tests.
Verification
make build
npm test