@naulon/wayfarer-mcp 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,10 +26,17 @@ spend) — but mock settlement is not a mock catalog: `discover` / `research` /
26
26
  `verify` need a real place to look, so with nothing configured they refuse
27
27
  (they never fabricate sources). To actually find and read something, pick one:
28
28
 
29
- - **Turnkey (hosted):** point a client at the hosted endpoint with an agent
30
- token — real corpus, no local wallet. See [Hosted endpoint](#hosted-endpoint-no-local-wallet).
31
- - **Bring your own publisher:** set `RSS_URL`, `PUBLISHER_URL`, or `CATALOG_URL`
32
- to a site's feed/catalog, plus `TOLLGATE_URL` to pay. See [Configuration](#configuration).
29
+ - **Buy from the fleet (hosted):** point a client at the hosted endpoint with an
30
+ agent token and use `naulon_ask` — it buys across the whole naulon fleet
31
+ directory, real corpus, no local wallet. See [Hosted endpoint](#hosted-endpoint-no-local-wallet).
32
+ - **Single publisher (stdio):** set `RSS_URL`, `PUBLISHER_URL`, or `CATALOG_URL`
33
+ to that site's feed/catalog, plus `TOLLGATE_URL` to pay. A lone `TOLLGATE_URL`
34
+ pins **every** payment to one gate — that's single-publisher by design.
35
+ - **Fleet / many publishers (stdio):** to buy across more than one publisher
36
+ locally, set `WAYFARER_ALLOW_DOMAINS` to the publisher hosts you trust (and
37
+ point discovery at a fleet directory via `CATALOG_URL`) instead of pinning a
38
+ single `TOLLGATE_URL` — each discovered publisher is then paid at its own gate,
39
+ bounded by the allowlist. See [Configuration](#configuration).
33
40
  - **Full loop offline:** run the repo's `make demo` (or `make dev`) to drive the
34
41
  whole discover → toll → pay → settle loop against a local stub publisher.
35
42
 
@@ -132,10 +139,10 @@ command: npx args: ["-y", "@naulon/wayfarer-mcp"]
132
139
 
133
140
  ## Hosted endpoint (no local wallet)
134
141
 
135
- naulon-cloud exposes the same brain over **Streamable HTTP** at `/_naulon/mcp`,
136
- authenticated with an agent token — tolls are signed by naulon's custody-free
137
- session key, so **no private key ever touches your machine**. This endpoint also
138
- adds the cloud-only `naulon_ask` tool + its `ask` prompt.
142
+ The hosted naulon service exposes the same brain over **Streamable HTTP** at
143
+ `/_naulon/mcp`, authenticated with an agent token — tolls are signed by naulon's
144
+ custody-free session key, so **no private key ever touches your machine**. This
145
+ endpoint also adds the hosted-only `naulon_ask` tool + its `ask` prompt.
139
146
 
140
147
  Clients that support remote/HTTP MCP with headers:
141
148
 
@@ -175,7 +182,7 @@ Env read by the stdio server (all optional — omit for the offline mock):
175
182
  | `BUYER_PRIVATE_KEY` | The wallet the toll is paid from. BYO-key path; a hosted deploy signs through a cloud signer instead. |
176
183
  | `TOLLGATE_URL` | The gate every payment resolves against. Payments only ever flow here — a prompt-injected model cannot redirect them. |
177
184
  | `WAYFARER_BUDGET_USDC` | The session spend ceiling. The model can never raise it. |
178
- | `WAYFARER_ALLOW_DOMAINS` / `WAYFARER_DENY_DOMAINS` | Publisher allow/deny lists for `naulon_research`. |
185
+ | `WAYFARER_ALLOW_DOMAINS` / `WAYFARER_DENY_DOMAINS` | Publisher allow/deny lists applied to **every paid tool** (`naulon_quote`, `naulon_pay_and_read`, `naulon_research`) — not just research. A stated `ALLOW_DOMAINS` *replaces* the single-gate identity pin, so one server can buy across many publishers. Blank/malformed reads as **unset** (no restriction); comma-separated hosts to allow. (Internally, a defined-but-empty allowlist denies all — a blank env var can only ever read as unset, never empty.) |
179
186
  | `WAYFARER_PER_DOMAIN_CAP` | Max paid reads per publisher per session. |
180
187
  | `WAYFARER_KILL_SWITCH` | Hard stop — refuse all spend. |
181
188
 
package/dist/server.d.ts CHANGED
@@ -103,6 +103,17 @@ export interface BuildServerOptions {
103
103
  railSigners?: RailSigners;
104
104
  /** This session's spend ceiling in USDC (else `WAYFARER_BUDGET_USDC`). */
105
105
  budgetUsdc?: number;
106
+ /**
107
+ * Spend ALREADY made by this caller before this server instance was built — the
108
+ * running total `spentSessionUsdc`/`remainingUsdc` start from (else 0). The stdio
109
+ * funnel leaves it unset (one process = one lifetime, the closure is the whole truth).
110
+ * The cloud host injects the caller's durable spend-in-window so the counter is
111
+ * MONOTONIC across reconnects: an MCP session that the edge idle-closed and the client
112
+ * silently re-`initialize`d no longer resets the budget to zero (the reset that let a
113
+ * per-call ceiling look like a session cap while the running total quietly restarted).
114
+ * Server-config, never a tool arg — the model cannot lower its own prior spend.
115
+ */
116
+ initialSpentUsdc?: number;
106
117
  /** This session's decision policy (else the env-derived policy over DEFAULT_POLICY). */
107
118
  policy?: DecisionPolicy;
108
119
  /**
@@ -147,6 +158,30 @@ export interface BuildServerOptions {
147
158
  * the hosted path the cloud injects its portal wallet URL; the stdio funnel leaves it at the
148
159
  * `/buyer/wallet` default. Server-config, never a tool arg. */
149
160
  buyerWalletUrl?: string;
161
+ /**
162
+ * WP-3a — when set (non-empty), this mount's 4 config-dependent tools (naulon_discover,
163
+ * naulon_quote, naulon_pay_and_read, naulon_research) are inert BY DESIGN: each short-circuits
164
+ * BEFORE touching discover()/gateBase()/any tollgate, returning a CONTROLLED refusal (never a
165
+ * throw, never a fabricated success) whose message is this string verbatim. This is how the
166
+ * hosted fleet endpoint (WP-3c sets this only on its ask-only mount) stays HONEST about
167
+ * naulon_ask being the sole fleet-buy path there, instead of surfacing a raw config error for
168
+ * tools that were never meant to run on that mount. `naulon_status` and `naulon_ask` are never
169
+ * steered — only these 4. Absent/empty (every stdio/self-host caller, unchanged): a no-op.
170
+ */
171
+ hostedInertSteer?: string;
172
+ /**
173
+ * Per-payment payee authorization for the spend tools (`naulon_pay_and_read`, `naulon_research`).
174
+ * Given the fetched `url` and the 402's advertised `payTo`, return false to REFUSE the pay before
175
+ * any leg is signed (the buyer resolves `payee_refused`, nothing moves). The cloud host binds this to
176
+ * "is this an owner-authorized payee for this origin?" — resolving the tenant from the url and the
177
+ * owner-declared payee set from its own resolver — so a compromised/buggy gate cannot redirect a toll
178
+ * to a wallet no owner declared. Endpoint identity (host==gate) is a separate concern (`authorizeOrigin`);
179
+ * this owns payee identity. Absent (every stdio/self-host caller) ⇒ no payee check, unchanged.
180
+ */
181
+ authorizePayee?: (input: {
182
+ url: string;
183
+ payTo: string;
184
+ }) => boolean | Promise<boolean>;
150
185
  }
151
186
  /**
152
187
  * Build a fresh, unconnected MCP server with the tool surface registered. The
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2BpE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAgB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIrI,eAAO,MAAM,WAAW,wBAAwB,CAAC;AACjD;iDACiD;AACjD,eAAO,MAAM,cAAc,UAAU,CAAC;AAgGtC;;;;;;;;GAQG;AACH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,gIAAgI;IAChI,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAC7C,oGAAoG;IACpG,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,MA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