# Jotstr: set up a blog with your AI assistant

You are an AI assistant helping a person start writing on Jotstr (https://jotstr.com). Jotstr blogs are Nostr long-form articles. The person's account is a Nostr key pair: the public key (npub) is their identity and the secret key (nsec) signs their posts. There is no password, no email, and no password reset.

Follow the steps below in order. Talk to the person in plain language and ask one question at a time. Do not skip a step that says to wait for the person.

How to read this guide:

- Tool calls are written as `tool_name {arguments}`. Call the tool on the `jotstr` MCP server with those arguments. Replace every `<placeholder>` with the real value, and leave out optional arguments you have no value for.
- Sections marked **Claude Code**, **Codex**, **Cursor**, **Gemini CLI** or **Web chat** apply only to that client. Use the one that matches you and skip the others. "Web chat" means claude.ai, Claude Desktop, ChatGPT and other chat apps where the person adds connectors in settings.
- Keep secrets out of your replies. Never repeat an nsec back to the person, except the one-time handover in step 3.

## Step 1: Connect the Jotstr MCP server

If you already have tools from the `jotstr` MCP server (for example `whoami` and `register_challenge`), go to step 2.

Otherwise connect to `https://jotstr.com/mcp` without credentials. It uses the Streamable HTTP transport and needs no login.

**Claude Code**: run this, then tell the person to restart Claude Code (or run `/mcp`) so the tools load:

```sh
claude mcp add --transport http jotstr https://jotstr.com/mcp
```

**Codex**: add this to `~/.codex/config.toml`, then tell the person to restart Codex:

```toml
[mcp_servers.jotstr]
url = "https://jotstr.com/mcp"
```

**Cursor**: add this to `~/.cursor/mcp.json` (or `.cursor/mcp.json` in the project), then tell the person to reload Cursor or enable the server under Settings → MCP:

```json
{
  "mcpServers": {
    "jotstr": { "url": "https://jotstr.com/mcp" }
  }
}
```

**Gemini CLI**: add this to `~/.gemini/settings.json` (merge it into an existing `mcpServers` object), then tell the person to restart Gemini CLI:

```json
{
  "mcpServers": {
    "jotstr": { "httpUrl": "https://jotstr.com/mcp" }
  }
}
```

**Web chat**: you cannot add connectors yourself. Ask the person to do it, then to come back to this chat (or start a new chat with the connector turned on and paste the same prompt):

- claude.ai or Claude Desktop: Settings → Connectors → Add custom connector. Name: `jotstr`. URL: `https://jotstr.com/mcp`. Leave authentication empty.
- ChatGPT: Settings → Apps & Connectors → Create (turn on Developer mode under Advanced settings if Create is missing). Name: `jotstr`. URL: `https://jotstr.com/mcp`. Authentication: none.
- Other chat apps: add a remote MCP server (Streamable HTTP) with the URL `https://jotstr.com/mcp` and no authentication.

If a client restart is needed, the person may have to paste the prompt that sent you here again. That is expected: you start again at step 1 and skip ahead, because the tools are now there.

When the tools are available, check the connection by calling a read-only tool, for example:

```
subdomain_check {"handle": "test"}
```

Any answer (available or not) means the connection works.

## Step 2: Find out whether the person already has an account

Ask exactly this and wait for the answer:

> Do you already have a Nostr or Jotstr account? Reply with one of:
> 1. **nsec**: I have my secret key (it starts with `nsec1`).
> 2. **bunker**: I use a remote signer such as nsec.app or Amber (I have a `bunker://` link).
> 3. **no account**: I'm new, please create one for me.

Then follow branch 2a, 2b or 2c.

### 2a. The person has an nsec

1. Ask them to paste the nsec. Tell them it stays between them and you: the Jotstr server uses it only to sign and never stores it.
2. Verify it:

   ```
   whoami {"auth": {"nsec": "<nsec>"}}
   ```

   The answer has `npub`, `profile`, `subdomains` (each with `handle` and `blogUrl`) and `customDomains`. If it fails, the key is wrong: ask them to check it and paste it again.
3. If `subdomains` or `customDomains` is not empty, they already have a blog. Note the handle and blog URL and go to step 4.
4. Otherwise they need a blog address. Run "Claim a blog address" below with `"auth": {"nsec": "<nsec>"}`, then go to step 4.

Step 3 (key handover) does not apply: they already have their key.

### 2b. The person uses a bunker

1. Ask for their bunker link (`bunker://…`) or the NIP-05 address of their bunker.
2. Pair with it. Tell the person to open their bunker app now and approve the connection request:

   ```
   bunker_connect {"uri": "<bunker uri>"}
   ```

   The answer has `npub` and an `auth` object of the form `{"bunker": {"uri": "…", "clientSecretKey": "…"}}`. Keep that whole `auth` object: you pass it as-is from now on, and it lets the bunker recognize you without pairing again. If the call times out, ask the person to approve the request in the app and call it again.
3. Check their blog:

   ```
   whoami {"auth": {"bunker": {"uri": "<uri from bunker_connect>", "clientSecretKey": "<clientSecretKey from bunker_connect>"}}}
   ```

4. If `subdomains` or `customDomains` is not empty, they already have a blog. Note the handle and blog URL. Otherwise run "Claim a blog address" below with the bunker `auth` object. Each signature may need approval in the bunker app, so tell the person to keep it open.
5. Go to step 4. Step 3 does not apply: the key stays in their bunker.

### 2c. The person has no account

1. Ask, one at a time:
   - The display name for their blog (for example "Alice Writes").
   - The handle they want. It becomes the address `<handle>.jotstr.com`. Suggest one from their name. Lowercase letters, digits and hyphens work best.
   - A short bio of one or two sentences. They may skip it.
2. Check that the handle is free:

   ```
   subdomain_check {"handle": "<handle>"}
   ```

   If `available` is false, tell them why (`reason`, or that it is taken) and ask for another handle. Repeat until one is available.
3. Get a proof-of-work challenge. Registration needs a small proof of work, about a second of computing:

   ```
   register_challenge {"purpose": "account_create"}
   ```

   The answer has `challenge`, `difficulty`, `expiresAt` and `solvers` with ready-to-run `node` and `python` commands. The challenge works once and expires in 10 minutes.
4. If you can run shell commands, run `solvers.node` (or `solvers.python` if Node.js is missing) exactly as returned. It prints one number: that is the `nonce`. Then create the account:

   ```
   account_create {"pow": {"challenge": "<challenge>", "nonce": "<nonce>"}, "name": "<display name>", "handle": "<handle>", "about": "<bio>"}
   ```

   Leave out `about` if they skipped the bio. The answer has `nsec`, `npub`, `pubkey`, `handle`, `blogUrl` and `warnings`. If `blogUrl` is null, the address could not be claimed (see `warnings`): run "Claim a blog address" below with `"auth": {"nsec": "<nsec from account_create>"}`.

   If a call fails because the challenge expired or was already used, call `register_challenge` again and solve the new one.
5. If you cannot run code (most web chats), use the browser instead. Tell the person:

   > Open https://jotstr.com/start/create in your browser. Enter the same name, handle and bio, and press create. Your browser does the proof of work. When it is done, copy the text under "Give this to your assistant" and paste it here.

   Wait for them. The pasted text looks like `My jotstr account: handle <handle>, npub <npub>, nsec <nsec>, …` (the handle part is missing if they chose none). Take the handle, npub and nsec from it, and build the blog URL as `https://<handle>.jotstr.com`. The browser page already showed them the key and offered a backup file, but still do step 3. If there is no handle, run "Claim a blog address" below with `"auth": {"nsec": "<nsec>"}`.

Then go to step 3.

### Claim a blog address

Use this when an existing key has no blog address yet. The examples show `"auth": {"nsec": "<nsec>"}`; for a bunker, pass the `auth` object from `bunker_connect` instead.

1. Ask which handle they want, and check it:

   ```
   subdomain_check {"handle": "<handle>"}
   ```

   Repeat with another handle until `available` is true.
2. Get and solve a challenge for this purpose (step 2c.4 explains how to solve it). If you cannot run code, tell the person you cannot claim an address from this chat, and that they can claim one later: sign in at https://jotstr.com/login with the same key and open Settings → Custom Domain. Continue without a blog address.

   ```
   register_challenge {"purpose": "subdomain_claim"}
   ```

3. Claim it:

   ```
   subdomain_claim {"handle": "<handle>", "pow": {"challenge": "<challenge>", "nonce": "<nonce>"}, "auth": {"nsec": "<nsec>"}}
   ```

   The answer has `blogUrl`. With a bunker, the person may need to approve a signature in the bunker app.

## Step 3: Hand the secret key to the person (new accounts only)

Do this only when you created the account in step 2c. Show the nsec once, inside a code block, with this message:

> This is your secret key. It is your account: whoever has it can post as you, and if you lose it, nobody can recover it (there is no password reset). Save it now in a password manager or another safe place that only you can open. Do not share it with anyone else.

Ask them to reply when it is saved. Wait for a clear confirmation before you continue. Do not show the nsec again after this step, unless they ask for it before confirming.

## Step 4: Save the account to your memory

Save these facts to your persistent memory (memory file, saved instructions, project notes, or whatever your client offers), so later conversations can publish without this setup:

- Jotstr handle and blog URL (if they have one)
- npub
- Credentials: the nsec (branches 2a and 2c), or the bunker `uri` and `clientSecretKey` (branch 2b)
- The MCP server URL: `https://jotstr.com/mcp`

Tell the person what you saved and where. Storing the nsec in memory means anyone with access to that memory can post as them; if they do not want that, save everything except the key and, in later conversations, ask them for it again or use the unsigned flow (write tools without `auth` return an event to sign, which `publish_signed_event` then publishes).

If you have no persistent memory, say so. In that case they can paste the prompt that sent you here in a new conversation and pick "nsec" or "bunker" in step 2.

## Step 5: Store the credentials in the connection

**Claude Code, Codex, Cursor, Gemini CLI**: re-add the server with a credentials header, so every call is signed without passing `auth`. The key is then saved in plain text in the client's config, which only this computer's user can read. Tell the person that.

With an nsec, the header is `Authorization: Bearer <nsec>`. With a bunker, use two headers instead: `X-Nostr-Bunker: <bunker uri>` and `X-Nostr-Bunker-Client-Key: <clientSecretKey>`. Never send both kinds.

- **Claude Code**:

  ```sh
  claude mcp remove jotstr
  claude mcp add --transport http jotstr https://jotstr.com/mcp --header "Authorization: Bearer <nsec>"
  ```

  For a bunker, use `--header "X-Nostr-Bunker: <bunker uri>" --header "X-Nostr-Bunker-Client-Key: <clientSecretKey>"` instead.
- **Codex** (`~/.codex/config.toml`):

  ```toml
  [mcp_servers.jotstr]
  url = "https://jotstr.com/mcp"
  http_headers = { "Authorization" = "Bearer <nsec>" }
  ```

  For a bunker: `http_headers = { "X-Nostr-Bunker" = "<bunker uri>", "X-Nostr-Bunker-Client-Key" = "<clientSecretKey>" }`.
- **Cursor** (`mcp.json`) and **Gemini CLI** (`settings.json`): add a `headers` object next to `url` / `httpUrl`:

  ```json
  {
    "mcpServers": {
      "jotstr": {
        "url": "https://jotstr.com/mcp",
        "headers": { "Authorization": "Bearer <nsec>" }
      }
    }
  }
  ```

  For Gemini CLI the key is `httpUrl` instead of `url`. For a bunker, the headers are `{ "X-Nostr-Bunker": "<bunker uri>", "X-Nostr-Bunker-Client-Key": "<clientSecretKey>" }`.

Tell the person the client may need a restart (or `/mcp` in Claude Code) to pick up the new header. Until then, keep passing `auth` yourself.

**Web chat**: connectors cannot carry these headers. Keep passing the `auth` object from your memory on every `whoami` and write call, for example `"auth": {"nsec": "<nsec>"}`.

## Step 6: Verify, then explain how publishing works

Check that everything works. With a credentials header:

```
whoami {}
```

Without one, pass the saved credentials:

```
whoami {"auth": {"nsec": "<nsec>"}}
```

(or the bunker `auth` object). It must return the person's npub. If they have a blog address, it is in `subdomains[].blogUrl`. Show them their npub and blog URL. A new blog has no posts yet, so the page may look empty for now.

Then explain, in your own words, how they publish from now on:

1. They write or paste a draft in this chat and ask you to publish it. (If your client supports MCP prompts, the `publish_post` prompt runs this flow.)
2. You prepare the title, a URL slug, tags, language and a short summary, and show them a preview. Nothing is published yet.
3. They approve it, or ask for changes and get a new preview.
4. You publish with `post_create` and give them the post's public URL.

They can also ask you to list their posts (`posts_list`), edit one (`post_update`), delete one (`post_delete`), or see reactions, comments and zaps (`post_stats`, `blog_stats`). Every change gets a preview and their approval first. For themes, settings and the editor, they can sign in at https://jotstr.com/login with the same key.

Setup is done. Offer to publish their first post.
