Skip to content

Commit 0b04e51

Browse files
cliffhallclaude
andcommitted
feat(servers): move oauthClientSecret and stdio env values to OS keychain (#1356)
mcp.json is designed to be tool-shareable (symlinked from Claude Desktop's config, pasted into bug reports, synced via dotfiles), so storing OAuth client secrets and stdio env values in plaintext there meant any of those flows could leak them. Lift both into the OS keychain via @napi-rs/keyring (active replacement for the archived keytar). The wire shape is unchanged: the GET /api/servers handler rehydrates from the keychain so browser code sees the same JSON; the on-disk file no longer contains the secret material. Includes an idempotent migration that lifts plaintext from older mcp.json files (or hand-edited ones) into the keychain on first read. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a9df501 commit 0b04e51

15 files changed

Lines changed: 1443 additions & 21 deletions

File tree

clients/web/package-lock.json

Lines changed: 235 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@mantine/notifications": "^8.3.17",
3232
"@modelcontextprotocol/ext-apps": "^1.7.1",
3333
"@modelcontextprotocol/sdk": "^1.29.0",
34+
"@napi-rs/keyring": "^1.3.0",
3435
"ajv": "^8.17.1",
3536
"atomically": "^2.1.1",
3637
"chokidar": "^4.0.3",

clients/web/server/vite-base-config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ export function getViteBaseConfig() {
3030
"chokidar",
3131
"cross-spawn",
3232
"which",
33+
// `@napi-rs/keyring` is loaded only inside
34+
// `core/auth/node/secret-store.ts` from the Hono `/api/servers`
35+
// handlers. It's a native-binding package (no browser code path) so
36+
// excluding it keeps Vite's dep scanner from chasing into the
37+
// platform-specific binaries during dev startup.
38+
"@napi-rs/keyring",
3339
],
3440
},
3541
};

0 commit comments

Comments
 (0)