Skip to content

Local agents

A coding agent on your Mac, such as Pi, Claude Code or Codex, can use your Hotaru as a tool (SI-561): “What did my feeds say about PostgreSQL 19 this week?”, “Label the three newest Signal items”, “Weigh Gemini down”. hotaru mcp serves Hotaru’s tools over the Model Context Protocol. The agent starts it as a child process, and it talks to your server through the API with your token, like every other client (api.md).

Hotaru keeps running on the server: the agent only reads and asks for changes. Nothing runs on your Mac but the hotaru command.

Set it up

  1. The CLI with a server and a token: cli.md. hotaru status should show your account.

  2. The agent starts hotaru mcp:

    Terminal window
    pi mcp add hotaru -- hotaru mcp # Pi
    claude mcp add hotaru -- hotaru mcp # Claude Code
    codex mcp add hotaru -- hotaru mcp # Codex

    Or in an mcpServers file, such as Pi’s ~/.pi/agent/mcp.json:

    {
    "mcpServers": {
    "hotaru": {
    "command": "hotaru",
    "args": ["mcp", "--server", "vps"],
    "exposure": "direct",
    "description": "My news reader: search and read my feeds, label items, weigh keywords and sources"
    }
    }
    }

    Pi offers MCP tools through its codemode by default; "exposure": "direct" gives the model these few tools directly. pi mcp list checks the connection and lists the tools.

  3. Without the installed CLI, through npx: claude mcp add hotaru -- npx -y @kogakure/hotaru mcp, or "command": "npx", "args": ["-y", "@kogakure/hotaru", "mcp"] in an mcpServers file. From a clone of the repository: "command": "node", "args": ["/path/to/hotaru/apps/cli/src/main.ts", "mcp"].

--server NAME picks one of the CLI’s servers; without it the default one. HOTARU_URL and HOTARU_TOKEN in the entry’s env work without a config. The token stays in the CLI’s config (mode 0600) or the environment, never in the agent’s conversation.

The tools

Tool Kind What it does
get_stream looks A page of the stream: unread, starred, newest first or ranked (foryou, most Signal …), with the scores
search_items looks Full-text search, with dates, unread and starred (search.md)
get_item looks One item: link, scores, keywords, your labels and vote, summary, key points, other sources of its story. full_text adds the article
get_story looks Every source that reported the item’s story, oldest first (stories.md)
list_keywords looks Keywords with weights and item counts
list_sources looks Sources with ID, weight, pause, health and tags
label_item changes Sets your Signal, Facts and Hype labels (labels.md)
star_items changes Stars items, or takes the stars back
mark_read changes Marks items read or unread
vote_item changes More of this, less of this, or no vote (feedback.md)
update_keyword changes Sets a keyword’s weight or changes it by an amount; creates it when asked
update_source changes A source’s weight in the ranking, 0.1×–2×, found by ID or a unique part of its title or URL

Each tool tells the agent its kind with MCP’s hints (readOnlyHint, destructiveHint: false), so an agent that asks before changes, such as Pi with a permission extension, can tell them apart.

Which tools the agent gets depends on the token, as everywhere in the API (auth.md):

  • A read token (or cron, or “Read and follow feeds”) gets only the six that look.
  • A write token gets all twelve.
  • hotaru mcp --read-only offers only the six that look, whatever the token may do.

Not here at all: deleting anything, pausing a source, filters and mute words. In the web app’s agent these wait for your Confirm, and every change is logged for undo (agent-tools.md). Over MCP there is no Confirm button and the API keeps no such log, so they stay in the web app and the CLI. The changes that are here are small and easy to set back: a weight, a label, a star.

Feed text is data

Titles, summaries, snippets and article text are written by whoever publishes a feed, and a local agent can run commands on your Mac. So, as in the web agent:

  • The server’s instructions to the agent, and every result with feed text, say that it is data, never instructions.
  • get_item puts the feed’s text in a fenced block (<<< … >>>). Each piece is on one line, with the fence marks and control characters taken out, so it can’t close the block or start a line of its own.
  • Results stay under 16,000 characters, so an agent doesn’t cut them in the middle.

That lowers the risk; it doesn’t remove it. Keep the agent’s own permissions narrow, and use a read token or --read-only when it only needs to look.

Your server from your Mac

The agent reaches the server the way the CLI does, so anything that works for hotaru status works for agents:

  • Over HTTPS at the server’s public address (production: deployment.md). The token goes in the Authorization header, which TLS protects. A token is enough; nothing else needs opening.
  • Over Tailscale, for a server that isn’t public: when the app’s port is reachable in your tailnet (Tailscale on the host, and the container’s port published to it), use the host’s Tailscale name, such as http://<host>:3000. WireGuard encrypts the traffic, so plain http is fine inside the tailnet. The production setup is public over HTTPS and needs none of this.
  • Scoped tokens: make one token per machine or agent, with the smallest scope that works, and revoke it under Settings → API tokens when the machine goes.

