diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 02a4940..59112a0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -6,7 +6,7 @@ body: - type: markdown attributes: value: | - Thanks for reporting a Toolgate issue. For security-sensitive billing or payment verification problems, email talha.korkmazeth@gmail.com instead of filing a public issue. + Thanks for reporting a Tollgate issue. For security-sensitive billing or payment verification problems, email hello@niceberglabs.com instead of filing a public issue. - type: input id: version attributes: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 2c9e914..3e10950 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: true contact_links: - name: Security report - url: mailto:talha.korkmazeth@gmail.com + url: mailto:hello@niceberglabs.com about: Please report billing, payment verification, duplicate-charge, or auth vulnerabilities privately. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe42739..0a83677 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -Thanks for helping improve Toolgate. This project is in developer preview, so small, +Thanks for helping improve Tollgate. This project is in developer preview, so small, well-scoped changes are easiest to review. ## Local setup diff --git a/LICENSE b/LICENSE index dbbe5d3..b8194fa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Toolgate +Copyright (c) 2025 Tollgate Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/PHASE3_INTEGRATION_NOTES.md b/PHASE3_INTEGRATION_NOTES.md index e47641d..ca96688 100644 --- a/PHASE3_INTEGRATION_NOTES.md +++ b/PHASE3_INTEGRATION_NOTES.md @@ -17,7 +17,7 @@ Phase 3 is focused on rail validation plus realistic MCP tool integration. ## Idempotency Key Source - All three examples derive the key from `requestId` -- MCP adapter passes `idempotencyKey` through to ToolGate so duplicate MCP calls replay the original result instead of re-charging +- MCP adapter passes `idempotencyKey` through to TollGate so duplicate MCP calls replay the original result instead of re-charging - Example format: `::` ## Fallback Implementation @@ -41,7 +41,7 @@ Phase 3 is focused on rail validation plus realistic MCP tool integration. ## Rail Assumptions That Broke - MPP proof verification cannot be modeled as a boolean-only check; the execution path needs the verified amount in context -- Verifying a rail payment before ToolGate sees idempotency can create a double-credit leak on duplicate calls +- Verifying a rail payment before TollGate sees idempotency can create a double-credit leak on duplicate calls - Rail-backed failures are not the same as prepaid refunds; provisional credits must be reversed on failed or fallback results - x402 cannot assume a default facilitator URL - x402 verification and settlement are separate states; successful execution does not imply settlement certainty diff --git a/README.md b/README.md index 9dc9eeb..6f7aa52 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Toolgate +# Tollgate -Toolgate is an open-source runtime for reliable paid or quota-limited MCP/tool calls. +Tollgate is an open-source runtime for reliable paid or quota-limited MCP/tool calls. It handles fallback, idempotent retries, metering, recovery, and execution traces so tool calls do not break or double-charge on edge cases. @@ -28,10 +28,10 @@ x402, MPP, wallets, webhooks, hosted APIs, or environment variables. ## Minimal usage ```ts -import { ToolGate, InMemoryLedger, usd } from "@tkorkmaz/toolgate"; +import { TollGate, InMemoryLedger, usd } from "@niceberglabs/tollgate"; const ledger = new InMemoryLedger(); -const gate = new ToolGate({ publisherKey: "tg_local_demo", ledger }); +const gate = new TollGate({ publisherKey: "tg_local_demo", ledger }); const search = gate.paidTool({ name: "premium_search", @@ -64,9 +64,9 @@ await search({ query: "vector dbs", requestId: "r2" }, "caller-1"); ## MCP usage ```ts -import { ToolGate, createMcpAdapter, usd } from "@tkorkmaz/toolgate"; +import { TollGate, createMcpAdapter, usd } from "@niceberglabs/tollgate"; -const gate = new ToolGate({ publisherKey: "tg_local_demo" }); +const gate = new TollGate({ publisherKey: "tg_local_demo" }); const mcp = createMcpAdapter(gate, { getCallerId: (_args, extra) => extra?.sessionId ?? "demo-user", }); diff --git a/SECURITY.md b/SECURITY.md index 03fb4f9..ae35c0f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,6 +1,6 @@ # Security Policy -Toolgate handles paid or quota-limited tool-call flows, so security issues can affect billing, +Tollgate handles paid or quota-limited tool-call flows, so security issues can affect billing, trace integrity, and payment recovery behavior. ## Supported versions @@ -14,7 +14,7 @@ trace integrity, and payment recovery behavior. Please do not open a public issue for suspected vulnerabilities. -Email: talha.korkmazeth@gmail.com +Email: hello@niceberglabs.com Include: diff --git a/api/package.json b/api/package.json index 79aecfa..897e30a 100644 --- a/api/package.json +++ b/api/package.json @@ -1,18 +1,18 @@ { - "name": "toolgate-api", + "name": "tollgate-api", "version": "0.1.0", "private": true, - "description": "Toolgate hosted ledger API — Cloudflare Worker", + "description": "Tollgate hosted ledger API — Cloudflare Worker", "type": "module", "scripts": { "dev": "wrangler dev", "deploy": "wrangler deploy", - "db:create": "wrangler d1 create toolgate-db", - "db:migrate:local": "wrangler d1 execute toolgate-db --local --file=./schema.sql", - "db:migrate:remote": "wrangler d1 execute toolgate-db --file=./schema.sql" + "db:create": "wrangler d1 create tollgate-db", + "db:migrate:local": "wrangler d1 execute tollgate-db --local --file=./schema.sql", + "db:migrate:remote": "wrangler d1 execute tollgate-db --file=./schema.sql" }, "dependencies": { - "@tkorkmaz/toolgate": "^0.1.0-alpha.1", + "@niceberglabs/tollgate": "^0.3.0-beta.0", "hono": "^4.4.0", "stripe": "^17.7.0" }, diff --git a/api/src/index.ts b/api/src/index.ts index 7d2414d..a15d1e6 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -1,14 +1,14 @@ import { Hono } from "hono"; import { cors } from "hono/cors"; import Stripe from "stripe"; -import { DbLedger, WebhookHandler } from "@tkorkmaz/toolgate"; +import { DbLedger, WebhookHandler } from "@niceberglabs/tollgate"; // ─── Cloudflare Worker env bindings ────────────────────── export interface Env { DB: D1Database; - /** Publisher API key — set via: wrangler secret put TOOLGATE_PUBLISHER_KEY */ - TOOLGATE_PUBLISHER_KEY: string; + /** Publisher API key — set via: wrangler secret put TOLLGATE_PUBLISHER_KEY */ + TOLLGATE_PUBLISHER_KEY: string; /** Stripe test or live secret key */ STRIPE_SECRET_KEY?: string; /** Stripe webhook signing secret (whsec_...) */ @@ -48,10 +48,10 @@ app.use("*", cors({ origin: "*", allowMethods: ["GET", "POST", "OPTIONS"] })); // ─── Auth middleware ────────────────────────────────────── async function requireAuth(c: any, next: any) { - const key = c.req.header("x-toolgate-key"); - if (!key || key !== c.env.TOOLGATE_PUBLISHER_KEY) { + const key = c.req.header("x-tollgate-key"); + if (!key || key !== c.env.TOLLGATE_PUBLISHER_KEY) { return c.json( - { error: "Unauthorized. Provide X-Toolgate-Key header." }, + { error: "Unauthorized. Provide X-Tollgate-Key header." }, 401, ); } @@ -102,10 +102,10 @@ app.post("/api/topup", requireAuth, async (c) => { const amountCents = selectTopUpAmountCents(requiredAmountUsd); const successUrl = - c.env.TOP_UP_SUCCESS_URL ?? "https://main.toolgate.pages.dev?topup=success"; + c.env.TOP_UP_SUCCESS_URL ?? "https://main.tollgate.pages.dev?topup=success"; const cancelUrl = c.env.TOP_UP_CANCEL_URL ?? - "https://main.toolgate.pages.dev?topup=cancelled"; + "https://main.tollgate.pages.dev?topup=cancelled"; const session = await stripe.checkout.sessions.create({ mode: "payment", @@ -115,17 +115,17 @@ app.post("/api/topup", requireAuth, async (c) => { currency: "usd", unit_amount: amountCents, product_data: { - name: "Toolgate Balance Top-Up", - description: `$${(amountCents / 100).toFixed(2)} added to your Toolgate balance`, + name: "Tollgate Balance Top-Up", + description: `$${(amountCents / 100).toFixed(2)} added to your Tollgate balance`, }, }, quantity: 1, }, ], metadata: { - toolgate_caller_id: callerId, - toolgate_publisher_id: c.env.TOOLGATE_PUBLISHER_KEY, - toolgate_amount_cents: String(amountCents), + tollgate_caller_id: callerId, + tollgate_publisher_id: c.env.TOLLGATE_PUBLISHER_KEY, + tollgate_amount_cents: String(amountCents), }, success_url: `${successUrl}&session_id={CHECKOUT_SESSION_ID}&caller_id=${encodeURIComponent(callerId)}`, cancel_url: cancelUrl, @@ -205,7 +205,7 @@ app.get("/api/stats", requireAuth, async (c) => { revenue_usd: revenueRow?.total ?? 0, paid_calls: callsRow?.count ?? 0, active_callers: callersRow?.count ?? 0, - publisher_key: c.env.TOOLGATE_PUBLISHER_KEY.slice(0, 12) + "…", + publisher_key: c.env.TOLLGATE_PUBLISHER_KEY.slice(0, 12) + "…", }); }); @@ -214,7 +214,7 @@ app.get("/api/stats", requireAuth, async (c) => { app.post("/api/keys", requireAuth, async (c) => { return c.json({ - publisher_key: c.env.TOOLGATE_PUBLISHER_KEY, + publisher_key: c.env.TOLLGATE_PUBLISHER_KEY, note: "Alpha: single-publisher mode. Multi-publisher support coming in Sprint B.", }); }); @@ -228,7 +228,7 @@ app.post("/api/keys", requireAuth, async (c) => { app.get("/pay", async (c) => { if (!c.env.STRIPE_SECRET_KEY) { return c.text( - "Payment not yet configured. Visit https://main.toolgate.pages.dev for setup instructions.", + "Payment not yet configured. Visit https://main.tollgate.pages.dev for setup instructions.", 503, ); } @@ -238,7 +238,7 @@ app.get("/pay", async (c) => { const amountStr = c.req.query("amount"); // Validate publisher key (constant-time comparison not needed — alpha only) - if (!publisher || publisher !== c.env.TOOLGATE_PUBLISHER_KEY) { + if (!publisher || publisher !== c.env.TOLLGATE_PUBLISHER_KEY) { return c.text("Invalid publisher key.", 400); } if (!caller || caller.trim().length === 0) { @@ -257,10 +257,10 @@ app.get("/pay", async (c) => { }); const successUrl = - c.env.TOP_UP_SUCCESS_URL ?? "https://main.toolgate.pages.dev?topup=success"; + c.env.TOP_UP_SUCCESS_URL ?? "https://main.tollgate.pages.dev?topup=success"; const cancelUrl = c.env.TOP_UP_CANCEL_URL ?? - "https://main.toolgate.pages.dev?topup=cancelled"; + "https://main.tollgate.pages.dev?topup=cancelled"; const session = await stripe.checkout.sessions.create({ mode: "payment", @@ -270,17 +270,17 @@ app.get("/pay", async (c) => { currency: "usd", unit_amount: amountCents, product_data: { - name: "Toolgate Balance Top-Up", - description: `$${(amountCents / 100).toFixed(2)} added to your Toolgate balance`, + name: "Tollgate Balance Top-Up", + description: `$${(amountCents / 100).toFixed(2)} added to your Tollgate balance`, }, }, quantity: 1, }, ], metadata: { - toolgate_caller_id: caller, - toolgate_publisher_id: publisher, - toolgate_amount_cents: String(amountCents), + tollgate_caller_id: caller, + tollgate_publisher_id: publisher, + tollgate_amount_cents: String(amountCents), }, success_url: `${successUrl}&session_id={CHECKOUT_SESSION_ID}&caller_id=${encodeURIComponent(caller)}`, cancel_url: cancelUrl, @@ -297,7 +297,7 @@ app.get("/pay", async (c) => { app.get("/", (c) => c.json({ - service: "toolgate-api", + service: "tollgate-api", version: "0.1.0-alpha.1", endpoints: [ "GET /pay (browser top-up redirect → Stripe Checkout)", diff --git a/api/wrangler.toml.example b/api/wrangler.toml.example index 7cc3a3f..1cc6f69 100644 --- a/api/wrangler.toml.example +++ b/api/wrangler.toml.example @@ -1,4 +1,4 @@ -name = "toolgate-api" +name = "tollgate-api" main = "src/index.ts" compatibility_date = "2024-09-23" compatibility_flags = ["nodejs_compat"] diff --git a/docs/ADVANCED_SCENARIOS.md b/docs/ADVANCED_SCENARIOS.md index 7501620..98bbcda 100644 --- a/docs/ADVANCED_SCENARIOS.md +++ b/docs/ADVANCED_SCENARIOS.md @@ -100,7 +100,7 @@ npm run scenario:x402-testnet The flow separates challenge generation from payment proof creation: -- `challenge.mjs` produces the Toolgate-generated x402 challenge. +- `challenge.mjs` produces the Tollgate-generated x402 challenge. - `sign-payload.mjs` produces the x402 client or signer-generated proof. - `scenario:x402-testnet` validates verify, settle, duplicate replay, fallback, and recovery behavior. @@ -120,9 +120,9 @@ The flow separates challenge generation from payment proof creation: By default, payment-required responses can include a top-up URL. To use your own endpoint: ```ts -const gate = new ToolGate({ +const gate = new TollGate({ publisherKey: "tg_your_key", - topUpBaseUrl: "https://api.yourapp.com/toolgate/pay", + topUpBaseUrl: "https://api.yourapp.com/tollgate/pay", }); ``` @@ -131,7 +131,7 @@ checkout or payment flow. ## Firecrawl integration -The Firecrawl integration lives in `integrations/firecrawl-mcp-toolgate/`. +The Firecrawl integration lives in `integrations/firecrawl-mcp-tollgate/`. - `scenario-fake.mjs`: deterministic regression coverage. - `scenario-live.mjs`: live Firecrawl API path. diff --git a/docs/DEMO_USE_CASE.md b/docs/DEMO_USE_CASE.md index 5f3cdb2..fa7231d 100644 --- a/docs/DEMO_USE_CASE.md +++ b/docs/DEMO_USE_CASE.md @@ -5,7 +5,7 @@ Use a paid search / scraping / enrichment tool as the first public demo. The clearest story is a Firecrawl-style extraction wrapper: 1. Caller asks for a premium extraction. -2. Caller has no balance, so Toolgate serves a fallback summary instead of failing hard. +2. Caller has no balance, so Tollgate serves a fallback summary instead of failing hard. 3. Caller receives `payment_required` when the tool is configured to block. 4. Caller is credited locally for the demo. 5. Premium extraction runs and returns a prepaid receipt. diff --git a/docs/KNOWN_LIMITATIONS.md b/docs/KNOWN_LIMITATIONS.md index 37dc68c..feb8275 100644 --- a/docs/KNOWN_LIMITATIONS.md +++ b/docs/KNOWN_LIMITATIONS.md @@ -1,6 +1,6 @@ # Known Limitations -Toolgate is a developer preview. It is useful today for local-first demos, single-process +Tollgate is a developer preview. It is useful today for local-first demos, single-process prototypes, and design-partner evaluation, but several production boundaries are intentional. ## Durable idempotency @@ -74,7 +74,7 @@ as integration scaffolding until exercised against a live provider. ## Hosted product surface -Toolgate currently ships as an open-source runtime. It does not yet include: +Tollgate currently ships as an open-source runtime. It does not yet include: - hosted dashboard, - multi-tenant hosted ledger, diff --git a/docs/MCP_QUICKSTART.md b/docs/MCP_QUICKSTART.md index f05b73e..7986df0 100644 --- a/docs/MCP_QUICKSTART.md +++ b/docs/MCP_QUICKSTART.md @@ -1,23 +1,23 @@ # MCP Quickstart -Wrap an existing MCP tool with Toolgate so it handles pricing, fallback, idempotency, +Wrap an existing MCP tool with Tollgate so it handles pricing, fallback, idempotency, recovery, and traces — without rewriting your tool. Start local-first, add payment rails later. -All imports use the public package API (`@tkorkmaz/toolgate`). +All imports use the public package API (`@niceberglabs/tollgate`). ## 1. Wrap a tool with `createMcpAdapter` ```ts import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; -import { ToolGate, createMcpAdapter, usd } from "@tkorkmaz/toolgate"; +import { TollGate, createMcpAdapter, usd } from "@niceberglabs/tollgate"; const server = new McpServer({ name: "my-tools", version: "1.0.0" }); -const gate = new ToolGate({ publisherKey: "tg_local_demo" }); +const gate = new TollGate({ publisherKey: "tg_local_demo" }); const mcp = createMcpAdapter(gate, { - // Map an MCP session to a Toolgate caller identity. + // Map an MCP session to a Tollgate caller identity. getCallerId: (_args, extra) => extra?.sessionId ?? "demo-user", - // Attach Toolgate metadata to responses (default true). + // Attach Tollgate metadata to responses (default true). includeMeta: true, }); @@ -53,14 +53,14 @@ MCP result — the degraded payload plus a notice appended to the content: No charge is made. With `onPaymentFailed: "block"` (no fallback) the call returns `isError: true` with a "Payment required" message, the amount, accepted rails, and a top-up URL. -## 3. What `_meta.toolgate` contains +## 3. What `_meta.tollgate` contains On a normal/fallback result (`includeMeta: true`): ```jsonc { "_meta": { - "toolgate": { + "tollgate": { "paid": true, // false when served from fallback "isFallback": false, "receipt": { // null when nothing was charged @@ -80,7 +80,7 @@ On a `payment_required` (402) result: ```jsonc { "_meta": { - "toolgate": { + "tollgate": { "paymentRequired": true, "amount": 0.05, "currency": "usd", @@ -91,7 +91,7 @@ On a `payment_required` (402) result: } ``` -Agents that understand Toolgate can read `_meta.toolgate` to decide whether to top up and retry. +Agents that understand Tollgate can read `_meta.tollgate` to decide whether to top up and retry. ## 4. Start local-first, add rails later @@ -99,10 +99,10 @@ You do **not** need Stripe, x402, or MPP to develop and test. Use the in-memory credit callers directly: ```ts -import { InMemoryLedger, usd } from "@tkorkmaz/toolgate"; +import { InMemoryLedger, usd } from "@niceberglabs/tollgate"; const ledger = new InMemoryLedger(); -const gate = new ToolGate({ publisherKey: "tg_local_demo", ledger }); +const gate = new TollGate({ publisherKey: "tg_local_demo", ledger }); await ledger.credit("demo-user", usd("1.00"), { source: "manual", @@ -111,7 +111,7 @@ await ledger.credit("demo-user", usd("1.00"), { ``` When you're ready for real money, add a rail adapter (`StripeRailAdapter`, `X402RailAdapter`, -or `MppRailAdapter`) to the `ToolGate` config and switch the ledger to `DbLedger`. See the +or `MppRailAdapter`) to the `TollGate` config and switch the ledger to `DbLedger`. See the README "Advanced payment rails" and "Production status" sections for maturity and limitations. For a runnable, no-env demo of the full lifecycle: diff --git a/examples/_shared/recovery-scenarios.mjs b/examples/_shared/recovery-scenarios.mjs index afe7678..c36ca83 100644 --- a/examples/_shared/recovery-scenarios.mjs +++ b/examples/_shared/recovery-scenarios.mjs @@ -1,7 +1,7 @@ import http from "node:http"; import { pathToFileURL } from "node:url"; import { - ToolGate, + TollGate, createMcpAdapter, MppRailAdapter, X402RailAdapter, @@ -13,7 +13,7 @@ const DEMO_CALLER = "demo-agent"; const DEMO_PUBLISHER = "tg_phase3_demo"; export async function createLedgerExample() { - const gate = new ToolGate({ + const gate = new TollGate({ publisherKey: DEMO_PUBLISHER, paymentRails: ["stripe"], }); @@ -60,7 +60,7 @@ export async function createMppExample() { }, }); - const gate = new ToolGate({ + const gate = new TollGate({ publisherKey: DEMO_PUBLISHER, paymentRails: ["mpp"], railAdapters: [mppAdapter], @@ -83,7 +83,7 @@ export async function createMppExample() { }); return { "org.paymentauth/credential": "mpp-valid-demo", - toolgate: { + tollgate: { mppChallengeId: challenge.mppChallenge?.challenges[0]?.id ?? null, providerId: "mpp-provider-demo", }, @@ -114,7 +114,7 @@ export async function createX402Example() { maxTimeoutSeconds: 60, }); - const gate = new ToolGate({ + const gate = new TollGate({ publisherKey: DEMO_PUBLISHER, paymentRails: ["x402"], railAdapters: [x402Adapter], @@ -136,7 +136,7 @@ export async function createX402Example() { publisherKey: DEMO_PUBLISHER, }); return { - toolgate: { + tollgate: { x402ActionId: challenge.actionId, x402Payment: { payer: "0xdemo", @@ -360,7 +360,7 @@ function makePremiumPayload(kind, args) { papers: [ { title: "Deterministic Recovery for Paid Agent Tools", - doi: "10.5555/toolgate.2026.001", + doi: "10.5555/tollgate.2026.001", }, ], }; @@ -423,18 +423,18 @@ function normalizeResult(result) { function normalizeMeta(meta) { if (!meta || typeof meta !== "object") return null; - const toolgate = - meta.toolgate && typeof meta.toolgate === "object" ? meta.toolgate : null; - if (!toolgate) return null; + const tollgate = + meta.tollgate && typeof meta.tollgate === "object" ? meta.tollgate : null; + if (!tollgate) return null; return { - paid: Boolean(toolgate.paid), - isFallback: Boolean(toolgate.isFallback), - acceptedRails: Array.isArray(toolgate.acceptedRails) - ? toolgate.acceptedRails + paid: Boolean(tollgate.paid), + isFallback: Boolean(tollgate.isFallback), + acceptedRails: Array.isArray(tollgate.acceptedRails) + ? tollgate.acceptedRails : undefined, amount: - typeof toolgate.amount === "number" - ? roundMoney(toolgate.amount) + typeof tollgate.amount === "number" + ? roundMoney(tollgate.amount) : undefined, }; } diff --git a/examples/advanced-server/index.mjs b/examples/advanced-server/index.mjs index 33e1b5b..d12b504 100644 --- a/examples/advanced-server/index.mjs +++ b/examples/advanced-server/index.mjs @@ -1,7 +1,7 @@ /** - * Toolgate — Advanced MCP Server Example + * Tollgate — Advanced MCP Server Example * - * Showcases all Toolgate features: + * Showcases all Tollgate features: * 1. Static pricing — premium_search ($0.05/call + fallback) * 2. Dynamic pricing — smart_translate ($0.01/100 chars) * 3. Free tier + premium — data_lookup (10 free/day, then $0.03) @@ -28,16 +28,16 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; -import { ToolGate, createMcpAdapter, usd, toNumber } from "@tkorkmaz/toolgate"; +import { TollGate, createMcpAdapter, usd, toNumber } from "@niceberglabs/tollgate"; // ─── Observability ─────────────────────────────────────────── const stats = { calls: 0, revenue: 0, errors: 0 }; -// ─── Toolgate setup with global hooks ──────────────────────── +// ─── Tollgate setup with global hooks ──────────────────────── -const gate = new ToolGate({ - publisherKey: process.env.TOOLGATE_PUBLISHER_KEY ?? "tg_test", +const gate = new TollGate({ + publisherKey: process.env.TOLLGATE_PUBLISHER_KEY ?? "tg_test", hooks: { onCall: (tool, callerId) => { @@ -59,7 +59,7 @@ const gate = new ToolGate({ const mcp = createMcpAdapter(gate, { getCallerId: (_args, extra) => extra?.sessionId ?? "demo-user", - includeMeta: true, // attach _meta.toolgate to every response + includeMeta: true, // attach _meta.tollgate to every response }); // Pre-load $2.00 demo balance @@ -84,7 +84,7 @@ mcp.paidTool("premium_search", { }, required: ["query"], }, - price: 0.05, + price: usd("0.05"), onPaymentFailed: "fallback", handler: async ({ query, limit = 5 }) => ({ results: Array.from( @@ -142,7 +142,7 @@ mcp.paidTool("data_lookup", { tiers: { free: { limit: 10, period: "day" }, - premium: { price: 0.03 }, + premium: { price: usd("0.03") }, }, handler: async ({ id }) => ({ @@ -198,7 +198,7 @@ mcp.paidTool("audited_action", { }, required: ["action"], }, - price: 0.1, + price: usd("0.10"), beforeExecute: async (_input, ctx) => { // Require a minimum balance buffer before executing @@ -253,7 +253,7 @@ mcp.paidTool("audited_action", { // ─── Free utility tools ─────────────────────────────────────── const server = new McpServer({ - name: "toolgate-advanced-example", + name: "tollgate-advanced-example", version: "1.0.0", }); @@ -318,6 +318,6 @@ const transport = new StdioServerTransport(); await server.connect(transport); process.stderr.write( - `[toolgate-advanced] Server started. Tools: premium_search, smart_translate, ` + + `[tollgate-advanced] Server started. Tools: premium_search, smart_translate, ` + `data_lookup, heavy_compute, audited_action. Balance: $2.00 pre-loaded.\n`, ); diff --git a/examples/advanced-server/package.json b/examples/advanced-server/package.json index 121bdb0..4a722b0 100644 --- a/examples/advanced-server/package.json +++ b/examples/advanced-server/package.json @@ -1,5 +1,5 @@ { - "name": "toolgate-advanced-server", + "name": "tollgate-advanced-server", "version": "1.0.0", "description": "Full-featured paid MCP server — dynamic pricing, tiers, fallback, metering, hooks", "type": "module", @@ -9,7 +9,7 @@ }, "dependencies": { "@modelcontextprotocol/sdk": "^1.0.0", - "@tkorkmaz/toolgate": "^0.1.0-alpha.1" + "@niceberglabs/tollgate": "^0.1.0-alpha.1" }, "devDependencies": { "ts-node": "^10.9.0", diff --git a/examples/basic-server/index.mjs b/examples/basic-server/index.mjs index 8f09301..84844ee 100644 --- a/examples/basic-server/index.mjs +++ b/examples/basic-server/index.mjs @@ -1,5 +1,5 @@ /** - * Toolgate — Basic MCP Server Example + * Tollgate — Basic MCP Server Example * * A minimal paid MCP server showcasing: * - Static per-call pricing ($0.05) @@ -28,17 +28,17 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; -import { ToolGate, createMcpAdapter, usd, toNumber } from "@tkorkmaz/toolgate"; +import { TollGate, createMcpAdapter, usd, toNumber } from "@niceberglabs/tollgate"; -// ─── Toolgate setup ────────────────────────────────────────── +// ─── Tollgate setup ────────────────────────────────────────── -const gate = new ToolGate({ - publisherKey: process.env.TOOLGATE_PUBLISHER_KEY ?? "tg_test", +const gate = new TollGate({ + publisherKey: process.env.TOLLGATE_PUBLISHER_KEY ?? "tg_test", }); const mcp = createMcpAdapter(gate, { // Extract caller identity from the MCP session ID. - // In production this maps to a real Toolgate account. + // In production this maps to a real Tollgate account. getCallerId: (_args, extra) => extra?.sessionId ?? "demo-user", }); @@ -60,7 +60,7 @@ mcp.paidTool("premium_search", { required: ["query"], }, - price: 0.05, // $0.05 per call (static) + price: usd("0.05"), // $0.05 per call (static) handler: async ({ query }) => { // Replace with your real search implementation. @@ -84,7 +84,7 @@ mcp.paidTool("premium_search", { // ─── Free utility tools ─────────────────────────────────────── const server = new McpServer({ - name: "toolgate-basic-example", + name: "tollgate-basic-example", version: "1.0.0", }); @@ -151,5 +151,5 @@ const transport = new StdioServerTransport(); await server.connect(transport); process.stderr.write( - "[toolgate-basic] Server started. Pre-loaded $1.00 demo balance.\n", + "[tollgate-basic] Server started. Pre-loaded $1.00 demo balance.\n", ); diff --git a/examples/basic-server/package.json b/examples/basic-server/package.json index ade65ac..63d5ed1 100644 --- a/examples/basic-server/package.json +++ b/examples/basic-server/package.json @@ -1,7 +1,7 @@ { - "name": "toolgate-basic-server", + "name": "tollgate-basic-server", "version": "1.0.0", - "description": "Minimal paid MCP server using Toolgate", + "description": "Minimal paid MCP server using Tollgate", "type": "module", "scripts": { "start": "node --loader ts-node/esm index.ts", @@ -9,7 +9,7 @@ }, "dependencies": { "@modelcontextprotocol/sdk": "^1.0.0", - "@tkorkmaz/toolgate": "^0.1.0-alpha.1" + "@niceberglabs/tollgate": "^0.1.0-alpha.1" }, "devDependencies": { "ts-node": "^10.9.0", diff --git a/examples/local-first-runtime/scenario.mjs b/examples/local-first-runtime/scenario.mjs index 86de136..059a7e7 100644 --- a/examples/local-first-runtime/scenario.mjs +++ b/examples/local-first-runtime/scenario.mjs @@ -1,12 +1,12 @@ /** - * Toolgate — Local-First Runtime Example + * Tollgate — Local-First Runtime Example * * Runs entirely in-memory. No Stripe, x402, MPP, wallets, webhooks, * hosted APIs, or environment variables required. * * npm run example:local * - * It demonstrates the six edge cases Toolgate exists to handle: + * It demonstrates the six edge cases Tollgate exists to handle: * A. Fallback when the caller has no balance (no charge). * B. Block → payment_required (402) when the caller has no balance. * C. Paid execution after a local ledger credit. @@ -15,14 +15,14 @@ * F. Execution trace inspection. */ -import { ToolGate, InMemoryLedger, usd } from "../../dist/index.js"; +import { TollGate, InMemoryLedger, usd } from "../../dist/index.js"; const CALLER = "demo-agent"; // A shared ledger so every flow sees the same balance. const ledger = new InMemoryLedger(); -const gate = new ToolGate({ +const gate = new TollGate({ publisherKey: "tg_local_demo", paymentRails: ["stripe"], // illustrative only — never contacted in this demo topUpBaseUrl: "https://your-topup-endpoint.example/pay", diff --git a/examples/x402-testnet-recovery/_shared.mjs b/examples/x402-testnet-recovery/_shared.mjs index f9b11f5..c431290 100644 --- a/examples/x402-testnet-recovery/_shared.mjs +++ b/examples/x402-testnet-recovery/_shared.mjs @@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { - ToolGate, + TollGate, X402RailAdapter, createMcpAdapter, usd, @@ -137,7 +137,7 @@ export function createBlockingRegistration(gate) { }); return mcp.paidTool(`${toolName}_blocking`, { - description: "x402 testnet Toolgate challenge scenario", + description: "x402 testnet Tollgate challenge scenario", inputSchema: { type: "object", properties: { @@ -169,7 +169,7 @@ export function createRuntime(options = {}) { payTo: options.payTo ?? process.env.X402_PAY_TO, network, }); - const gate = new ToolGate({ + const gate = new TollGate({ publisherKey, paymentRails: ["x402"], railAdapters: [adapter], @@ -189,7 +189,7 @@ export function buildProofMeta(proof, facilitatorUrl) { const accepted = proof?.payload?.accepted; return { - toolgate: { + tollgate: { x402ActionId: proof.actionId, x402Payment: proof.payload, x402PaymentRequirements: accepted, @@ -199,11 +199,11 @@ export function buildProofMeta(proof, facilitatorUrl) { } export function extractPaymentRequiredDetails(result) { - const toolgateMeta = result?._meta?.toolgate; + const tollgateMeta = result?._meta?.tollgate; const x402Challenge = result?._meta?.x402; if ( - !toolgateMeta?.paymentRequired || - !toolgateMeta?.x402ActionId || + !tollgateMeta?.paymentRequired || + !tollgateMeta?.x402ActionId || !x402Challenge ) { return null; @@ -216,7 +216,7 @@ export function extractPaymentRequiredDetails(result) { settlements: [ { rail: "x402", - actionId: toolgateMeta.x402ActionId, + actionId: tollgateMeta.x402ActionId, x402PaymentRequired: x402Challenge, }, ], diff --git a/integrations/brightdata-mcp-notes/NOTES.md b/integrations/brightdata-mcp-notes/NOTES.md index c20da3d..2181c77 100644 --- a/integrations/brightdata-mcp-notes/NOTES.md +++ b/integrations/brightdata-mcp-notes/NOTES.md @@ -6,7 +6,7 @@ Do not fully integrate in this sprint. The Bright Data MCP surface is broad and mode-driven. The mapping is clear enough to document now, but a full wrapper should wait until the Firecrawl integration is exercised against a live MCP deployment. -## Natural Toolgate Mapping +## Natural Tollgate Mapping Rapid or Free mode maps cleanly to fallback or a basic tier: @@ -26,7 +26,7 @@ Pro mode maps to paid execution: - advanced scraping helpers such as `extract` - dataset and `web_data_*` tools that imply higher provider cost or longer polling windows -Recommended Toolgate behavior: +Recommended Tollgate behavior: - Rapid or free tool -> `fallback_response` or free-tier handler - Pro tool -> paid execution through `paidAction` @@ -39,7 +39,7 @@ Recommended Toolgate behavior: 1. Bright Data uses mode switches and tool groups such as `PRO_MODE`, `GROUPS`, and `TOOLS`, so the billing boundary is partly environment-level rather than purely tool-level. 2. Several high-value tools are asynchronous or polling-based, especially `web_data_*`. That raises a question about whether billing should happen before kickoff, on completion, or after polling success. 3. CAPTCHA, block, and rate-limit outcomes are product-level states, not just generic handler errors. They map better to `retry_later` or a controlled fallback than to a plain exception. -4. The free tier already exists at the provider layer. Toolgate should not obscure it; it should formalize the recovery behavior above it. +4. The free tier already exists at the provider layer. Tollgate should not obscure it; it should formalize the recovery behavior above it. ## Recommended First Bright Data Slice diff --git a/integrations/firecrawl-mcp-toolgate/NOTES.md b/integrations/firecrawl-mcp-tollgate/NOTES.md similarity index 89% rename from integrations/firecrawl-mcp-toolgate/NOTES.md rename to integrations/firecrawl-mcp-tollgate/NOTES.md index e94f8e6..7a5aa56 100644 --- a/integrations/firecrawl-mcp-toolgate/NOTES.md +++ b/integrations/firecrawl-mcp-tollgate/NOTES.md @@ -4,7 +4,7 @@ Target tool: `firecrawl_scrape` -Goal of the attempt: wrap one real Firecrawl MCP tool with `paidAction` and prove the recovery contract without changing the Toolgate SDK core. +Goal of the attempt: wrap one real Firecrawl MCP tool with `paidAction` and prove the recovery contract without changing the Tollgate SDK core. ## Lines Of Code Changed @@ -15,8 +15,8 @@ Goal of the attempt: wrap one real Firecrawl MCP tool with `paidAction` and prov ## What Changed -- Added `integrations/firecrawl-mcp-toolgate/index.mjs` as a small wrapper around the Firecrawl scrape contract -- Added `integrations/firecrawl-mcp-toolgate/scenario.mjs` to prove: +- Added `integrations/firecrawl-mcp-tollgate/index.mjs` as a small wrapper around the Firecrawl scrape contract +- Added `integrations/firecrawl-mcp-tollgate/scenario.mjs` to prove: - payment available -> full result - payment missing -> fallback result - duplicate requestId plus URL -> replay previous result with no double charge @@ -25,7 +25,7 @@ Goal of the attempt: wrap one real Firecrawl MCP tool with `paidAction` and prov ## Where The Idempotency Key Came From -Firecrawl's scrape tool exposes a URL, but not an app-level idempotency key that Toolgate can safely reuse. +Firecrawl's scrape tool exposes a URL, but not an app-level idempotency key that Tollgate can safely reuse. The wrapper therefore sourced idempotency from: @@ -66,7 +66,7 @@ That keeps the MCP contract stable while making the degraded response explicit. Mostly yes. -`paidAction` was the right abstraction for this integration because the MCP tool wrapper is really a paid action around an external server call, not a new Toolgate-native tool type. +`paidAction` was the right abstraction for this integration because the MCP tool wrapper is really a paid action around an external server call, not a new Tollgate-native tool type. The parts that felt natural: @@ -83,7 +83,7 @@ The parts that still need integration glue rather than SDK changes: ## Real Friction Points -1. Firecrawl does not hand Toolgate a stable idempotency token. The integration had to introduce `requestId` and compose it with a normalized URL. +1. Firecrawl does not hand Tollgate a stable idempotency token. The integration had to introduce `requestId` and compose it with a normalized URL. 2. URL normalization matters. The same page can arrive with reordered query params or an irrelevant fragment, which would otherwise create false misses in duplicate detection. 3. A live Firecrawl MCP deployment sits behind stdio or HTTP transport plus API-key configuration. That means deterministic repo-local validation needed a transport seam instead of spawning the server in-process. 4. Firecrawl returns premium results, but it does not define a degraded response contract. The wrapper had to invent the fallback payload shape. @@ -92,4 +92,4 @@ The parts that still need integration glue rather than SDK changes: - Assumption: the downstream MCP tool would already expose a safe idempotency handle. It did not. - Assumption: URL alone was enough for duplicate protection. It was not; `requestId` is needed to distinguish intentional repeated scrapes from retries. -- Assumption: a "real integration attempt" required SDK changes. It did not. The existing Toolgate surface was enough for the first pass. +- Assumption: a "real integration attempt" required SDK changes. It did not. The existing Tollgate surface was enough for the first pass. diff --git a/integrations/firecrawl-mcp-toolgate/index.mjs b/integrations/firecrawl-mcp-tollgate/index.mjs similarity index 99% rename from integrations/firecrawl-mcp-toolgate/index.mjs rename to integrations/firecrawl-mcp-tollgate/index.mjs index a26b5bb..93ae1b8 100644 --- a/integrations/firecrawl-mcp-toolgate/index.mjs +++ b/integrations/firecrawl-mcp-tollgate/index.mjs @@ -179,7 +179,7 @@ export function createFirecrawlFallbackResult(input) { const normalizedUrl = normalizeFirecrawlUrl(input.url); return { mode: "fallback", - provider: "toolgate", + provider: "tollgate", tool: "firecrawl_scrape", requestId: input.requestId ?? null, url: normalizedUrl, diff --git a/integrations/firecrawl-mcp-toolgate/mcp-e2e-server.mjs b/integrations/firecrawl-mcp-tollgate/mcp-e2e-server.mjs similarity index 96% rename from integrations/firecrawl-mcp-toolgate/mcp-e2e-server.mjs rename to integrations/firecrawl-mcp-tollgate/mcp-e2e-server.mjs index be2d462..f6a1b32 100644 --- a/integrations/firecrawl-mcp-toolgate/mcp-e2e-server.mjs +++ b/integrations/firecrawl-mcp-tollgate/mcp-e2e-server.mjs @@ -1,7 +1,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; -import { ToolGate, createMcpAdapter, usd, toNumber } from "../../dist/index.js"; +import { TollGate, createMcpAdapter, usd, toNumber } from "../../dist/index.js"; import { createFakeFirecrawlTransport, createFirecrawlFallbackResult, @@ -12,7 +12,7 @@ import { const callerId = "mcp-e2e-client"; const duplicateKeys = []; -const gate = new ToolGate({ +const gate = new TollGate({ publisherKey: "tg_firecrawl_mcp_e2e", paymentRails: ["stripe"], }); @@ -37,7 +37,7 @@ mcp.paidTool("firecrawl_scrape", { }); const server = new McpServer({ - name: "toolgate-firecrawl-mcp-e2e", + name: "tollgate-firecrawl-mcp-e2e", version: "1.0.0", }); diff --git a/integrations/firecrawl-mcp-toolgate/scenario-fake.mjs b/integrations/firecrawl-mcp-tollgate/scenario-fake.mjs similarity index 93% rename from integrations/firecrawl-mcp-toolgate/scenario-fake.mjs rename to integrations/firecrawl-mcp-tollgate/scenario-fake.mjs index 0671bbc..1c57731 100644 --- a/integrations/firecrawl-mcp-toolgate/scenario-fake.mjs +++ b/integrations/firecrawl-mcp-tollgate/scenario-fake.mjs @@ -1,5 +1,5 @@ import assert from "node:assert/strict"; -import { ToolGate, createMcpAdapter, usd, toNumber } from "../../dist/index.js"; +import { TollGate, createMcpAdapter, usd, toNumber } from "../../dist/index.js"; import { createFakeFirecrawlTransport, createFirecrawlFallbackResult, @@ -47,7 +47,7 @@ function createRegisteredFirecrawlTool({ gate, transport, duplicateKeys }) { } async function runScenario() { - const gate = new ToolGate({ + const gate = new TollGate({ publisherKey: "tg_firecrawl_demo", paymentRails: ["stripe"], }); @@ -71,7 +71,7 @@ async function runScenario() { ); assert.equal(fallbackResult.isError, false); - assert.equal(fallbackResult._meta.toolgate.isFallback, true); + assert.equal(fallbackResult._meta.tollgate.isFallback, true); assert.equal(parseMcpPayload(fallbackResult).mode, "fallback"); assert.equal(fallbackTrace?.fallbackUsed, true); assert.equal(fallbackTrace?.chargeStatus, "none"); @@ -95,7 +95,7 @@ async function runScenario() { ); assert.equal(paidResult.isError, false); - assert.equal(paidResult._meta.toolgate.isFallback, false); + assert.equal(paidResult._meta.tollgate.isFallback, false); assert.equal(paidOutput.mode, "premium"); assert.equal(transport.calls.length, 1); assert.equal(toNumber(balanceBeforePaid) - toNumber(balanceAfterPaid), 0.25); @@ -131,14 +131,14 @@ async function runScenario() { const traces = await gate.traces.toJSON({ toolName: "firecrawl_scrape" }); return { - integration: "firecrawl-mcp-toolgate-fake", + integration: "firecrawl-mcp-tollgate-fake", tool: "firecrawl_scrape", scenarios: [ { name: "payment_missing", result: { success: !fallbackResult.isError, - isFallback: fallbackResult._meta.toolgate.isFallback, + isFallback: fallbackResult._meta.tollgate.isFallback, mode: parseMcpPayload(fallbackResult).mode, }, trace: summarizeTrace(fallbackTrace), @@ -149,7 +149,7 @@ async function runScenario() { balanceAfter: toNumber(balanceAfterPaid), result: { success: !paidResult.isError, - isFallback: paidResult._meta.toolgate.isFallback, + isFallback: paidResult._meta.tollgate.isFallback, mode: paidOutput.mode, }, trace: summarizeTrace(paidTrace), diff --git a/integrations/firecrawl-mcp-toolgate/scenario-live.mjs b/integrations/firecrawl-mcp-tollgate/scenario-live.mjs similarity index 93% rename from integrations/firecrawl-mcp-toolgate/scenario-live.mjs rename to integrations/firecrawl-mcp-tollgate/scenario-live.mjs index b4dc779..d4f998e 100644 --- a/integrations/firecrawl-mcp-toolgate/scenario-live.mjs +++ b/integrations/firecrawl-mcp-tollgate/scenario-live.mjs @@ -1,5 +1,5 @@ import assert from "node:assert/strict"; -import { ToolGate, createMcpAdapter, usd, toNumber } from "../../dist/index.js"; +import { TollGate, createMcpAdapter, usd, toNumber } from "../../dist/index.js"; import { createFirecrawlFallbackResult, createFirecrawlIdempotencyKey, @@ -14,7 +14,7 @@ const callerId = "firecrawl-live-agent"; const targetUrl = process.env.FIRECRAWL_LIVE_TEST_URL ?? process.argv[2] ?? - "https://github.com/tkorkmazeth/toolgate"; + "https://github.com/niceberginc/tollgate"; function parseMcpPayload(result) { const text = result?.content?.find((item) => item.type === "text")?.text; @@ -54,7 +54,7 @@ function createRegisteredFirecrawlTool({ gate, transport, duplicateKeys }) { } async function runLiveScenario() { - const gate = new ToolGate({ + const gate = new TollGate({ publisherKey: "tg_firecrawl_live", paymentRails: ["stripe"], }); @@ -78,7 +78,7 @@ async function runLiveScenario() { ); assert.equal(fallbackResult.isError, false); - assert.equal(fallbackResult._meta.toolgate.isFallback, true); + assert.equal(fallbackResult._meta.tollgate.isFallback, true); assert.equal(parseMcpPayload(fallbackResult).mode, "fallback"); assert.equal(fallbackTrace?.fallbackUsed, true); assert.equal(fallbackTrace?.chargeStatus, "none"); @@ -102,7 +102,7 @@ async function runLiveScenario() { ); assert.equal(paidResult.isError, false); - assert.equal(paidResult._meta.toolgate.isFallback, false); + assert.equal(paidResult._meta.tollgate.isFallback, false); assert.equal(paidOutput.mode, "premium"); assert.equal(typeof paidOutput.result?.markdown, "string"); assert.ok(paidOutput.result.markdown.length > 0); @@ -130,14 +130,14 @@ async function runLiveScenario() { const traces = await gate.traces.toJSON({ toolName: "firecrawl_scrape" }); return { - integration: "firecrawl-mcp-toolgate-live", + integration: "firecrawl-mcp-tollgate-live", targetUrl: paidOutput.url, scenarios: [ { name: "payment_missing", result: { success: !fallbackResult.isError, - isFallback: fallbackResult._meta.toolgate.isFallback, + isFallback: fallbackResult._meta.tollgate.isFallback, mode: parseMcpPayload(fallbackResult).mode, }, trace: summarizeTrace(fallbackTrace), @@ -179,7 +179,7 @@ try { process.stdout.write( `${JSON.stringify( { - integration: "firecrawl-mcp-toolgate-live", + integration: "firecrawl-mcp-tollgate-live", blocked: true, blocker: { reason: "missing_env", diff --git a/integrations/firecrawl-mcp-toolgate/scenario-mcp-e2e.mjs b/integrations/firecrawl-mcp-tollgate/scenario-mcp-e2e.mjs similarity index 98% rename from integrations/firecrawl-mcp-toolgate/scenario-mcp-e2e.mjs rename to integrations/firecrawl-mcp-tollgate/scenario-mcp-e2e.mjs index 5b12471..1dc772e 100644 --- a/integrations/firecrawl-mcp-toolgate/scenario-mcp-e2e.mjs +++ b/integrations/firecrawl-mcp-tollgate/scenario-mcp-e2e.mjs @@ -20,7 +20,7 @@ const transport = new StdioClientTransport({ const client = new Client( { - name: "toolgate-firecrawl-mcp-e2e-client", + name: "tollgate-firecrawl-mcp-e2e-client", version: "1.0.0", }, { capabilities: {} }, diff --git a/integrations/stripe-test-mode/scenario.mjs b/integrations/stripe-test-mode/scenario.mjs index b3280b6..9022f49 100644 --- a/integrations/stripe-test-mode/scenario.mjs +++ b/integrations/stripe-test-mode/scenario.mjs @@ -6,7 +6,7 @@ import { existsSync, readFileSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { - ToolGate, + TollGate, StripeAdapter, createWebhookHandler, toNumber, @@ -163,7 +163,7 @@ async function runScenario() { return; } - const gate = new ToolGate({ + const gate = new TollGate({ publisherKey, paymentRails: ["stripe"], }); @@ -266,7 +266,7 @@ async function runScenario() { const stripeAdapter = new StripeAdapter({ secretKey: process.env.STRIPE_SECRET_KEY, webhookSecret, - topUpBaseUrl: "https://pay.toolgate.dev", + topUpBaseUrl: "https://pay.tollgate.dev", }); stripeClient = await stripeAdapter.getClient(); webhookHandler = createWebhookHandler({ @@ -294,13 +294,13 @@ async function runScenario() { assert.ok(createdTopUpSession.url); assert.equal(createdSession.id, createdTopUpSession.sessionId); assert.equal(createdSession.url, createdTopUpSession.url); - assert.equal(createdSession.metadata?.toolgate_caller_id, callerId); - assert.equal(createdSession.metadata?.toolgate_publisher_id, publisherKey); + assert.equal(createdSession.metadata?.tollgate_caller_id, callerId); + assert.equal(createdSession.metadata?.tollgate_publisher_id, publisherKey); assert.equal( - createdSession.metadata?.toolgate_amount_cents, + createdSession.metadata?.tollgate_amount_cents, String(checkoutAmountCents), ); - assert.equal(createdSession.metadata?.toolgate_currency, checkoutCurrency); + assert.equal(createdSession.metadata?.tollgate_currency, checkoutCurrency); const createdAmount = createdSession.amount_total ?? @@ -315,13 +315,13 @@ async function runScenario() { "--api-key", process.env.STRIPE_SECRET_KEY, "--override", - `checkout_session:metadata.toolgate_caller_id=${callerId}`, + `checkout_session:metadata.tollgate_caller_id=${callerId}`, "--override", - `checkout_session:metadata.toolgate_publisher_id=${publisherKey}`, + `checkout_session:metadata.tollgate_publisher_id=${publisherKey}`, "--override", - "checkout_session:metadata.toolgate_amount_cents=100", + "checkout_session:metadata.tollgate_amount_cents=100", "--override", - "checkout_session:metadata.toolgate_currency=usd", + "checkout_session:metadata.tollgate_currency=usd", ]); const webhook = await withTimeout( diff --git a/integrations/x402-comparison/NOTES.md b/integrations/x402-comparison/NOTES.md index 8d104be..807bac1 100644 --- a/integrations/x402-comparison/NOTES.md +++ b/integrations/x402-comparison/NOTES.md @@ -11,9 +11,9 @@ A typical x402-paid MCP flow is: That pattern is useful because the payment boundary is explicit and native to x402. -## What Toolgate Adds Above x402 +## What Tollgate Adds Above x402 -Toolgate does not replace that challenge flow. It wraps the paid action and adds recovery semantics around it: +Tollgate does not replace that challenge flow. It wraps the paid action and adds recovery semantics around it: - fallback response instead of only a hard stop - idempotent replay so the same paid retry does not double charge @@ -27,7 +27,7 @@ Hard x402 behavior: - best when you want a strict paywall and a canonical payment challenge - weak on degraded responses and retry ergonomics by itself -Toolgate over x402: +Tollgate over x402: - still preserves the x402 payment proof flow - adds operational recovery for agents and MCP clients @@ -47,4 +47,4 @@ That scenario already shows the important distinction: - settlement can still be uncertain - the trace should say so -That is the point of the integration layer. Toolgate does not replace x402. It adds fallback, idempotency, traceability, and recovery above it. +That is the point of the integration layer. Tollgate does not replace x402. It adds fallback, idempotency, traceability, and recovery above it. diff --git a/integrations/x402-testnet/scenario.mjs b/integrations/x402-testnet/scenario.mjs index 1e9a2e0..519770e 100644 --- a/integrations/x402-testnet/scenario.mjs +++ b/integrations/x402-testnet/scenario.mjs @@ -149,7 +149,7 @@ async function runScenario() { process.env.X402_FACILITATOR_URL ?? "https://x402.org/facilitator", network: process.env.X402_NETWORK_CAIP2 ?? "eip155:84532", details: - "Toolgate can generate the challenge internally, but this repo still needs a signed x402 proof from the recovery helpers or another client flow. Provide X402_PAYMENT_PROOF_JSON for the main path and optionally X402_PAYMENT_UNCERTAIN_PROOF_JSON for settlement_uncertain.", + "Tollgate can generate the challenge internally, but this repo still needs a signed x402 proof from the recovery helpers or another client flow. Provide X402_PAYMENT_PROOF_JSON for the main path and optionally X402_PAYMENT_UNCERTAIN_PROOF_JSON for settlement_uncertain.", explicitBlocker: "This test validates verify/settle with supplied proofs. It does not sign the client payment payload inline.", }, @@ -386,7 +386,7 @@ async function runScenario() { partial: !successProof, validated: [ "payment_missing_fallback", - "payment_required_through_toolgate", + "payment_required_through_tollgate", ...(successProof ? ["verify_and_settle", "duplicate_replay"] : []), ...(uncertainProof ? ["settlement_uncertain"] : []), ], @@ -420,10 +420,10 @@ async function runScenario() { trace: fallbackTrace, }, { - name: "payment_required_through_toolgate", + name: "payment_required_through_tollgate", result: paymentRequiredContent.paymentRequired, trace: paymentRequiredTrace, - note: "This test generates the Toolgate challenge through the MCP registration. Sign that challenge separately and feed the resulting proof back via X402_PAYMENT_PROOF_JSON.", + note: "This test generates the Tollgate challenge through the MCP registration. Sign that challenge separately and feed the resulting proof back via X402_PAYMENT_PROOF_JSON.", }, { name: "verify_and_settle", diff --git a/landing/index.html b/landing/index.html index d968415..6b82409 100644 --- a/landing/index.html +++ b/landing/index.html @@ -3,9 +3,9 @@ - Toolgate — Reliable paid MCP/tool calls + Tollgate — Reliable paid MCP/tool calls - + @@ -67,19 +67,6 @@ align-items: center; padding: 84px 0 96px; } - .eyebrow { - display: inline-flex; - align-items: center; - gap: 8px; - margin-bottom: 20px; - padding: 5px 10px; - border: 1px solid var(--line); - border-radius: 999px; - color: var(--muted); - font-size: 13px; - background: rgba(18, 22, 28, 0.74); - } - .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--accent); } h1 { margin: 0 0 18px; max-width: 760px; @@ -201,32 +188,31 @@
-
Developer preview · v0.3.0-beta.0

