# io.github.lonniev/excalibur-mcp

> FastMCP server for posting formatted content to X (Twitter) — Tollbooth-monetized, DPYC-native

- name: io.github.lonniev/excalibur-mcp
- version: 0.40.2
- connection class: R2 (oauth_consent_once)
- trust: 91/100
- quality: 66/100 (needs work)
- owner: not claimed
- descriptor: https://api.protogrid.dev/v1/servers/io.github.lonniev%2Fexcalibur-mcp
- tools: https://api.protogrid.dev/v1/servers/io.github.lonniev%2Fexcalibur-mcp/tools

**An agent can connect after a one-time OAuth consent by a human.** Remote endpoint behind OAuth 2. Tokens stay with the agent; the registry only exposes the authorization metadata.

## Connection (mcpServers)

```json
{
  "mcpServers": {
    "excalibur-mcp": {
      "type": "http",
      "url": "https://excalibur-mcp.fastmcp.app/mcp"
    }
  }
}
```


## Trust

- hygiene: 100
- liveness: 100
- freshness: 85
- provenance: 80
- drivers: +repository +namespace-matches-repo +reachable +uptime-100% ~updated-52d-ago
- Derived from observable signals (official registry feed and our own credential-free probes); no code audit performed.

## Quality 66/100 (needs work)

### protocol: n/a (weight 25)

- n/a `protocol.modern`, `protocol.stateless`, `protocol.transport`, `protocol.list_ttl`: no remote answered a protocol handshake (not probed yet, unreachable, or local-only)

### authorization: 83 (weight 15)

- pass `auth.prm`: Protected Resource Metadata (RFC 9728) published
- pass `auth.as_metadata`: authorization server metadata reachable
- warn `auth.cimd`: only Dynamic Client Registration, deprecated in 2026-07-28 in favour of CIMD
- n/a `auth.secret_in_url`: no templated URL

### tool hygiene: 79 (weight 30)

- pass `tools.descriptions`: every tool has a description
- warn `tools.description_length`: 6 tools have descriptions over 1,024 characters, which crowds the context
- pass `tools.schemas`: every tool has an object input schema
- pass `tools.annotations`: 87 of 87 tools declare readOnlyHint or destructiveHint
- pass `tools.directory_hints`: every tool declares readOnlyHint, destructiveHint, idempotentHint and openWorldHint
- fail `tools.token_cost`: about 25,535 tokens to load every tool, a large share of an agent's context
- pass `tools.api_dump`: tools are not a one-to-one API dump

### stability: 25 (weight 15)

- warn `stability.changes`: 102 tool changes in 30 days
- fail `stability.rug_pull`: 2 tools kept their name but changed most of their description in 30 days; review before trusting them

### dependencies: n/a (weight 15)

- n/a `deps.known_vulns`, `deps.mcp_sdk_version`, `deps.resolvable`: no npm or PyPI package

