x402-proxy 0.4.2 → 0.5.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/CHANGELOG.md +14 -2
- package/dist/bin/cli.js +52 -25
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.5.0] - 2026-03-16
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- MCP proxy graduated from alpha to stable - removed alpha warning and label
|
|
14
|
+
- MCP proxy uses low-level `Server` class instead of `McpServer` to proxy raw JSON schemas verbatim without Zod conversion
|
|
15
|
+
- MCP proxy now forwards blob resource contents (previously only text was proxied)
|
|
16
|
+
- MCP content type widened to pass through all MCP content types (image, audio, resource_link) not just text
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- MCP proxy forwards `notifications/tools/list_changed` and `notifications/resources/list_changed` from remote servers so local clients stay in sync with dynamic tool/resource updates
|
|
20
|
+
|
|
10
21
|
## [0.4.2] - 2026-03-16
|
|
11
22
|
|
|
12
23
|
### Fixed
|
|
@@ -105,7 +116,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
105
116
|
### Added
|
|
106
117
|
- CLI binary accessible via `npx x402-proxy`
|
|
107
118
|
- `fetch` command (default) - curl-like HTTP client with automatic x402 payment
|
|
108
|
-
- `mcp` command
|
|
119
|
+
- `mcp` command - MCP stdio proxy with auto-payment for AI agents
|
|
109
120
|
- `setup` command - interactive onboarding wizard with @clack/prompts
|
|
110
121
|
- `status` command - config, wallet, and spend summary
|
|
111
122
|
- `wallet` subcommand with `info`, `history`, `fund`, `export-key`
|
|
@@ -129,7 +140,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
129
140
|
- `appendHistory` / `readHistory` / `calcSpend` - JSONL transaction history
|
|
130
141
|
- Re-exports from `@x402/fetch`, `@x402/svm`, `@x402/evm`
|
|
131
142
|
|
|
132
|
-
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.
|
|
143
|
+
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.0...HEAD
|
|
144
|
+
[0.5.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.4.2...v0.5.0
|
|
133
145
|
[0.4.2]: https://github.com/cascade-protocol/x402-proxy/compare/v0.4.1...v0.4.2
|
|
134
146
|
[0.4.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.4.0...v0.4.1
|
|
135
147
|
[0.4.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.3.2...v0.4.0
|
package/dist/bin/cli.js
CHANGED
|
@@ -330,7 +330,7 @@ Examples:
|
|
|
330
330
|
//#region src/commands/mcp.ts
|
|
331
331
|
const mcpCommand = buildCommand({
|
|
332
332
|
docs: {
|
|
333
|
-
brief: "Start MCP stdio proxy with x402 payment
|
|
333
|
+
brief: "Start MCP stdio proxy with x402 payment",
|
|
334
334
|
fullDescription: `Start an MCP stdio proxy with automatic x402 payment for AI agents.
|
|
335
335
|
|
|
336
336
|
Add to your MCP client config (Claude, Cursor, etc.):
|
|
@@ -376,7 +376,6 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
376
376
|
error("No wallet configured.\nRun:\n $ npx x402-proxy setup\n\nOr set X402_PROXY_WALLET_MNEMONIC");
|
|
377
377
|
process.exit(1);
|
|
378
378
|
}
|
|
379
|
-
warn("Note: MCP proxy is alpha - please report issues.");
|
|
380
379
|
dim(`x402-proxy MCP proxy -> ${remoteUrl}`);
|
|
381
380
|
if (wallet.evmAddress) dim(` EVM: ${wallet.evmAddress}`);
|
|
382
381
|
if (wallet.solanaAddress) dim(` Solana: ${wallet.solanaAddress}`);
|
|
@@ -399,13 +398,14 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
399
398
|
const { Client } = await import("@modelcontextprotocol/sdk/client/index.js");
|
|
400
399
|
const { SSEClientTransport } = await import("@modelcontextprotocol/sdk/client/sse.js");
|
|
401
400
|
const { StreamableHTTPClientTransport } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
402
|
-
const {
|
|
401
|
+
const { Server } = await import("@modelcontextprotocol/sdk/server/index.js");
|
|
403
402
|
const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
404
403
|
const { x402MCPClient } = await import("@x402/mcp");
|
|
405
|
-
const
|
|
404
|
+
const remoteClient = new Client({
|
|
406
405
|
name: "x402-proxy",
|
|
407
|
-
version: "0.
|
|
408
|
-
})
|
|
406
|
+
version: "0.5.0"
|
|
407
|
+
});
|
|
408
|
+
const x402Mcp = new x402MCPClient(remoteClient, x402PaymentClient, {
|
|
409
409
|
autoPayment: true,
|
|
410
410
|
onPaymentRequested: (ctx) => {
|
|
411
411
|
const accept = ctx.paymentRequired.accepts?.[0];
|
|
@@ -447,31 +447,58 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
447
447
|
error(`Failed to connect to ${remoteUrl}: ${err instanceof Error ? err.message : String(err)}`);
|
|
448
448
|
process.exit(1);
|
|
449
449
|
}
|
|
450
|
-
|
|
450
|
+
let { tools } = await x402Mcp.listTools();
|
|
451
451
|
dim(` ${tools.length} tools available`);
|
|
452
|
-
|
|
452
|
+
let remoteResources = [];
|
|
453
|
+
try {
|
|
454
|
+
remoteResources = (await x402Mcp.listResources()).resources;
|
|
455
|
+
if (remoteResources.length > 0) dim(` ${remoteResources.length} resources available`);
|
|
456
|
+
} catch {
|
|
457
|
+
dim(" Resources not available from remote");
|
|
458
|
+
}
|
|
459
|
+
const localServer = new Server({
|
|
453
460
|
name: "x402-proxy",
|
|
454
|
-
version: "0.
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
461
|
+
version: "0.5.0"
|
|
462
|
+
}, { capabilities: {
|
|
463
|
+
tools: tools.length > 0 ? {} : void 0,
|
|
464
|
+
resources: remoteResources.length > 0 ? {} : void 0
|
|
465
|
+
} });
|
|
466
|
+
const { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ToolListChangedNotificationSchema, ResourceListChangedNotificationSchema } = await import("@modelcontextprotocol/sdk/types.js");
|
|
467
|
+
localServer.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools.map((t) => ({
|
|
468
|
+
name: t.name,
|
|
469
|
+
description: t.description,
|
|
470
|
+
inputSchema: t.inputSchema,
|
|
471
|
+
annotations: t.annotations
|
|
472
|
+
})) }));
|
|
473
|
+
localServer.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
474
|
+
const { name, arguments: args } = request.params;
|
|
475
|
+
const result = await x402Mcp.callTool(name, args ?? {});
|
|
458
476
|
return {
|
|
459
477
|
content: result.content,
|
|
460
478
|
isError: result.isError
|
|
461
479
|
};
|
|
462
480
|
});
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
481
|
+
if (remoteResources.length > 0) {
|
|
482
|
+
localServer.setRequestHandler(ListResourcesRequestSchema, async () => ({ resources: remoteResources.map((r) => ({
|
|
483
|
+
name: r.name,
|
|
484
|
+
uri: r.uri,
|
|
485
|
+
description: r.description,
|
|
486
|
+
mimeType: r.mimeType
|
|
487
|
+
})) }));
|
|
488
|
+
localServer.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
489
|
+
return { contents: (await x402Mcp.readResource({ uri: request.params.uri })).contents.map((c) => ({ ...c })) };
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
remoteClient.setNotificationHandler(ToolListChangedNotificationSchema, async () => {
|
|
493
|
+
tools = (await x402Mcp.listTools()).tools;
|
|
494
|
+
dim(` Tools updated: ${tools.length} available`);
|
|
495
|
+
await localServer.notification({ method: "notifications/tools/list_changed" });
|
|
496
|
+
});
|
|
497
|
+
if (remoteResources.length > 0) remoteClient.setNotificationHandler(ResourceListChangedNotificationSchema, async () => {
|
|
498
|
+
remoteResources = (await x402Mcp.listResources()).resources;
|
|
499
|
+
dim(` Resources updated: ${remoteResources.length} available`);
|
|
500
|
+
await localServer.notification({ method: "notifications/resources/list_changed" });
|
|
501
|
+
});
|
|
475
502
|
const stdioTransport = new StdioServerTransport();
|
|
476
503
|
await localServer.connect(stdioTransport);
|
|
477
504
|
dim(" MCP proxy running (stdio)");
|
|
@@ -608,7 +635,7 @@ const routes = buildRouteMap({
|
|
|
608
635
|
});
|
|
609
636
|
const app = buildApplication(routes, {
|
|
610
637
|
name: "x402-proxy",
|
|
611
|
-
versionInfo: { currentVersion: "0.
|
|
638
|
+
versionInfo: { currentVersion: "0.5.0" },
|
|
612
639
|
scanner: { caseStyle: "allow-kebab-for-camel" }
|
|
613
640
|
});
|
|
614
641
|
|