@furlpay/travel-mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Furlpay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # @furlpay/travel-mcp — FurlPay Travels
2
+
3
+ The payment & orchestration layer for **agentic travel**. This MCP server composes
4
+ [Travala's Travel MCP](https://www.travala.com/blog/introducing-travalas-agentic-ai-travel-protocol/)
5
+ (search 2.2M+ hotels + flights) with [FurlPay](https://furlpay.com)'s payment rails
6
+ (pay), so an AI agent can **search, budget-check, pay, and book travel autonomously.**
7
+
8
+ Two payment routes, chosen per booking:
9
+
10
+ - **Travala / crypto-native** → an **x402 payment proof**, settled in gasless
11
+ **USDC on Base**. Accrues the **10% cbBTC developer rebate** Travala pays on
12
+ MCP-driven bookings.
13
+ - **Legacy Web2 merchant** (Airbnb, Skyscanner…) → a **single-use Visa virtual
14
+ card**, **MCC-locked** to travel and limited to the booking total.
15
+
16
+ **Clone-and-run**: with no keys, search and payment simulate end-to-end (no
17
+ network) so you can drive the whole loop offline. Zero runtime dependencies.
18
+
19
+ Maintained by [FurlPay](https://furlpay.com) · MIT licensed.
20
+
21
+ ## Use as an MCP server
22
+
23
+ ```jsonc
24
+ {
25
+ "mcpServers": {
26
+ "furlpay-travels": {
27
+ "command": "npx",
28
+ "args": ["-y", "@furlpay/travel-mcp"],
29
+ "env": {
30
+ "FURLPAY_API_KEY": "fp_live_sk_...", // omit for demo mode
31
+ "TRAVALA_API_KEY": "...", // omit for demo inventory
32
+ "FURLPAY_DEVELOPER_WALLET": "0xYourWallet" // receives the 7% cbBTC split
33
+ }
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ ### Tools
40
+
41
+ | Tool | What it does |
42
+ | --- | --- |
43
+ | `travel_search_stays` | Search Travala hotels for a city + date range |
44
+ | `travel_search_flights` | Search flights for a route + date |
45
+ | `travel_set_agent_budget` | Cap an agent's USDC travel spend |
46
+ | **`travel_authorize_booking`** | Pay a booking — x402/USDC (Travala) **or** single-use MCC-locked Visa VCN (legacy) |
47
+ | `travel_confirm_booking` | Confirm after passkey step-up |
48
+ | `travel_cancel_booking` | Cancel & void the authorization |
49
+ | `travel_list_rebates` | Accumulated 10% cbBTC rebates (7% dev / 3% treasury) |
50
+
51
+ ## Use as a library
52
+
53
+ ```ts
54
+ import { TravelClient, MCC } from "@furlpay/travel-mcp";
55
+
56
+ const travel = new TravelClient({ developerWallet: "0xDev" });
57
+
58
+ const stays = await travel.searchStays({
59
+ city: "London", checkIn: "2026-08-01", checkOut: "2026-08-04", maxNightlyUsd: 200,
60
+ });
61
+
62
+ travel.setAgentBudget("agent_1", 1000);
63
+
64
+ // Crypto-native route → x402/USDC on Base + 10% cbBTC rebate
65
+ const booking = await travel.authorizeBooking({
66
+ amountUsd: stays[0].totalUsd, source: "travala", agentId: "agent_1", reference: stays[0].quoteId,
67
+ });
68
+ // booking.authorization.x402 · booking.rebate.developerUsd
69
+
70
+ // Legacy merchant route → single-use MCC-locked Visa VCN
71
+ const legacy = await travel.authorizeBooking({ amountUsd: 130, source: "legacy", mcc: MCC.LODGING });
72
+ // legacy.authorization.card = { last4, mccWhitelist, singleUse, limitUsd }
73
+
74
+ travel.listRebates(); // { developerTotalUsd, treasuryTotalUsd, accruals }
75
+ ```
76
+
77
+ ## How the routes map to reality
78
+
79
+ | Route | Rail | Why |
80
+ | --- | --- | --- |
81
+ | `travala` | x402 → gasless USDC on **Base**, ~$0.01/booking | The rail Travala's protocol accepts directly; earns the cbBTC rebate |
82
+ | `legacy` | Single-use **Visa VCN**, MCC-locked (7011 lodging, 4511 airlines, 7512 car rental) | Reaches Web2 travel merchants Travala doesn't cover; card can only spend on travel, up to the booking total |
83
+
84
+ FurlPay's value here is the layer Travala doesn't provide: **agent spend budgets,
85
+ multi-token funding, VCN issuing for legacy merchants, and rebate accounting.**
86
+
87
+ ## Run the demo
88
+
89
+ ```sh
90
+ npm run example # full search → pay → book → rebate flow, demo mode
91
+ npm start # run the MCP server on stdio
92
+ ```
93
+
94
+ ## Test
95
+
96
+ ```sh
97
+ npm test # tsc build + node --test (demo mode, no network)
98
+ ```
99
+
100
+ The suite pins the contract: deterministic search, the x402 route's proof + exact
101
+ 10%/(7/3) rebate math, the legacy route's single-use MCC-locked VCN, budget
102
+ enforcement, the confirm/cancel lifecycle, rebate aggregation (excluding
103
+ cancellations), and well-formed MCP tools.
104
+
105
+ ## Scope
106
+
107
+ This server orchestrates Travala search and FurlPay payments — it does not custody
108
+ funds or settle on-chain itself; x402 settlement and card issuing happen in the
109
+ FurlPay API, and inventory/fulfilment in Travala. Point it at your own accounts and
110
+ it books on your behalf. Issuing travel cards and handling refunds carries
111
+ money-transmission/merchant-compliance obligations — wire in FurlPay's compliance
112
+ engine before going live.
113
+
114
+ ## License
115
+
116
+ MIT
@@ -0,0 +1,24 @@
1
+ import { Authorization, BookingSource } from "./types";
2
+ export declare const MCC: {
3
+ readonly LODGING: "7011";
4
+ readonly AIRLINES: "4511";
5
+ readonly CAR_RENTAL: "7512";
6
+ readonly TRAVEL_AGENCY: "4722";
7
+ };
8
+ export declare class FurlPayPay {
9
+ private readonly apiKey?;
10
+ private readonly baseUrl;
11
+ private readonly fetchImpl;
12
+ constructor(apiKey?: string | undefined, baseUrl?: string, fetchImpl?: typeof fetch);
13
+ get live(): boolean;
14
+ /** Authorize a booking on the chosen route, returning the payment credential. */
15
+ authorize(params: {
16
+ route: BookingSource;
17
+ amountUsd: number;
18
+ currency?: string;
19
+ mcc?: string;
20
+ }): Promise<Authorization>;
21
+ private authorizeX402;
22
+ private issueVirtualCard;
23
+ private post;
24
+ }
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FurlPayPay = exports.MCC = void 0;
4
+ /**
5
+ * FurlPay payment side of the composition. Produces the credential a booking
6
+ * needs, per route:
7
+ *
8
+ * - travala (crypto-native): an x402 payment proof, settled in gasless USDC on
9
+ * Base — the rail Travala's protocol accepts directly.
10
+ * - legacy (Web2 merchants like Airbnb/Skyscanner): a single-use Visa virtual
11
+ * card number, MCC-locked to travel and limited to the booking total.
12
+ *
13
+ * With no FurlPay key set, both routes simulate (no network) so the flow is fully
14
+ * runnable offline. Card PANs are never real in demo mode.
15
+ */
16
+ const DEFAULT_BASE = "https://api.furlpay.com/v1";
17
+ // Common travel MCCs. 7011 = Lodging/Hotels, 4511 = Airlines, 7512 = Car Rental,
18
+ // 4722 = Travel Agencies.
19
+ exports.MCC = { LODGING: "7011", AIRLINES: "4511", CAR_RENTAL: "7512", TRAVEL_AGENCY: "4722" };
20
+ function rid(prefix) {
21
+ return prefix + Math.random().toString(36).slice(2, 10);
22
+ }
23
+ class FurlPayPay {
24
+ constructor(apiKey, baseUrl = process.env.FURLPAY_API_BASE || DEFAULT_BASE, fetchImpl = globalThis.fetch) {
25
+ this.apiKey = apiKey;
26
+ this.baseUrl = baseUrl;
27
+ this.fetchImpl = fetchImpl;
28
+ }
29
+ get live() {
30
+ return Boolean(this.apiKey);
31
+ }
32
+ /** Authorize a booking on the chosen route, returning the payment credential. */
33
+ async authorize(params) {
34
+ const currency = (params.currency ?? "USDC").toUpperCase();
35
+ if (params.route === "travala")
36
+ return this.authorizeX402(params.amountUsd, currency);
37
+ return this.issueVirtualCard(params.amountUsd, currency, params.mcc ?? exports.MCC.LODGING);
38
+ }
39
+ async authorizeX402(amountUsd, currency) {
40
+ if (!this.live) {
41
+ return {
42
+ route: "travala",
43
+ amount: amountUsd,
44
+ currency,
45
+ x402: { proof: rid("x402_sim_"), network: "base", token: "USDC", settlementTx: rid("tx_sim_") },
46
+ simulated: true,
47
+ };
48
+ }
49
+ const settled = await this.post("/x402/settle", { amount: amountUsd, token: "USDC", destination: "travala" });
50
+ return {
51
+ route: "travala",
52
+ amount: amountUsd,
53
+ currency,
54
+ x402: {
55
+ proof: settled.payment_header || settled.proof,
56
+ network: settled.network || "base",
57
+ token: "USDC",
58
+ settlementTx: settled.tx,
59
+ },
60
+ };
61
+ }
62
+ async issueVirtualCard(amountUsd, currency, mcc) {
63
+ if (!this.live) {
64
+ const last4 = String(1000 + Math.floor(Math.random() * 9000)).slice(-4);
65
+ return {
66
+ route: "legacy",
67
+ amount: amountUsd,
68
+ currency,
69
+ card: {
70
+ id: rid("card_sim_"),
71
+ last4,
72
+ expMonth: 12,
73
+ expYear: new Date().getUTCFullYear() + 3,
74
+ mccWhitelist: [mcc],
75
+ singleUse: true,
76
+ limitUsd: amountUsd,
77
+ },
78
+ simulated: true,
79
+ };
80
+ }
81
+ const card = await this.post("/cards", {
82
+ type: "virtual",
83
+ currency,
84
+ limit: amountUsd,
85
+ mcc_whitelist: [mcc],
86
+ single_use: true,
87
+ });
88
+ return {
89
+ route: "legacy",
90
+ amount: amountUsd,
91
+ currency,
92
+ card: {
93
+ id: card.id,
94
+ last4: card.last4,
95
+ expMonth: card.exp_month,
96
+ expYear: card.exp_year,
97
+ mccWhitelist: card.mcc_whitelist ?? [mcc],
98
+ singleUse: true,
99
+ limitUsd: amountUsd,
100
+ },
101
+ };
102
+ }
103
+ async post(path, body) {
104
+ const res = await this.fetchImpl(`${this.baseUrl}${path}`, {
105
+ method: "POST",
106
+ headers: { Authorization: `Bearer ${this.apiKey}`, "Content-Type": "application/json" },
107
+ body: JSON.stringify(body),
108
+ });
109
+ const text = await res.text();
110
+ const json = text ? JSON.parse(text) : {};
111
+ if (!res.ok)
112
+ throw new Error(json.error || `FurlPay HTTP ${res.status}`);
113
+ return json;
114
+ }
115
+ }
116
+ exports.FurlPayPay = FurlPayPay;
@@ -0,0 +1,6 @@
1
+ export { TravelClient, MCC } from "./travel";
2
+ export { TravalaClient } from "./travala";
3
+ export { FurlPayPay } from "./furlpay";
4
+ export { buildTools } from "./tools";
5
+ export type { McpTool } from "./tools";
6
+ export * from "./types";
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.buildTools = exports.FurlPayPay = exports.TravalaClient = exports.MCC = exports.TravelClient = void 0;
18
+ var travel_1 = require("./travel");
19
+ Object.defineProperty(exports, "TravelClient", { enumerable: true, get: function () { return travel_1.TravelClient; } });
20
+ Object.defineProperty(exports, "MCC", { enumerable: true, get: function () { return travel_1.MCC; } });
21
+ var travala_1 = require("./travala");
22
+ Object.defineProperty(exports, "TravalaClient", { enumerable: true, get: function () { return travala_1.TravalaClient; } });
23
+ var furlpay_1 = require("./furlpay");
24
+ Object.defineProperty(exports, "FurlPayPay", { enumerable: true, get: function () { return furlpay_1.FurlPayPay; } });
25
+ var tools_1 = require("./tools");
26
+ Object.defineProperty(exports, "buildTools", { enumerable: true, get: function () { return tools_1.buildTools; } });
27
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/server.js ADDED
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /**
5
+ * FurlPay Travels MCP server (stdio transport, JSON-RPC 2.0).
6
+ *
7
+ * Composes Travala's Travel MCP (search) with FurlPay's payment rails (pay) and
8
+ * exposes them as MCP tools for Claude, Cursor, and AI agents. Runs on demo data
9
+ * with no keys.
10
+ *
11
+ * Configure in an MCP client:
12
+ * {
13
+ * "mcpServers": {
14
+ * "furlpay-travels": {
15
+ * "command": "npx", "args": ["-y", "@furlpay/travel-mcp"],
16
+ * "env": { "FURLPAY_API_KEY": "fp_live_sk_...", "TRAVALA_API_KEY": "..." }
17
+ * }
18
+ * }
19
+ * }
20
+ */
21
+ const tools_1 = require("./tools");
22
+ const travel_1 = require("./travel");
23
+ const client = new travel_1.TravelClient();
24
+ const tools = (0, tools_1.buildTools)(client);
25
+ function send(msg) {
26
+ process.stdout.write(JSON.stringify(msg) + "\n");
27
+ }
28
+ async function handle(line) {
29
+ let req;
30
+ try {
31
+ req = JSON.parse(line);
32
+ }
33
+ catch {
34
+ return;
35
+ }
36
+ const { id, method, params } = req;
37
+ try {
38
+ if (method === "initialize") {
39
+ return send({
40
+ jsonrpc: "2.0",
41
+ id,
42
+ result: {
43
+ protocolVersion: "2024-11-05",
44
+ capabilities: { tools: {} },
45
+ serverInfo: { name: "furlpay-travels", version: "0.1.0" },
46
+ },
47
+ });
48
+ }
49
+ if (method === "tools/list") {
50
+ return send({
51
+ jsonrpc: "2.0",
52
+ id,
53
+ result: { tools: tools.map(({ name, description, inputSchema }) => ({ name, description, inputSchema })) },
54
+ });
55
+ }
56
+ if (method === "tools/call") {
57
+ const tool = tools.find((t) => t.name === params?.name);
58
+ if (!tool)
59
+ throw new Error(`Unknown tool: ${params?.name}`);
60
+ const result = await tool.handler(params.arguments || {});
61
+ return send({
62
+ jsonrpc: "2.0",
63
+ id,
64
+ result: { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] },
65
+ });
66
+ }
67
+ if (typeof method === "string" && method.startsWith("notifications/"))
68
+ return;
69
+ throw new Error(`Method not found: ${method}`);
70
+ }
71
+ catch (e) {
72
+ send({ jsonrpc: "2.0", id, error: { code: -32000, message: e.message } });
73
+ }
74
+ }
75
+ let buffer = "";
76
+ process.stdin.setEncoding("utf8");
77
+ process.stdin.on("data", (chunk) => {
78
+ buffer += chunk;
79
+ let idx;
80
+ while ((idx = buffer.indexOf("\n")) >= 0) {
81
+ const line = buffer.slice(0, idx).trim();
82
+ buffer = buffer.slice(idx + 1);
83
+ if (line)
84
+ void handle(line);
85
+ }
86
+ });
87
+ process.stderr.write(`furlpay-travels MCP ready (${client.live ? "live" : "demo"} mode)\n`);
@@ -0,0 +1,9 @@
1
+ import { TravelClient } from "./travel";
2
+ export interface McpTool {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: Record<string, unknown>;
6
+ handler: (args: any) => Promise<unknown> | unknown;
7
+ }
8
+ /** Build the MCP toolset bound to a TravelClient. */
9
+ export declare function buildTools(client: TravelClient): McpTool[];
package/dist/tools.js ADDED
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildTools = buildTools;
4
+ /** Build the MCP toolset bound to a TravelClient. */
5
+ function buildTools(client) {
6
+ return [
7
+ {
8
+ name: "travel_search_stays",
9
+ description: "Search Travala's 2.2M+ hotels (Marriott, Hilton, IHG, …) for a city and date range. Returns quotes with a quoteId to book.",
10
+ inputSchema: {
11
+ type: "object",
12
+ properties: {
13
+ city: { type: "string" },
14
+ checkIn: { type: "string", description: "YYYY-MM-DD" },
15
+ checkOut: { type: "string", description: "YYYY-MM-DD" },
16
+ maxNightlyUsd: { type: "number", description: "Optional nightly price cap in USD" },
17
+ guests: { type: "number" },
18
+ },
19
+ required: ["city", "checkIn", "checkOut"],
20
+ },
21
+ handler: (a) => client.searchStays(a),
22
+ },
23
+ {
24
+ name: "travel_search_flights",
25
+ description: "Search flights via Travala for a route and date. Returns quotes with a quoteId.",
26
+ inputSchema: {
27
+ type: "object",
28
+ properties: {
29
+ from: { type: "string", description: "Origin IATA code" },
30
+ to: { type: "string", description: "Destination IATA code" },
31
+ date: { type: "string", description: "YYYY-MM-DD" },
32
+ },
33
+ required: ["from", "to", "date"],
34
+ },
35
+ handler: (a) => client.searchFlights(a),
36
+ },
37
+ {
38
+ name: "travel_set_agent_budget",
39
+ description: "Set a USDC spend cap for an agent before it books autonomously.",
40
+ inputSchema: {
41
+ type: "object",
42
+ properties: { agentId: { type: "string" }, limitUsd: { type: "number" } },
43
+ required: ["agentId", "limitUsd"],
44
+ },
45
+ handler: (a) => {
46
+ client.setAgentBudget(a.agentId, a.limitUsd);
47
+ return client.getAgentBudget(a.agentId);
48
+ },
49
+ },
50
+ {
51
+ name: "travel_authorize_booking",
52
+ description: "Authorize payment for a booking within the agent's budget. source='travala' pays via x402/USDC on Base and accrues the 10% cbBTC rebate; source='legacy' issues a single-use, MCC-locked Visa virtual card for Web2 merchants (Airbnb, Skyscanner).",
53
+ inputSchema: {
54
+ type: "object",
55
+ properties: {
56
+ amountUsd: { type: "number" },
57
+ source: { type: "string", enum: ["travala", "legacy"] },
58
+ currency: { type: "string", description: "Default USDC" },
59
+ mcc: { type: "string", description: "Merchant Category Code lock for the legacy route, e.g. 7011 (lodging)" },
60
+ agentId: { type: "string" },
61
+ reference: { type: "string", description: "Quote/booking reference" },
62
+ },
63
+ required: ["amountUsd", "source"],
64
+ },
65
+ handler: (a) => client.authorizeBooking(a),
66
+ },
67
+ {
68
+ name: "travel_confirm_booking",
69
+ description: "Confirm an authorized booking (after passkey step-up in a real flow).",
70
+ inputSchema: {
71
+ type: "object",
72
+ properties: { bookingId: { type: "string" } },
73
+ required: ["bookingId"],
74
+ },
75
+ handler: (a) => client.confirmBooking(a.bookingId),
76
+ },
77
+ {
78
+ name: "travel_cancel_booking",
79
+ description: "Cancel a booking and void its authorization.",
80
+ inputSchema: {
81
+ type: "object",
82
+ properties: { bookingId: { type: "string" } },
83
+ required: ["bookingId"],
84
+ },
85
+ handler: (a) => client.cancelBooking(a.bookingId),
86
+ },
87
+ {
88
+ name: "travel_list_rebates",
89
+ description: "List accumulated 10% cbBTC developer rebates from Travala-routed bookings (7% developer / 3% treasury split).",
90
+ inputSchema: { type: "object", properties: {}, additionalProperties: false },
91
+ handler: () => client.listRebates(),
92
+ },
93
+ ];
94
+ }
@@ -0,0 +1,23 @@
1
+ import { Flight, Stay } from "./types";
2
+ export declare class TravalaClient {
3
+ private readonly url;
4
+ private readonly apiKey?;
5
+ private readonly fetchImpl;
6
+ constructor(url?: string, apiKey?: string | undefined, fetchImpl?: typeof fetch);
7
+ get live(): boolean;
8
+ searchStays(params: {
9
+ city: string;
10
+ checkIn: string;
11
+ checkOut: string;
12
+ maxNightlyUsd?: number;
13
+ guests?: number;
14
+ }): Promise<Stay[]>;
15
+ searchFlights(params: {
16
+ from: string;
17
+ to: string;
18
+ date: string;
19
+ }): Promise<Flight[]>;
20
+ private call;
21
+ private demoStays;
22
+ private demoFlights;
23
+ }