- tools: 87, about 25,535 tokens to load them all
- tool set hash: 5c983037b66f0204945bb7a46d5cfb7d
- tools last changed: 2026-10-14T22:52:13.968Z
- badge: [![protogrid quality](https://protogrid.dev/badge/io.github.lonniev/excalibur-mcp.svg)](https://protogrid.dev/servers/io.github.lonniev/excalibur-mcp)
- Checks run on what our credential-free, read-only probes observe; tools are never called and no code audit is performed.

### Tool changes

- 2026-10-14 `excalibur_scheduler_reissue` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_scheduler_check_now` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_scheduler_status` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_scheduler_pending` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_get_scheduler_log` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_process_scheduled_posts` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_post_performance_infographic` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_post_performance` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_get_post_metrics` changed (title, inputSchema, annotations)
- 2026-10-14 `excalibur_harvest_metrics` changed (title, inputSchema, annotations)

Full history: https://api.protogrid.dev/v1/servers/io.github.lonniev%2Fexcalibur-mcp/changes

## Remotes

- https://excalibur-mcp.fastmcp.app/mcp (streamable-http, auth oauth2, reachable true, uptime30d 1)

## Packages

_none_

## Tools (87)

- `excalibur_account_statement`: Generate a patron's account statement at this operator.

Returns the patron's purchase history, active credit tranches,
per-tool usage breakdown, and recent daily usage logs. This is
the patron's spending account — not the operator's Authority
tax balance.

Free — no credits consumed. Proof of npub ownership is required
to prevent statement-scraping of arbitrary patrons.
- `excalibur_account_statement_infographic`: Generate a visual SVG infographic of your account statement.

Returns the same data as account_statement, rendered as a dark-themed
SVG graphic with balance hero, metrics cards, health gauge, tranche
table, and tool usage breakdown. Costs 1 api_sat per call. Proof is
verified by ``debit_or_deny`` before any cost is incurred.
- `excalibur_adoption_status`: Check this operator's adoption-request status at a chosen Authority.

Free. Polls the Authority MCP-to-MCP for the status of this operator's
request (pending / approved / rejected / provisioned).
- `excalibur_begin_oauth`: Start the OAuth2 authorization flow.

Returns an authorization URL. Open it in a browser to log in
and authorize. Then call ``check_oauth_status`` with the
same npub to complete. Free. Proof of npub ownership is
required so an observer cannot DOS your account by
initiating OAuth flows in your name.

Do NOT call this pre-emptively. If a session may still be valid,
attempt the live tool call first and only begin OAuth when it
fails with ``upstream_auth_refresh_needed``. A 'pending'
``check_oauth_status`` is not evidence that an existing session
has lapsed.
- `excalibur_check_authority_balance`: Check this operator's tax balance at the Authority.

Returns the sats available for certifying patron credit purchases.
When this balance reaches zero, patron top-ups cannot be certified
and the operator must call purchase_credits on the Authority.

This is the operator's own funding — not a patron balance. Free.
- `excalibur_check_balance`: Check a patron's credit balance at this operator.

This is the patron's spending balance — credits purchased via
Lightning for tool calls at this operator. For the operator's
own balance at the Authority (needed to certify patron purchases),
use authority_check_balance instead.

Free — no credits required. Proof of npub ownership is required
to prevent anyone-with-the-registry from enumerating balances.
- `excalibur_check_oauth_status`: Check whether the OAuth2 authorization flow has completed.

Call after opening the authorization URL from ``begin_oauth``
and completing the login in your browser. Free. Proof of npub
ownership is required: OAuth status exposes which upstream
services a patron has connected.

A 'pending' result here does NOT prove an existing session has
lapsed — it only reports this authorization attempt. To find out
whether a session still works, attempt the live call; fall back
to ``begin_oauth`` only on an explicit
``upstream_auth_refresh_needed`` error.
- `excalibur_check_payment`: Check the payment status of a Lightning invoice.

Call after paying the invoice from purchase_credits.
Free — no credits required. Proof of npub ownership is required
to prevent credit-grant front-running by an observer of the
invoice ID.
- `excalibur_check_price`: Preview the effective cost of a tool call.

Shows the base cost and any constraint effects (discounts, free
trials, surge pricing). Free — no credits required.
- `excalibur_check_proof_status`: Check whether a proof grant is still valid.

Mirrors ``check_oauth_status`` for the npub-proof flow: a calling
agent can ask "will my next paid call accept this dpop_token?"
before burning credits on a guaranteed failure. Expiry is read from
the grant itself; the only store consulted is the patron's
revocation watermark.

Free, no side effects — touches no relay.
- `excalibur_create_post`: Store a new post (draft or scheduled). Returns its ``post_id``.
- `excalibur_delete_conversation_query`: Delete one of your saved conversation queries. The leads it found are
kept (they become ad-hoc leads). Free and owner-scoped.
- `excalibur_delete_coupon`: Delete a coupon.  Cascades to all patron redemptions.

Any chain step referencing the deleted coupon_id becomes a
no-op (the constraint returns neutral on unknown ids) — the
Studio surfaces orphan references as warnings.

RESTRICTED to operator — requires proof.
- `excalibur_delete_operator_credential`: Remove a single operator secret field.

Deletes one key from the operator's encrypted credential blob without
touching the others — the field-level counterpart to
``forget_credentials``, which wipes the whole row. Use it to retire a
leftover after an SDK cutover (a Prefect key after Modal, or a stored
but untemplated orphan like ``anthropic_api_key``) without taking the
operator down for a full re-delivery.

Stored-but-untemplated fields are first-class: the delete is keyed on
what is vaulted, not on what the current template declares. Idempotent
— already-absent fields report ``removed: false`` without rewriting
the vault. RESTRICTED to the operator — requires the operator's proof
(a kind-27235 event or a proof grant); patron proofs are rejected.
A deletion is as destructive as a write.
- `excalibur_delete_patron_credential`: Remove a single patron credential field.

Deletes one field from stored credentials without affecting
other fields. Free. Proof of npub ownership is required —
this is a write to the patron's sensitive credential vault.
- `excalibur_delete_post`: Delete a stored post. Default is a soft delete (``status='archived'``);
pass ``hard=True`` to remove the row permanently. The tweet on X, if any,
stays where it is.
- `excalibur_delete_snippet`: Delete one of your saved snippets by id. Free and owner-scoped.
- `excalibur_fetch_dynamic_block`: Redeem a ``resolve_dynamic_block`` claim check (free, proof-gated).

Poll this with the ``claim_check`` from ``resolve_dynamic_block`` until
``status == "done"`` (the resolved fragment is ``result.text``). While the
job runs it returns ``{"status": "running", "poll_after_seconds": N}``; on
failure ``{"status": "error", ...}`` (the start fare is refunded); an unknown
or aged-out claim returns ``{"status": "expired", ...}``. Owner-scoped — only
the npub that started the job can redeem it. Also acts as the watchdog: a
stalled job is re-kicked when polled.
- `excalibur_find_conversations`: Search X's last 7 days for people asking something you could answer,
score each thread 0..100, and store the result under your npub for
``list_conversations`` to page through.

Pass exactly one of ``query_id`` (a saved query from
``save_conversation_query``) or ``query`` (an ad-hoc X search clause — your
domain nouns are the selector; X has no ``?`` operator). ``safe_defaults``
appends ``-is:retweet -has:links -has:cashtags lang:en`` (a photo is not a
link); your own posts are always excluded. ``max_posts`` caps the read
(10..300) — every post X returns is billed to the operator, which is what
this tool's fare covers. A saved query re-run reads only posts newer than
its last run. ``weights`` overrides the scoring for this call (keys:
need, replies, band, spam, reply, replies_min, followers_min,
followers_max, decay_hours).

Returns ``{posts_read, pages, new, refreshed, skipped_own, skipped_dupe,
truncated_reason, top:[…]}``. Nothing is posted, liked or replied to —
the reply is yours to write and send by hand.
- `excalibur_forget_coupon`: Remove a coupon from this patron's redemption list.

Cosmetic only — the coupon itself still exists at the operator,
and the patron can re-redeem the same code later while the
window allows.  Free — requires proof of ``npub``.
- `excalibur_forget_credentials`: Delete vaulted credentials for a specific service and npub.

For operator credentials, pass the operator's own npub. For patron
credentials, pass the patron's npub. Always requires proof of
npub ownership — a deletion is as destructive as a write.
- `excalibur_get_nostr_profile`: Read an npub's public Nostr profile (NIP-01 kind-0 metadata).

Free, no proof — the data is already public on relays. Returns the
latest metadata fields (name, display_name, about, picture, banner,
nip05, website, lud16) or an empty profile if none is published.
- `excalibur_get_notarization_proof`: Generate a Merkle inclusion proof that a patron's balance was
included in a Bitcoin-notarized snapshot.
- `excalibur_get_operator_onboarding_status`: Report this operator's configuration readiness.

Shows which operator settings are configured, which are missing,
and how to deliver each missing value. For patron-level credential
status, use get_patron_onboarding_status instead. Free.
- `excalibur_get_patron_credential_fields`: List stored patron credential field names (not values).

Returns the names of fields stored for a patron, plus each
field's ``delivered_at`` ISO-8601 timestamp when known (null
for secrets vaulted before timestamps were recorded). Values
are never exposed — use this to verify which fields are
configured and how old each one is. Free. Proof of npub
ownership is required: the list of configured fields is itself
sensitive (reveals which integrations a patron has set up).
- `excalibur_get_patron_onboarding_status`: Report a patron's credential readiness for this operator.

For set-once services (eXcalibur, TheBrain), shows which patron
secrets are configured and which are missing. For dynamic/OAuth2
services (Schwab), reports that no patron credentials are needed.
Free. Proof of npub ownership is required because credential
presence is sensitive information about the patron's setup.
- `excalibur_get_post`: Read one stored post by id (owner-scoped).
- `excalibur_get_post_metrics`: Patron: raw metrics snapshot series for one owned post.

Returns the append-only ``post_metrics_snapshot`` rows (impressions, likes,
clicks, cadence_key, t_offset, link_placement, snippet_ids) ordered by
capture time. Empty when the post has not been harvested yet.
- `excalibur_get_pricing_model`: Get the active pricing model for this operator. Free.

If no model exists, self-initializes a scaffold with all
registered tools at 0 sats.  No economic data from code.
- `excalibur_get_scheduler_log`: Read recent scheduler-tick outcomes.

Each ``process_scheduled_posts`` run — fired by the Cloudflare cron Worker or
a manual trigger — records its summary. This surfaces them so the FE debug
log can show what the Worker is doing: the per-tick heartbeat (proof it ran)
and per-post outcomes (posted / skip+error reasons like
``insufficient_balance`` or ``oauth_token_expired``).

Owner-scoped: the operator sees every tick in full; any other proven patron
sees the global heartbeat (``processed`` count + ``run_at``) plus only the
per-post entries for THEIR OWN posts. Free; npub proof required. Returns
``{runs:[{run_at, summary}], scope}``.
- `excalibur_get_snippet`: Read one of your saved snippets by id (full row incl. ``doc`` block
document). Free and owner-scoped. Returns ``{"success": true, "snippet": …}``
or ``snippet_not_found``.
- `excalibur_get_voice`: Read your saved writing Voice — a profile blurb plus a list of "banned
construction" chips (``{text, on}``) the editor passes to
``refine_post_region``. Owner-scoped; priced by the operator's pricing model
(use ``check_price``). When you have not saved a Voice yet this returns an
empty one (``{"voice": {"profile": "", "bans": []}}``) so the editor can seed
its own defaults, not an error.
- `excalibur_get_x_profile`: Fetch the connected X account's handle and name for this patron (free).

Uses the patron's vaulted X OAuth token to call X's ``/users/me``. Returns
``{connected: true, username, name, profile_image_url}`` when connected, or
the OAuth situation (``connected`` absent) when X isn't linked yet. Used to
show the real @handle on the editor's tweet-card preview.
- `excalibur_harvest_metrics`: Operator-only: one cadence-aware metrics harvest sweep.

Drains due ``metrics_harvest_job`` rows (t+15m … t+28d), fetches X
``non_public_metrics`` / ``organic_metrics`` under each patron's OAuth
context, and appends ``post_metrics_snapshot`` rows. A missed cadence is
permanent data loss — failed jobs retry up to 5 attempts then land in the
dead-letter queue; pass ``requeue_dead_id`` to retry one. Also runs as
phase 3 of every ``process_scheduled_posts`` tick.
- `excalibur_list_canonical_identities`: Return canonical (tool_id, mcp_name, …) for every tool the wheel exposes.

The authoritative source for any client (Studio, agents, FE)
that needs to know how this MCP identifies its tools.
Reconcile uses this output to UUID-join against the stored
pricing model — no name-based UUID derivation, no guessing.

Includes both ToolIdentity-seeded tools and any UUID recorded by
``@paid_tool`` that is missing from the registry. The latter appear
with ``registered: false`` (and in the top-level ``unregistered``
array) so Reconcile can flag deploy drift instead of silently
reporting clean when a live tool was never seeded (#174).

If the operator renames a function or rebrands a slug, the
mcp_name in this output changes but tool_id stays. That's the
whole point of the canonical-UUID design.

Also diffs the live FastMCP wire surface against the registry.
Tools exposed on the wire but absent from the registry appear in
``unregistered`` so Reconcile can flag deploy drift instead of
silently under-reporting (issue #175).

Free, no side effects.
- `excalibur_list_constraint_types`: List all available constraint types and their parameter schemas.

Returns the type, category, description, and parameter specs for
every constraint that can be used in a pricing pipeline.
Free — no credits required.
- `excalibur_list_conversation_queries`: List your saved conversation queries with their last-run watermarks.
Free and owner-scoped. Returns ``{queries:[…]}``.
- `excalibur_list_conversations`: Page through your stored conversation leads, server-side sorted and
filtered. ``query_id`` narrows to one saved query (``"adhoc"`` for leads from
ad-hoc searches); ``status`` is a comma list of ``new|seen|engaged|dismissed``;
``min_score`` is 0..100. ``sort_col`` is one of
``score|found|seen|posted|replies|followers``; ``sort_dir`` is ``asc|desc``.
``search`` is a case-insensitive regex over the post text or author handle.
``date_from``/``date_to`` bound ``date_field`` (``found|posted``). ``page``
is 0-indexed; ``page_size`` is 1..100. Free, owner-scoped. Each row carries
``url`` — the thread on X — so you can open it without calling X yourself.
Returns ``{conversations:[…], total, page, page_size}``.
- `excalibur_list_coupons`: List every coupon this operator has minted (newest first).

Each row carries the current ``times_redeemed`` counter — the
Studio renders a progress bar from this against ``total_uses``.
RESTRICTED to operator — requires proof.
- `excalibur_list_my_coupons`: List the coupons this patron has redeemed on this operator.

Returns both active and exhausted redemptions with a per-row
``status`` (``active`` / ``window_closed`` / ``patron_limit`` /
``total_limit``).  Free — requires proof of ``npub``.
- `excalibur_list_notarizations`: List recent Bitcoin notarization records.
- `excalibur_list_posts`: List your stored posts, server-side sorted, filtered, and offset-paginated.

Optional ``status`` filter — a single status or a comma-separated set
(e.g. ``draft,scheduled``), matched as set membership. ``sort_col`` is one of
``created|updated|status|scheduled`` (default ``created``); ``sort_dir`` is
``asc|desc``. ``search`` is a case-insensitive regular expression matched
against the post text. ``date_from``/``date_to`` accept bare ``YYYY-MM-DD``
(UTC-calendar day, end-inclusive) or an ISO instant (patron-local midnight from
the FE — exclusive upper bound when instant). Bound the ``date_field`` column,
one of ``created|updated|scheduled|sent``
(default ``created``). ``template_id`` filters to the sent occurrences a recurring
template fired. ``sent_hour`` (0–23) with ``time_zone`` (IANA) keeps only posts
whose ``last_sent_at`` local wall hour in that zone matches — used by the
Performance time-of-day chart deep-link. ``page`` is 0-indexed; ``page_size``
is 1..100. Each row carries ``is_recurring``, ``has_dynamic``, and
``template_id`` (set on sent occurrences).
Returns ``{posts:[…], total, page, page_size}`` reflecting the filtered set.
- `excalibur_list_snippets`: List your saved post snippets, server-side sorted, filtered, and
offset-paginated. ``sort_col`` is one of ``favorite|created|updated|name``
(default ``favorite``); ``sort_dir`` is ``asc|desc``. ``search`` is a
case-insensitive regular expression matched against the snippet name or body.
``date_from``/``date_to`` accept bare ``YYYY-MM-DD`` (UTC-calendar day,
end-inclusive) or an ISO instant (patron-local midnight from the FE). Bound
the ``date_field`` column, one of ``created|updated`` (default ``created``).
``page`` is 0-indexed; ``page_size`` is 1..200. Free, owner-scoped. Returns
``{snippets:[…], total, page, page_size}`` reflecting the filtered set.
- `excalibur_mint_coupon`: Create a new operator-owned discount coupon.

The coupon owns its binding: ``tool_ids`` names the tools it
discounts, and re-pricing a tool never touches it. A coupon bound
to no tool discounts nothing, however many patrons redeem it.
- `excalibur_notarize_ledger`: Build a Merkle tree of all patron balances and submit the root
to Bitcoin via OpenTimestamps.

Operator-only background task. Bitcoin confirmation takes 1-6 hours.
Free — no credits required.
- `excalibur_oracle_about`: Describe the DPYC ecosystem via the Oracle. Free.
- `excalibur_oracle_get_tax_rate`: Get the current DPYC certification tax rate. Free.
- `excalibur_oracle_how_to_join`: Get DPYC onboarding instructions from the Oracle. Free.
- `excalibur_oracle_lookup_member`: Look up a DPYC community member by npub. Free.
- `excalibur_oracle_network_advisory`: Get active network advisories from the Oracle. Free.
- `excalibur_post_nostr_message`: Publish a public Nostr note (kind 1) authored by your proven npub.

eXcalibur cannot sign a note *as* you — a Nostr event must be signed by the
key it claims to come from, and eXcalibur never holds your nsec. So for this
one note it mints a fresh, ephemeral "scribe" keypair, signs with it, and
``p``-tags YOUR npub as the author. The p-tag renders the note as a real
mention and places it in your own Nostr mentions, so you can see — and
disown — anything published in your name.

The author is always your **proven** npub from this session (the same npub
you pass for billing); it is never a free-form argument, so no caller can
scribe as anyone else.

The note publishes to the DPYC relay set. The call **succeeds if at least
one** relay accepts it; the response lists every relay's accept/reject and
the accepted/attempted counts so you can see the note's real reach — a
one-relay publish never reads as a clean broadcast.
- `excalibur_post_performance`: Patron: derived reach scores across your harvested post corpus.

Computes escape velocity (t+15m vs rolling median), breakout ratio
(final reach ÷ rolling-median final reach; suppressed below 5 posts),
link-placement cohort medians, and snippet/voice attribution from the
durable snapshot store — signals that come from owning the curve, not
proxying a single X endpoint.
- `excalibur_post_performance_infographic`: Patron: SVG infographic of post performance (gold-steel theme).

Mirrors ``account_statement_infographic`` — a dark-themed SVG of corpus
size, median t+15m impressions, top posts, and link-placement cohorts.
- `excalibur_post_tweet`: Post a text tweet with markdown formatting converted to Unicode rich text.

Accepts standard markdown inline formatting and converts it to Unicode
Mathematical Alphanumeric Symbols that render as styled text on X:

    **bold**          -> bold
    *italic*          -> italic
    ***bold italic*** -> bold italic
    `monospace`       -> monospace
- `excalibur_post_tweet_image`: Post a tweet with a hero banner image to X/Twitter.

Provide either an image_url (fetched and attached) or banner_svg
(rendered to PNG and attached). Text supports the same markdown
formatting as post_tweet.
- `excalibur_process_scheduled_posts`: Launch a publisher for every due post (operator-only).

Selects ``scheduled`` posts whose ``publish_at`` has arrived, claims each
atomically, and starts one background publisher per post. It does NOT
publish: composing content, billing the owner, posting to X and recording the
outcome all belong to the publisher, which runs on the async job queue and so
may take the minutes a dynamic block needs. This call returns as soon as the
work is dispatched — expect it to be fast even when the publishing itself is
slow, and read per-post outcomes from ``get_scheduler_log`` or the post rows.

Requires the operator's npub proof; the trigger itself is free. Returns
``{kind: "tick", processed, launched, contended}``.
- `excalibur_publish_nostr_profile`: Publish a CLIENT-SIGNED kind-0 profile to relays for an npub.

The wheel never holds a patron nsec. The frontend signs the kind-0
metadata event with the patron's session key or a NIP-07 extension and
passes the signed event (JSON) here; the wheel verifies the signature
matches the npub, then relays it to public relays. The signature is the
authorization — no proof token, no key custody. Free.
- `excalibur_purchase_credits`: Buy credits via Bitcoin Lightning.

Creates a Lightning invoice. Pay it with any Lightning wallet,
then call check_payment to confirm. Proof of npub ownership is
required so credits land in the correct ledger.

Free — no credits required to call.
- `excalibur_receive_credentials`: Pick up credentials from the Secure Courier.

Completes the CREDENTIAL-DELIVERY flow (the ownership-proof
counterpart is ``receive_npub_proof``).

**Call this only after the user confirms they have replied.**
Deterministic, one-shot retrieval: name the response you want with
``(sender_npub, service, dpop_token)`` and the tool drains ONLY the
rendezvous relay that channel was pinned to. Every popped DM with the
wrong session phrase is deleted and its sender is NACK'd; the first DM
with the matching phrase is accepted (ACK'd) and the scan stops. If
none match, the queue is drained and a ``courier_not_found`` result is
returned. Do NOT poll, loop, or retry.

If a credential_card (ncred1...) is provided, it is redeemed directly
without any relay access (dpop_token not required for that path). On
success, the payment processor client is reinitialized from the new
credentials — no server restart needed.
- `excalibur_receive_npub_proof`: Receive npub ownership confirmation from a patron.

Completes the npub-OWNERSHIP-PROOF flow (the credential-delivery
counterpart is ``receive_credentials``).

**Call this only after the user confirms they have replied.**
Deterministic, one-shot retrieval: name the response with
``(patron_npub, dpop_token)`` — the ``dpop_token`` being the value
returned by ``request_npub_proof``. The tool drains ONLY the pinned
rendezvous relay that challenge was published on, stopping at the DM
whose phrase matches. Mismatched DMs are deleted and NACK'd (without
revealing the expected phrase). If called before the user replies,
their message will never be found. Do NOT poll, loop, or retry.

The signed DM itself proves npub ownership (the patron's nsec
signed it). On success, returns a new ``dpop_token``: an
Operator-signed **proof grant envelope** ``{"grant": …, "nonce": …}``
bound to the patron, this challenge, and the duration the patron
named. The calling application MUST remember that whole string and
pass it as ``dpop_token`` on every subsequent paid tool call. The
grant is self-verifying; nothing about it is stored here. Free.
- `excalibur_redeem_coupon`: Claim a coupon by its name (the code the operator shared).

Looks up the operator's coupon by ``code``, validates the window
and total cap, and records a per-patron redemption row.
Subsequent paid tool calls on this MCP auto-apply the discount
until ``uses_per_patron`` is exhausted.

Free — no credits required.  Requires proof of ``npub``.
Idempotent: redeeming the same code twice returns the existing
redemption.
- `excalibur_refine_post_region`: Refine a flagged region of a post with an LLM — server-side.

The operator's LLM key stays in the vault and never leaves the
server. Send the flagged ``region``, the surrounding ``full_text``, an
optional ``instruction`` (what to change), and the editor's ``voice``
profile + ``bans`` (JSON array or comma list of banned constructions).
Returns ``{"success": true, "suggestions": [...3 strings...]}``.

Paid: the AI cost is metered as a tollbooth fare. The fare is refunded if
no LLM key is configured or the upstream call returns nothing.
- `excalibur_reply_to_conversation`: Post your reply into one of your leads' threads on X (``conversation_id``
is the row id from ``list_conversations``). ``text`` is up to 280 characters;
markdown inline formatting is converted the same way ``post_tweet`` does it.
Posted with your own X token as a reply to the lead's post; on X's
confirmation the lead is marked ``engaged`` and remembers the reply. A
refused post changes nothing and refunds the fare. Returns
``{reply:{tweet_id,url}, conversation}``.
- `excalibur_report_issue`: File a field report about this service as a GitHub issue on the operator's repo.

Found a tool's metadata or response wrong or confusing? Report it where the tool
lives. The **author of record is your npub** — no npub / no proof, no issue — and it
is stamped into the issue so the report is attributed to you, not the operator. Costs
a small fee (a free write to an issue tracker would be abused). The report is PUBLIC
and goes to the maintainers' normal triage; nothing is verified here.

Returns the filed issue's repo, number, and url. If this operator has not enabled
field reports, returns an "issue reporting not configured" situation and you are not
charged.
- `excalibur_request_adoption`: Ask a chosen Authority to adopt this operator (deferred courtship).

RESTRICTED to the operator — requires proof the caller controls this
operator's npub. Resolves the Authority's MCP endpoint from the
community registry, mints an inline ownership proof with this
operator's nsec, and delivers the request MCP-to-MCP. The Authority
records it as pending; its owner approves on their own time. Poll
``adoption_status`` for progress; the operator flips to ``ready``
once the Authority provisions it.
- `excalibur_request_credential_channel`: Open a Secure Courier channel for credential delivery.

This is the CREDENTIAL-DELIVERY flow — use it to hand over a service
secret (API keys, tokens). To merely prove you control an npub (the
usual answer to a ``proof_required`` error), use ``request_npub_proof``
instead. Note: dynamic/OAuth2 services (e.g. Schwab) need NO couriered
secret — check ``service_status`` first.

Sends a welcome DM with a credential template. The recipient
must read the DM in their Nostr client, fill in the fields,
and reply manually. **This is a human-in-the-loop flow.**

After calling this tool, STOP and tell the user what to do.
Wait for the user to confirm they have replied before calling
``receive_credentials``. Do NOT poll or retry — each
``receive_credentials`` call destructively drains the relay
mailbox.
- `excalibur_request_echo`: Echo what the client sent with this request. Free.

Reports the URL path and query, the headers, the cookies and the MCP
request ``_meta``. Values are SHA-256 fingerprints, so nothing a client
sends is repeated back; equal fingerprints mean equal values. Call it
from two conversations and compare: a value that stays the same within
one and changes between them identifies the conversation.
- `excalibur_request_npub_proof`: Request npub ownership proof from a patron via Nostr DM.

This is the npub-OWNERSHIP-PROOF flow — use it when a call returns
``proof_required``. It proves the caller controls an npub; it does
NOT deliver any service secret. To hand an operator its API keys or
OAuth secrets, use ``request_credential_channel`` instead.

Sends a challenge DM that the patron must sign and reply to
using their Nostr client. **This is a human-in-the-loop flow.**

After calling this tool, STOP and tell the user to check their
Nostr client and reply to the challenge. Wait for the user to
confirm they have replied before calling ``receive_npub_proof``.
Do NOT poll or retry — each ``receive_npub_proof`` call
destructively drains the relay mailbox.

**Returns** a ``dpop_token`` — the one-time challenge nonce shown in
the DM. Pass it to ``receive_npub_proof`` to collect the reply. It
is a matching token, not a credential: on its own it authorizes
nothing.

**Lifecycle:** ``receive_npub_proof`` returns the proof grant, which
expires after the duration the patron named in their reply. When it
expires, call ``request_npub_proof`` again for a fresh challenge,
then wait for the user, then call ``receive_npub_proof``.

Free.
- `excalibur_reset_pricing_model`: Erase all pricing models and restore a viable default.

Deletes every stored model, then self-initializes a fresh one
from the tool registry — all tools at 0 sats with proper UUIDs.
Returns the new model.

RESTRICTED to operator — requires proof (nsec-signed).
- `excalibur_resolve_dynamic_block`: Start resolving a dynamic post block with an LLM — returns a CLAIM CHECK.

A dynamic block's ``prompt`` is run by the model (with web search + web fetch for
live data) and woven into the surrounding post ``context`` in the author's
``voice``. The author's instruction governs length — there is no character cap
(X supports long-form posts). The operator's LLM key stays in the vault
and never leaves the server.

Because that work (paginated fetches + generation) can outlast a client
timeout, this returns immediately with a **claim check** instead of the text:
``{"success": true, "claim_check": "...", "status": "pending",
"poll_after_seconds": N}``. Redeem it with the free companion
``fetch_dynamic_block(claim_check)`` until ``status == "done"`` (then read
``result.text``). (The scheduler resolves blocks directly server-side at fire
time and does not use this tool.)

Paid: the AI cost is metered as a tollbooth fare on THIS start call, refunded
if no LLM key is configured or the job ultimately fails.
- `excalibur_restore_credits`: Credit a patron's ledger from a BTCPay-settled invoice.

**RESTRICTED to the operator** — the operator owns the books and is
the only party who can issue a manual credit grant. Patrons who
believe they paid but never got credits must escalate to the
operator's support, who then invokes this tool on their behalf.

Use cases: cold-start vault races during check_payment, ncred
delivery hiccups, patrons closing Top-Off sheets before settle,
any infrastructure incident that left an invoice settled at BTCPay
but uncredited on the operator's ledger.

Idempotent — if the invoice is already credited (in the patron's
``credited_invoices``), returns success with credits_granted=0.
- `excalibur_restore_neon_schema`: Prepare this operator's database schema again, ignoring the breadcrumb.

Diagnostic / recovery tool for when Neon keeps answering 4xx and the
operator suspects a table or grant is missing. Every statement is
idempotent, so a clean re-run is harmless; the breadcrumb is rewritten
at the end. Returns one step per concern, with Neon's own error text
inline for any that failed.

RESTRICTED to operator — requires proof (nsec-signed).
- `excalibur_save_conversation_query`: Save a named X search clause to run with ``find_conversations``. Omit
``query_id`` to create; pass it to update in place — only the fields you pass
change, and a changed ``query`` resets the last-run watermark. ``weights``
holds only the scoring values you override. At most 50 saved queries per
npub; names are unique per npub. Free and owner-scoped. Returns
``{"success": true, "query": …}``.
- `excalibur_save_snippet`: Save a reusable post snippet (opening/footer/CTA). Omit ``snippet_id`` to
create a new one; pass it to update an existing snippet in place (name/text/
favorite/doc). On update only the fields you pass change — omit ``favorite``
(leave it null) to keep it as-is, so a doc-only patch (e.g. toggling a snippet
dynamic) doesn't reset it. ``doc`` is the same block/flag document a post
carries, so the editor is identical for both. Free and owner-scoped. Returns
``{"success": true, "snippet": …}``.
- `excalibur_save_voice`: Save your writing Voice (replaces the previous one — it is a per-npub
singleton). ``profile`` is free text. ``bans`` is a list of ``{text, on}``
objects: ``text`` is the construction to avoid, ``on`` whether it is an active
constraint. Blank/duplicate entries are dropped server-side. Owner-scoped;
priced by the operator's pricing model (use ``check_price``). Returns
``{"success": true, "voice": {...}}``.
- `excalibur_scheduler_check_now`: Ask the scheduler to run one tick now (free; any proven patron).

Pokes the Worker's ``/tick`` — the same work the ~30-minute cron does: it
claims a pending proof reply (completing the operator's authorization) and
fires any due posts. Use it right after the operator approves in Studio so
nobody waits for the next tick.

Deliberately NOT operator-only. Approving is the operator's act; noticing
that they approved is anyone's, and a patron watching a parked scheduler is
often the one who notices first. The poke carries no authority — it cannot
approve anything, only ask the Worker to look. The challenge phrase stays
operator-gated (``scheduler_pending``).

The Worker runs the tick in the background and returns immediately; re-read
``scheduler_status`` a few seconds later to see the phase flip. Returns
``{started: true}`` or ``{started: false}`` if the Worker couldn't be
reached.
- `excalibur_scheduler_pending`: What is the scheduled-post cron Worker waiting on? (operator-only).

When the Worker's authorization lapses it DMs the operator a challenge
phrase and parks. This returns that pending phrase so the operator can match
it against the DM before approving in Studio — the Device-Grant second
surface for a headless actor. The phrase lives only in the Worker's KV (an
impostor can't inject it); we read it AS the operator (a kind-27235 signed
with the operator key), so the human never signs anything in the browser.

``restricted``: gated to the operator npub, free. Never returns the active
session token. Returns ``{phase, code, reason, requestedAt}`` — ``phase`` is
``pending`` / ``active`` / ``idle``, or ``unavailable`` if the Worker can't
be reached.
- `excalibur_scheduler_reissue`: Send the scheduler's proof request again, now (operator-only).

For a pending request that is not going to complete — the reply went to an
older DM, or ``scheduler_pending`` shows a last check that says the request
was replaced or expired. The Worker drops it and DMs a fresh one straight
away instead of waiting out its hour. Approve the NEWEST DM in Studio, then
``scheduler_check_now``.

Signed as the operator with a sentinel ``u``-tag the Worker checks
literally, like ``scheduler_pending``, so the browser signs nothing. An
already-authorized scheduler is left alone. ``restricted``: gated to the
operator npub, free. Returns ``{success, phase, requestedAt, message}``.
- `excalibur_scheduler_status`: The scheduler's configuration and current status (free; any proven patron).

Relays the cron Worker's public ``/status`` — cadence, version, renewal
window, and current authorization phase (``pending`` / ``active`` / ``idle``,
no challenge phrase) — and adds the operator npub it acts for. No secrets:
the pending phrase (operator-only) is ``scheduler_pending``; the per-tick
traffic log is ``get_scheduler_log``. Returns the merged config, or
``{worker: "unavailable"}`` merged in if the Worker can't be reached.
- `excalibur_service_status`: Check the health and configuration of this service. Free.
- `excalibur_session_status`: Check operator readiness. Returns the operator lifecycle
state and clear guidance on what to do next. Free.

Lifecycle states:
- ready: Vault AND pricing model verified on this call. Proceed with
  tool calls — this is the answer the moment the vault is up.
- warming_up: Persistence could not be reached on this call (a
  transient failure, seen, not assumed). Retry; the next call
  completes the bootstrap. Never reported on a clock.
- misconfigured: Persistence rejected a query with a permanent SQL
  error (permission denied, missing relation). Paid tools will fail
  until the operator repairs the database — retrying does not help.
- quota_exceeded: The persistence provider (Neon) answered HTTP 402 —
  the operator's database has exhausted its compute/storage quota, so
  the books are locked for billing. Paid tools fail; retrying does NOT
  help. The operator's Authority must restore capacity (upgrade the
  plan or wait for the quota reset). Free tools remain available.
