VSCode-Perplexity-MCP icon indicating copy to clipboard operation
VSCode-Perplexity-MCP copied to clipboard

stdio transport: Vault always locked on Windows — authenticated Pro features unavailable in Claude Code / Antigravity

Open luvher opened this issue 6 months ago • 2 comments

Product

VS Code extension (perplexity-vscode)

Version

perplexity-user-mcp 0.8.39

MCP Client (if applicable)

Other

Perplexity tier

Pro

OS

Windows 11 Pro 10.0.26200

Browser used by the MCP server

Google Chrome 147.0.7727.139

What happened?

Environment:

Extension/MCP version: perplexity-user-mcp 0.8.39 OS: Windows 11 Pro 10.0.26200 Node.js: v24.13.1 Browser: Google Chrome 147.0.7727.139 IDE: VS Code with Antigravity extension (Claude Code) Account tier: Pro Transport: stdio — daemon proxy Problem:

When using the stdio transport, the MCP daemon always fails to decrypt vault.enc with the following error:

[vault] getSavedCookies failed for profile personal: Vault decrypt failed: wrong passphrase or corrupted ciphertext. The VS Code Extension encrypts vault.enc using VS Code SecretStorage internally. However, the stdio subprocess spawned by Claude Code has no access to VS Code SecretStorage and cannot decrypt the vault — regardless of what is set in PERPLEXITY_VAULT_PASSPHRASE.

Steps to reproduce:

Install the VS Code Extension, log in via Dashboard (Pro account) Configure Claude Code with stdio — daemon proxy transport (via MCP Config Management) Call perplexity_reason or perplexity_research from Claude Code Error: requires an authenticated Pro account What was tried:

