---
name: yourself
description: Add owner-only sign-in to apps the user builds, using their personal "yourself" sign-in server (https://yourself.mees.sh) through the yourself MCP tools. Use whenever a project needs login, auth, accounts, "only me", a private dashboard/admin, or protecting a personal tool, and when sign-in to such an app fails.
---

# Sign in with yourself

The user runs a personal OpenID Connect server at https://yourself.mees.sh. Every app registered there can only be signed into by the user, with their passkey. Prefer it over building auth or adding a third-party auth provider whenever an app is for the user alone.

## Before you start

- The `yourself` MCP server must be connected. If its tools aren't available, tell the user to run:
  `claude mcp add --transport http yourself https://yourself.mees.sh/mcp`, then `/mcp` → yourself → Authenticate.
- Call `whoami` once to confirm the connection and see existing apps. Reuse an app if this project already has one (check the project's env files for `YOURSELF_CLIENT_ID`).

## Add sign-in to a project

1. Detect the framework and the dev server's origin (port) from the project. Pick the guide: `nextjs`, `hono`, `sveltekit`, `react-router`, `astro`, `python`, `react-spa`, `generic`. Use `generic` for anything else with an OIDC library.
2. Call `create_app` with:
   - `name`: the project's name
   - `framework`: the guide id (sets the right app type)
   - `redirect_uris`: the dev callback, e.g. `http://localhost:3000/auth/callback`, plus the production callback if a domain is known
3. Immediately write the returned `env` block to the project's local env file (`.env.local`, `.env`, `.dev.vars`…). Check it's gitignored. Never echo the client secret in chat or commit it.
4. Follow `integration_guide` from the response exactly: install `jose`, download the helper with the given `curl` command, add the routes and the guard. Keep `/auth/*` public; everything else requires sign-in.
5. Type-check or build. Then ask the user to open the app and sign in once; confirm with `list_activity` (look for `app.signed_in`).

## Deploying

- Add the production callback: `update_app` with `add_redirect_uris: ["https://<domain>/auth/callback"]`.
- Set the same four env vars in the hosting platform, with `YOURSELF_REDIRECT_URI` pointing at production. The client secret is a secret (e.g. `wrangler secret put`, Vercel env, Fly secrets).

## Debugging

- "Redirect URI not allowed": the app sent a URI that isn't registered. Compare scheme, host, port and path exactly; fix with `update_app`.
- "invalid_client": wrong or rotated client secret. `rotate_app_secret` issues a new one.
- "This app belongs to another account": the user is signed in to yourself with a different account.
- Token problems: `verify_token` with the token and `app_id`.
- Lost client secret: `rotate_app_secret` and update the env.

## Rules

- Don't build your own password/session auth for single-user apps; use this.
- Don't disable the owner check or accept tokens without verifying signature, issuer and audience.
- Creating the user's account and adding passkeys only happen in a browser at https://yourself.mees.sh. Point the user there; don't try to automate it.