- not_registered: Operator has no Authority relationship yet. Call register_operator first.
- no_identity: Operator nsec is not configured. Deployment issue.
- `excalibur_set_conversation_status`: Mark one of your leads ``new|seen|engaged|dismissed`` by its row id (the
``id`` from ``list_conversations``, not X's conversation id). A re-run of
the search never changes a status you set. Free and owner-scoped.
- `excalibur_set_pricing_model`: Set the active pricing model. RESTRICTED to operator.

Requires a valid proof (Schnorr-signed kind-27235 event)
proving the caller holds the operator's nsec.
- `excalibur_update_coupon`: Patch a coupon's editable fields.

Pass only the fields you want to change.  To set a cap to
unlimited (NULL in the schema), pass ``clear_uses_per_patron=true``
or ``clear_total_uses=true``.  Renaming the code is allowed —
existing patron redemption rows survive (they key on coupon id).
``tool_ids`` replaces the coupon's binding — tool ids or MCP tool
names, ``["*"]`` for every paid tool, ``[]`` to unbind it.

RESTRICTED to operator — requires proof.
- `excalibur_update_operator_credential`: Add or update a single operator secret field.

Merges into the operator's stored credentials without touching the
others — the field-level counterpart to re-delivering the whole
bundle over Secure Courier. Use it to rotate one secret (a reissued
``btcpay_api_key``, say) without restating the six you did not
change, where any field omitted from a courier reply is destroyed.

The value is never echoed back. RESTRICTED to the operator —
requires the operator's proof (a kind-27235 event or a proof grant);
patron proofs are rejected.
- `excalibur_update_patron_credential`: Add or update a single patron credential field.

Merges into existing stored credentials without affecting
other fields. Useful for setting an account identifier
after OAuth, changing a default brain, etc. Free. Proof of
npub ownership is required — this is a write to the patron's
sensitive credential vault.
- `excalibur_update_post`: Patch a stored post. ``patch`` may set ``doc, publish_at, recurrence,
cease_at, status`` (omit a field to leave it unchanged). ``text_cache`` is
written when supplied (alongside a doc change). ``client_req_id`` dedupes
debounced autosave retries — a repeat is a no-op with no second charge.
