Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7f4c586
mcp-apps-cli helper: opt-in sign-in for MCP servers behind OAuth
agentiknet Nov 27, 2026
bb64a3f
mcp-apps-cli: document the opt-in own sign-in
agentiknet Nov 27, 2026
3f5b011
mcp-apps-cli: Cargo.lock and third-party licenses for the new depende…
agentiknet Nov 27, 2026
32d2301
mcp-apps-cli helper: consent page in the browser, Keychain or passphr…
agentiknet Nov 27, 2026
0626658
mcp-apps-cli: document the consent page and the token stores (macOS)
agentiknet Nov 27, 2026
80f20b0
mcp-apps-cli: Cargo.lock and third-party licenses (aes-gcm, pbkdf2)
agentiknet Nov 27, 2026
19813b2
mcp-apps-cli helper: the consent page shows who the server says it is…
agentiknet Nov 27, 2026
d161527
mcp-apps-cli helper: the consent page's explanations sit behind a "?"…
agentiknet Nov 27, 2026
39a80ea
mcp-apps-cli helper: the consent page in everyday words
agentiknet Nov 27, 2026
a3c4808
mcp-apps-cli helper: changing the store setting leaves one login
agentiknet Nov 27, 2026
9ae8fbb
mcp-apps-cli helper: the terminal shows the page's summary
agentiknet Nov 27, 2026
93b73f9
mcp-apps-cli helper: a lock and a gear by the buttons
agentiknet Nov 27, 2026
f7bfb6a
mcp-apps-cli helper: a permission with no everyday wording is shown a…
agentiknet Nov 27, 2026
a826651
mcp-apps-cli helper: before consent, a server's metadata is fetched o…
agentiknet Dec 1, 2026
df04b5a
mcp-apps-cli helper: the passphrase stays out of the environment of w…
agentiknet Dec 1, 2026
a1dce5c
mcp-apps-cli helper: a Keychain that can't be read is said, and no pl…
agentiknet Dec 1, 2026
b7baf37
mcp-apps-cli helper: signout ends the grant, or leaves the login and …
agentiknet Dec 1, 2026
fd88e75
mcp-apps-cli: taking a server off "Own sign-in (OAuth)" reaches the h…
agentiknet Dec 1, 2026
1b8b705
mcp-apps-cli helper: the sign-in's local server takes only its own re…
agentiknet Dec 1, 2026
4ee043b
mcp-apps-cli helper: the consent page says the permissions are what t…
agentiknet Dec 1, 2026
e63ee67
mcp-apps-cli helper: the terminal test's runner stops a command that …
agentiknet Dec 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions polyfills/apps/claude-code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,95 @@ Or remove it with `claude plugin uninstall mcp-apps-cli@agent-polyfill`.
doesn't give plugins the UI metadata of a tool or of a resource. So the
helper opens its own connection to each server, from your MCP config, and
that connection can't sign in.
- **Own sign-in (opt-in, one server at a time, macOS only for now).** If you
need a server's apps before Claude Code shares its connection, the helper
can sign in to that server itself. It is off unless you list the server
under **Own sign-in (OAuth)** in `/config` and run
`mcp-apps-cli-helper signin <server>` once (the helper binary the plugin
carries, in its `helper/bin/<platform>/` folder, from a terminal in your
project's folder). Linux and Windows will follow if the idea is kept. Know
what that means before you do:
- **It is a separate grant, with its own life.** The server registers
`mcp-apps-cli` as a client of its own and asks for your consent again.
Signing out of the server in `/mcp` doesn't end it, and signing out here
doesn't touch Claude Code's.
- **The tokens are kept on your Mac, where you set once for every server.**
The macOS Keychain (the default), or a file encrypted with a passphrase (AES-256-GCM, key
from PBKDF2-HMAC-SHA256) under `~/.cache/mcp-apps-cli/oauth/`
(`MCP_APPS_CLI_OAUTH_DIR` puts it elsewhere). A plain file, not
encrypted, exists only as an explicit setting (`MCP_APPS_CLI_TOKEN_STORE=file`, or
`--token-store file`) for a machine with no Keychain. A token is sent
only to the address it was issued for, over `https` or to this machine
itself, and no redirect is followed.
- **Your organisation's controls for MCP sign-in don't see it.** With a
managed MCP policy, or an allow or deny list for MCP servers, the helper
uses no server at all, so this is off there too. The server's
administrators see a client named `mcp-apps-cli`.
- **To end it:** `mcp-apps-cli-helper signout <server>` asks the server to
revoke the tokens where it offers that, then deletes them. A helper that
is running reads the login for each request, so it stops with the
deletion, and can't write a refreshed token back after it. A login that
can't be read (an encrypted file without its passphrase), or that the
server didn't revoke, is left in place and said, so you can try again:
`--local` deletes it without asking the server. For a server that has left
your configuration, `signout <server> --url <address>` deletes the login
made for that address (nothing is sent). Signing in again revokes the
login it replaces. Removing the server from the setting stops the use of
its tokens at once.

`signin` prints one line ("Press Enter to review and approve in your
browser"), then serves a small consent page on a loopback address of its own
(a random port, a token against forged requests, closed after your answer
or after five minutes). The page shows who the server says it is, read from
what the server publishes without signing in (its name, icon, website,
description and permissions, from the MCP `serverInfo` and the OAuth
protected resource metadata, RFC 9728, with links to its policy and terms
when it gives them; what it does not publish is left out, and the icon is
downloaded by the helper, from the server's own address only, never loaded by the page). It shows what the server says it can allow,
in everyday words (with the server's own permission names in small print):
these are the permissions the server publishes, not a promise of what is
given, which the server's own page decides next and the page says so,
where the login is saved (a closed lock by the buttons for the
Keychain or a passphrase-locked file, an open amber one for a plain file; hover
for the words), and a gear that opens the details (where the login is kept and
how to change it, that it is separate from Claude Code's own login, how to
disconnect, the server's links). The buttons say what happens
("Continue to <server>", "Cancel"); Accept goes on to the server's own sign-in in the same tab, Refuse
keeps nothing. Without a
browser, `--no-browser` shows the same in the terminal (the summary with a lock line, in
colours where the terminal takes them and none when `NO_COLOR` is set, then
`Continue to <server> [y/N/?]`: no by default, `?` shows the details; without
a terminal it refuses). To skip the question and the
page, pass `--yes`, or set `MCP_APPS_CLI_SIGNIN_YES=1` in your environment
to skip them every time (a terminal can't read `/config`); only do that for
servers you have already decided to sign in to. Where logins are
kept is one setting for every server: `MCP_APPS_CLI_TOKEN_STORE`
(`keychain`, the default, `encrypted` or `file`), or `--token-store` for one
run. The page only says what is set. There is no silent fall back: if the Keychain isn't
available (or can't be read later, in a session), the helper says so and what
to use instead, and never picks a plain file, or an older login in another
store, for you.

With `encrypted`, `signin` needs the passphrase too (the page can't take
one): set `MCP_APPS_CLI_PASSPHRASE`. A file encrypted with a passphrase can't
be opened by a session's helper unless it has the passphrase: set it in the
environment you start Claude Code from (the helper can't ask). The helper
takes it out of its own environment as it starts, so the processes it starts
(stdio MCP servers, Chrome) aren't handed it, and keeps it in memory while it
runs. Everything else started from that same environment, Claude Code's own
MCP servers included, can still read it there: the passphrase protects the
file at rest, not from those programs, and the Keychain is the stronger
choice. A passphrase needs at least 8 characters, wherever it comes from. The Keychain
needs nothing. It works with a server of MCP 2026-07-28 and with one of the
2025 revisions, only for `streamable-http` servers (not the older `sse`
ones), only servers that register clients themselves (dynamic client
registration), and not a server whose config already sets an
`Authorization` header (`signin` refuses those before it asks or sends
anything). The helper still uses a server only while Claude
Code itself is connected to it in the session, and never reads Claude
Code's stored credentials. Claude Code's sign-in is the recommended way;
[host change 1](../../../docs/host-changes.md) would make this unnecessary,
and the option will be removed when it lands.
- **A view gets Claude's tool result as the model reads it.** That is all
Claude Code gives plugins: a result with `structuredContent` comes as one
text block of that object's JSON, and the server's own `content` and the
Expand Down
56 changes: 56 additions & 0 deletions polyfills/apps/claude-code/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,62 @@ server's headers never reach another host that way.
The plugin never reads Claude Code's stored credentials (the keychain, OAuth
tokens). It reads the same MCP configuration files Claude Code reads.

Off by default, per server (the **Own sign-in (OAuth)** setting), and only on
macOS for now, the person can have the helper sign in to a server itself
(`signin <server>`): authorization code with PKCE, to a loopback address of the
helper's own, for a server it may already use and only over `https` or to the
person's own machine. It is a separate grant, which Claude Code's `/mcp` and an
organisation's MCP sign-in settings don't see. Before anything is kept, the
person answers a consent page the helper serves on a loopback address of its
own (a random port, a token against forged requests, a check of the `Host` and
`Origin` headers, closed after the answer or after five minutes), or, with
`--no-browser`, the same summary and a `y/N/?` question in the terminal (and
no browser is opened for the server's page either: its address is printed).
That loopback server reads small requests only (a declared length over 64 KB
ends the request), and takes the return from the server's sign-in page only
with the `state` this sign-in sent: any other request is refused and changes
nothing, and the tab is told it worked only after the code was exchanged and
the tokens kept. `signin` refuses, before it asks or sends anything, a server
its connection would not use the sign-in for (not streamable HTTP, an
`Authorization` header of the person's own, a plain `http` address elsewhere).
What the server publishes about itself is fetched, before consent, from its
own origin only (the authorization server's metadata alone may be elsewhere:
`https`, public addresses only), following no redirect. The tokens, and the client
the server registered, are kept where the person set (one global setting, `MCP_APPS_CLI_TOKEN_STORE`): the macOS Keychain
(called directly through Security.framework; the default), or a file encrypted
with a passphrase (AES-256-GCM, key from PBKDF2-HMAC-SHA256 with 600,000
rounds, a fresh salt and nonce for each write) in a folder only they can open
(`~/.cache/mcp-apps-cli/oauth/`). A plain file, not encrypted, is an explicit
option only (`--token-store file`), where the file's mode is what protects it,
as for the view stores. One entry for each server and address, so a token is
sent only to the address it was issued for. There is no silent fall back from
one store to another. A session's helper opens an encrypted file with the
passphrase in `MCP_APPS_CLI_PASSPHRASE`: it takes the variable out of its own
environment as it starts, before it starts anything else, so no process it
starts (a stdio MCP server, Chrome, the person's browser) is handed it, and
keeps it in memory for as long as it runs (a refreshed token is written
again). Any other program started from the environment the person set it in,
Claude Code's own MCP servers included, can read it there and so open the
file: the encrypted file protects the tokens at rest, and is not the
Keychain's equal. A
connection that carries a token follows no redirect, and says once a session,
in the debug log, that it is using its own sign-in. `signout <server>` asks the
server to revoke the tokens where it offers that (RFC 7009) and deletes them.
A running helper reads the kept login for each request and holds no copy of
it, so it stops with the deletion; a refresh and `signout` hold the same lock
on a file beside the logins, so a token being refreshed is never written back
after it, and two sessions never spend the same rotating refresh token. A
login that can't be read, or that the server didn't revoke, is left in place
(`--local` deletes it without asking the server; `--url <address>` reaches the
login of a server that has left the configuration, sending nothing). A new
sign-in revokes the login it replaces.
Taking the server off the setting stops the use of its tokens at once: the mod
sends the list with every request to the helper, whichever it is for, and the
helper closes the signed-in connection (one still being made included) and
forgets what the server listed over it before doing anything else. These are the
helper's own tokens, issued to it by the server: Claude Code's are still never
read.

## What an app may do, and when you're asked

Each view runs in a sandboxed iframe in a dedicated headless Chrome, under the
Expand Down
Loading