Setting PERPLEXITY_VAULT_PASSPHRASE in the MCP env block → ignored (env vars not passed by Claude Code, see anthropics/claude-code#1254) Setting PERPLEXITY_VAULT_PASSPHRASE as system-wide Windows User environment variable → env var reaches the process, but passphrase doesn't match vault.enc (Extension uses VS Code SecretStorage, not keytar directly) Deleting vault.enc and re-logging in → new vault.enc still encrypted with VS Code SecretStorage key, not the keytar key HTTP loopback transport → port changes on every daemon restart, configs become stale immediately despite "Auto Regenerate Stale Configs" being enabled Expected behavior: perplexity_reason and perplexity_research should work in Claude Code with a Pro account.

Workaround: None found. perplexity_search works (anonymous mode).

Suggestion:

Either document clearly that authenticated Pro features only work via HTTP transport in VS Code itself (not in external MCP clients on Windows) Or provide a stable port option (fixed port via config) so HTTP loopback remains usable across restarts

Doctor output (optional, recommended)

## [X] vault -- fail
- [OK] **encryption** -- AES-256-GCM (vault.enc)
- [OK] **unseal-path** -- env var (keychain unavailable — expected on headless Linux)
- [-] **keychain-preferred** -- keychain not applicable
- [X] **unseal-verify** -- vault.enc cannot be decrypted with any available unseal material
  - Hint: The unseal material has changed since this blob was written. 
    Restore the original passphrase, or run 'perplexity-user-mcp logout --purge' 
    and log in again.

Active profile: personal
Platform: win32 x64
Node.js: v22.21.1
package-version: perplexity-user-mcp 0.0.0

Relevant logs or errors

[vault] getSavedCookies failed for profile personal: Vault locked: no keychain, no env var, no TTY.
[vault] getSavedCookies failed for profile personal: Vault decrypt failed: wrong passphrase or corrupted ciphertext.
[perplexity-mcp] Not authenticated (anonymous mode).
[perplexity-mcp] No authenticated session (anonymous mode)

The doctor confirms unseal-path = env var (the PERPLEXITY_VAULT_PASSPHRASE system env var is detected), but vault.enc was encrypted by the VS Code Extension using VS Code SecretStorage — a different key that the stdio subprocess cannot access. Setting PERPLEXITY_VAULT_PASSPHRASE to the keytar value (perplexity-user-mcp/vault-master-key from Windows Credential Manager) does not match the vault, because the Extension uses a different internal key for encryption.

luvher avatar May 08 '26 13:05 luvher

Confirmed and fixed in PR #4 → ships in 0.8.41 once merged.

One technical correction to the original report: vault.enc is not encrypted by VS Code SecretStorage directly. SecretStorage stores a passphrase, which is then derived (via scrypt) into the AES-256-GCM key. On Windows with a working OS keychain the vault is normally encrypted with a 32-byte key from the OS Credential Vault, not from SecretStorage. The "wrong passphrase" you saw when setting PERPLEXITY_VAULT_PASSPHRASE to the keytar value is expected — that's the AES key already, not a passphrase to derive from.

Real bugs (both reproduced and fixed):

  1. Daemon spawn dropped the SecretStorage passphrase. When the extension prompted you for a passphrase (because keytar refused to load in your launcher's runtime), it was stored in SecretStorage and used by the login runner. But the long-running daemon — which actually answers perplexity_reason calls from Claude Code — was never given that passphrase. Fixed via a buildDaemonEnv provider injected into configureDaemonRuntime's spawn-env builder. The passphrase never enters the extension host's ambient process.env and never appears in any generated IDE config.

  2. stdio-daemon-proxy launcher silently fell back to in-process stdio. When daemon attach failed, the launcher would spawn a fresh in-process MCP server in your client's Node runtime, which then tried to read the vault directly with whatever env that runtime had. That's why your Pro features looked "anonymous" — the launcher had silently switched to a path that couldn't unlock the vault either. 0.8.41 changes the default to fail loudly with a structured stderr remediation: reload VS Code, switch to http-loopback, or opt into the advanced stdio-in-process path with an explicit setup-vault step.

Verified end-to-end on Windows 11 today (2026-05-10):

  • VS Code dashboard → keychain happy-path → daemon spawn telemetry [daemon] PERPLEXITY_VAULT_PASSPHRASE: unset; accountTier=Enterprise confirmed.
  • Windsurf running Claude Code (the exact failure class from this issue) → SecretStorage-passphrase fallback → daemon spawn telemetry [daemon] PERPLEXITY_VAULT_PASSPHRASE: set → perplexity_reason invoked from Claude Code returned a Pro-tier reasoning reply with 15 citations.
  • Both rows recorded in docs/smoke-tests.md § 0.8.41.

Followups deferred from this PR (won't reopen this issue for them):

  • Envelope v4 vault format (multi-source unseal envelopes for keychain-key rotation resilience). Phase 0 verification showed v4 isn't load-bearing for closing this issue. Tracked as a separate future hardening pass.
  • Per-IDE audit of HTTP loopback port-drift, including verifying Antigravity's httpBearerLoopback: false flag against actual smoke evidence — scheduled for 0.8.43.

For your specific install:

  1. Update to 0.8.41 once it's published (or grab the VSIX from the merged PR's artifacts).
  2. If you've previously run perplexity-user-mcp logout --purge --profile personal (per advice given in earlier triage), log in again from the VS Code dashboard. The daemon will receive your SecretStorage passphrase on next spawn, and Claude Code's stdio-daemon-proxy connection will route through it.
  3. If anything still doesn't work, attach a fresh Perplexity: Capture Diagnostics Bundle and reopen the issue — but the verification above strongly suggests it's resolved.

Issue will be closed after PR #4 merges. Thanks for the detailed report — the doctor output and the precise reproduction were exactly what made this fixable.

ARHAEEM avatar May 10 '26 18:05 ARHAEEM

Closed in 0.8.41 via merge of PR #4 (commit ce94c60). Smoke evidence: docs/smoke-tests.md § 0.8.41. If anything regresses for you on 0.8.41, please reopen with a fresh Perplexity: Capture Diagnostics Bundle.

ARHAEEM avatar May 10 '26 18:05 ARHAEEM