Reliable paid or quota-limited tool calls.

-

Toolgate is an open-source runtime for MCP and agent tools. It handles fallback, idempotent retries, metering, recovery, and execution traces so retries and edge cases do not double-charge or hard-fail.

+

Tollgate is an open-source runtime for MCP and agent tools. It handles fallback, idempotent retries, metering, recovery, and execution traces so retries and edge cases do not double-charge or hard-fail.

@@ -262,7 +248,7 @@

Reliable paid or quota-limited tool calls.

Run the repo demo

Clone the repository to run the local demo. The first-run path uses the in-memory ledger and does not require Stripe, x402, MPP, wallets, webhooks, hosted APIs, or environment variables.

-
git clone https://github.com/tkorkmazeth/toolgate.git
cd toolgate
npm install
npm run build
npm run example:local
+
git clone https://github.com/niceberginc/tollgate.git
cd tollgate
npm install
npm run build
npm run example:local
@@ -270,7 +256,7 @@

Run the repo demo

Runtime behavior

-

Toolgate wraps the call boundary where payment, quota, retries, execution, and recovery meet.

+

Tollgate wraps the call boundary where payment, quota, retries, execution, and recovery meet.

Fallback

Return a degraded result instead of forcing every unpaid call into a hard failure.

Idempotency

