Letting People Connect An MCP Server Before They Have An Account
Jake MarshIn this post
Last week I wrote about the 401 that makes Claude or ChatGPT open a sign-in window for a remote MCP server. This post is about what that window shows.
The usual answer is a login form and a plan picker before the Allow button. That’s a lot to ask of someone who pasted a URL into a chat a few seconds ago. So my servers show nothing. The server makes a guest account and the window closes. Setup and billing come later, through a link a tool hands out the first time the person asks for something that needs a plan.
CallForMe has worked this way since it launched. Taskhold and Runheed switched to it this month, though connections from ChatGPT to those two still go through sign-in until their ChatGPT app reviews are done.
The Authorize Endpoint Skips The Page#
The usual checks at /oauth/authorize (registered client, matching redirect_uri, PKCE) all still run. Then the server looks at the browser, and if there’s no account in it worth protecting, it issues the code and redirects straight back. CallForMe’s version, trimmed:
const sameBrowser = !sessionAccount && attr.vid ? emptyGuestForVid(attr.vid) : null;
const browserAccount = sessionAccount ?? sameBrowser;
if (!browserAccount || (canConnectSilently(browserAccount) && !connectedToOtherClient(browserAccount.id, c.client_id))) {
// Brand-new user, or an empty guest this same client already uses: no questions, no UI.
const acct = browserAccount ?? createGuest();
return redirectWith(redirectUri, { code: issueCode(c, acct.id, redirectUri, challenge), state });
}
// Anyone else gets a one-click consent page.
export function canConnectSilently(a: Account | null): boolean {
if (!a) return true;
return !!a.is_guest && (a.balance_cents ?? 0) <= 0 && !a.stripe_payment_method_id;
}Making The Guest#
A guest is an ordinary account row with is_guest set and a placeholder email like guest-<random>@guest.taskhold.invalid. The email column is unique and required, and .invalid is a reserved domain that can never receive mail. Every mail path refuses .invalid addresses.
The vid in the code above is a random id in an HttpOnly cookie that ties the browser to its guest. ChatGPT runs the authorize step twice within a few seconds. Without the cookie that would make two guests, and a payment could land on the one ChatGPT isn’t using. With it, the second run reuses the first guest if it has no plan and is under 7 days old.
Who Still Gets Asked#
Skipping the page is only safe when the account behind it has nothing to take. Client registration is open, so any app can register and send someone to the authorize URL. If a browser signed in to a funded account got a silent code, that app would leave with a token that spends the balance. So CallForMe only connects silently when there’s no account or an empty guest (no balance, no saved card). Everyone else gets a consent page that names the client and where the code goes, with a red warning when a client calls itself “ChatGPT” and redirects somewhere that isn’t ChatGPT.
A rogue client could also attach itself to the empty guest another agent is using and wait for money to land on it. So a guest is only reused silently by the client it was made for. A different client gets the consent page in CallForMe and a fresh guest in Taskhold.
Both cap new guests at 30 per IP per hour, and CallForMe also limits client registrations per IP.
The Setup Link Comes From A Tool#
Once the guest is connected, every tool that needs a plan answers with a setup link. In Taskhold the backend for a no-plan account is a proxy where every method throws the same marked error, and the tool layer turns it into an ordinary reply:
} catch (e) {
// An account with no plan yet: the message is for the person (the one-time setup link).
// Not a failure, so no "Error:" prefix and no isError.
if ((e as { setupRequired?: boolean })?.setupRequired) return text((e as Error).message);
return { content: [{ type: "text", text: `Error: ${(e as Error).message}` }], isError: true };
}An error invites the agent to retry or work around it, and I want it to stop and show the link. The text has a message for the person, to show as written, and instructions for the agent: opening the link is the person’s step, and it should keep the original request and finish it once setup is done. The link is /start/<token>, where the token is the account id, a 30-day expiry and an HMAC of both, so there’s no table to look up.
The text changes per client. Taskhold’s version for ChatGPT leaves out the price, since OpenAI’s app review doesn’t want prices in tool output; the price is on the setup page. ChatGPT also shows nothing until the assistant’s turn ends, so CallForMe tells it to post the link and stop, and tells other agents to post the link and then wait.
That waiting is CallForMe’s wait_for_setup tool. A call that needs credit comes back as needs_setup with a code like AB3D-K7QX, and the setup row holds the whole call request. wait_for_setup checks that row once a second for up to 50 seconds (ChatGPT cuts tools off at 60), and when the person pays, it places the call and returns its id, so nobody has to type “done”. If it times out, it says whether the person has opened the link yet, so the agent knows to show it again. Links expire after 24 hours, because paying approves that one call.
Turning A Guest Into An Account#
The rule both products share: never merge accounts based on an email someone typed. The email on a checkout form isn’t verified, and merging on it would let anyone who types your address attach their agent to your account.
If the person is signed in to an account they already have, the setup page offers to link this agent to it, as a POST that needs that session. Otherwise the payment lands on the guest. Taskhold then uses the checkout email as the account email if no other account has it. CallForMe emails a receipt with a sign-in link, good for 14 days, and only that click turns the guest into a verified account.
What a merge moves depends on what a guest can own. CallForMe guests can have calls and a balance, so one transaction moves calls, ledger rows, keys, OAuth tokens, sessions and setup links, then recomputes the balance from the ledger. Taskhold guests can’t hold tasks, so only keys and tokens move, and the agent’s next call works with no reconnecting.
What A Guest Can Do Before Paying#
Nothing that costs anything. Taskhold answers every task tool with the setup link, and only discovery stays open. A CallForMe guest can preview a call with plan_call and call a demo line, a fictional business that answers so people can hear how it works. Demo calls are short and capped per IP and per day.
The cost is a lot of empty guest rows from people and bots who connected and never came back. Taskhold and Runheed delete guests with no plan after 30 days without use. Logging each new guest with the client that made it also shows me which clients connect and then go quiet.