Try it without costs: pnpm dev:faux

For working on Hotaru, or trying an agent against it, the whole app runs on your Mac with a fake model. No API key, no costs:

Terminal window
pnpm dev:faux # http://localhost:5173
pnpm dev:faux -- --port 5199 # another port

It starts the e2e tests’ fake OpenRouter (fake-openrouter.ts) and the dev server pointed at it (OPENROUTER_BASE_URL). Every AI stage gets well-formed made-up answers: “Summary of .” with two key points, the keyword “Night sky”, scores from words in the title, and a chat that echoes your message and calls a tool for “Increase the weight of …”. The database is its own, <code>apps/web/data/faux/hotaru.db</code>, so made-up summaries never mix with real ones. Feeds are fetched from the internet as usual. <code>FAKE_OPENROUTER_PORT</code> moves the fake from port 4197.</p> <p>A user and a token for it:</p> <div class="expressive-code"><figure class="frame is-terminal not-content"><figcaption class="header"><span class="title"></span><span class="sr-only">Terminal window</span></figcaption><pre data-language="sh"><code><div class="ec-line"><div class="code"><span style="--0:#919F9F;--1:#5F636F"># From the repository's root. Only for these two commands: pnpm dev:faux finds the database itself.</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">DATABASE_PATH</span><span style="--0:#C792EA;--1:#8844AE">=</span><span style="--0:#ECC48D;--1:#3B61B0">apps/web/data/faux/hotaru.db</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">pnpm</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">user</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">create</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--email</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">you@example.test</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--name</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">You</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">DATABASE_PATH</span><span style="--0:#C792EA;--1:#8844AE">=</span><span style="--0:#ECC48D;--1:#3B61B0">apps/web/data/faux/hotaru.db</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">pnpm</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">user</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">token</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--email</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">you@example.test</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--name</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">agent</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--scope</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">write</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">echo</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">hotaru_…</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#7FDBCA;--1:#096E72">|</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">hotaru</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">server</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">add</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">faux</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">http://localhost:5173</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--token-stdin</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="DATABASE_PATH=apps/web/data/faux/hotaru.db pnpm user create --email you@example.test --name YouDATABASE_PATH=apps/web/data/faux/hotaru.db pnpm user token --email you@example.test --name agent --scope writeecho hotaru_… | hotaru server add faux http://localhost:5173 --token-stdin"><div></div></button></div></figure></div> <p>Then point the agent at it: <code>pi mcp add hotaru-faux -- hotaru mcp --server faux</code>.</p> <h2 id="code">Code</h2> <p><a href="https://github.com/kogakure/hotaru/blob/master/apps/cli/src/mcp.ts"><code>apps/cli/src/mcp.ts</code></a> speaks the protocol: JSON-RPC 2.0 over stdin and stdout, one message per line, with <code>initialize</code>, <code>ping</code>, <code>tools/list</code> and <code>tools/call</code>. It’s written out rather than taken from the MCP SDK, which would bring an HTTP server framework along, so the CLI keeps having no dependencies. It accepts the protocol versions from 2024-11-05 to 2025-11-25. Logs never go to stdout.</p> <p><a href="https://github.com/kogakure/hotaru/blob/master/apps/cli/src/agent-tools.ts"><code>apps/cli/src/agent-tools.ts</code></a> holds the tools. A tool is a name, a description for the model, its arguments as a zod schema (sent as JSON Schema), the SDK methods it calls (<code>uses</code>, which decides which tokens get it), its hints and <code>run(client, args)</code>, which returns text for the model. Wrong arguments and the server’s refusals come back as tool errors the agent can read, with the server’s own message. <code>mcp.spec.ts</code> runs every tool against a fake server; Pi’s own client (<code>pi mcp list</code>) connected to it against <code>pnpm dev:faux</code>.</p> </div><footer class="sl-flex" data-astro-cid-n5bb73zb><div class="meta sl-flex" data-astro-cid-n5bb73zb></div><div class="pagination-links print:hidden" dir="ltr" data-astro-cid-jpihjwyt><a href="/docs/extension/" rel="prev" data-astro-cid-jpihjwyt><svg data-astro-cid-jpihjwyt="true" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;" data-astro-cid-i7xblkan><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span data-astro-cid-jpihjwyt>Previous<br data-astro-cid-jpihjwyt><span class="link-title" data-astro-cid-jpihjwyt>Browser extension</span></span></a><a href="/docs/api/" rel="next" data-astro-cid-jpihjwyt><svg data-astro-cid-jpihjwyt="true" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;" data-astro-cid-i7xblkan><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span data-astro-cid-jpihjwyt>Next<br data-astro-cid-jpihjwyt><span class="link-title" data-astro-cid-jpihjwyt>API and SDK</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>