Replay completed results for duplicate request keys without charging twice.

@@ -286,13 +272,13 @@

Runtime behavior

Minimal usage

-

Start with `ToolGate`, `InMemoryLedger`, and `usd()`; add rail adapters later.

+

Start with `TollGate`, `InMemoryLedger`, and `usd()`; add rail adapters later.

-
import { ToolGate, InMemoryLedger, usd } from "@tkorkmaz/toolgate";
+          
import { TollGate, InMemoryLedger, usd } from "@niceberglabs/tollgate";
 
 const ledger = new InMemoryLedger();
-const gate = new ToolGate({ publisherKey: "tg_local_demo", ledger });
+const gate = new TollGate({ publisherKey: "tg_local_demo", ledger });
 
 const search = gate.paidTool({
   name: "premium_search",
@@ -318,13 +304,13 @@ 

Minimal usage

MCP wrapper

-

Use `createMcpAdapter()` to expose a paid tool through an MCP server. `_meta.toolgate` carries receipt, fallback, and payment-required metadata.

+

Use `createMcpAdapter()` to expose a paid tool through an MCP server. `_meta.tollgate` carries receipt, fallback, and payment-required metadata.

See minimal usage →

-
import { ToolGate, createMcpAdapter, usd } from "@tkorkmaz/toolgate";
+          
import { TollGate, createMcpAdapter, usd } from "@niceberglabs/tollgate";
 
-const gate = new ToolGate({ publisherKey: "tg_local_demo" });
+const gate = new TollGate({ publisherKey: "tg_local_demo" });
 const mcp = createMcpAdapter(gate, {
   getCallerId: (_args, extra) => extra?.sessionId ?? "demo-user",
 });
@@ -365,8 +351,8 @@ 

Status

@@ -375,18 +361,18 @@

Docs