gtxagent-mcp 0.3.0 → 0.3.1

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  MCP bridge for the GTXAgent x402 tools. Two modes:
4
4
 
5
- - **Wallet (zero account, default):** `gtxagent-mcp-wallet` runs locally and pays each call from your
5
+ - **Wallet (zero account, default):** `gtxagent-mcp` runs locally and pays each call from your
6
6
  own Base wallet. Five decision tools, no signup, no tenant key.
7
7
  - **Hosted:** `gtxagent-mcp` forwards to `https://app.gtxagent.com/mcp` with a prepaid tenant key.
8
8
  Eleven data tools, no wallet in the client.
@@ -14,7 +14,7 @@ MCP process and never leaves it; the x402 payment is a signed EIP-3009 authoriza
14
14
 
15
15
  ```bash
16
16
  export GTX_X402_BUYER_KEY=0x...
17
- npx -y gtxagent-mcp-wallet
17
+ npx -y gtxagent-mcp
18
18
  ```
19
19
 
20
20
  ### Claude Desktop
@@ -27,7 +27,7 @@ npx -y gtxagent-mcp-wallet
27
27
  "mcpServers": {
28
28
  "gtxagent": {
29
29
  "command": "npx",
30
- "args": ["-y", "gtxagent-mcp-wallet"],
30
+ "args": ["-y", "gtxagent-mcp"],
31
31
  "env": {
32
32
  "GTX_X402_BUYER_KEY": "0x..."
33
33
  }
@@ -45,7 +45,7 @@ npx -y gtxagent-mcp-wallet
45
45
  "mcpServers": {
46
46
  "gtxagent": {
47
47
  "command": "npx",
48
- "args": ["-y", "gtxagent-mcp-wallet"],
48
+ "args": ["-y", "gtxagent-mcp"],
49
49
  "env": {
50
50
  "GTX_X402_BUYER_KEY": "0x..."
51
51
  }
@@ -69,7 +69,7 @@ transaction exists. Without `from`, a balance-dependent call is reported as skip
69
69
 
70
70
  ## Hosted mode
71
71
 
72
- The hosted path needs no wallet but a tenant key:
72
+ The same command runs the hosted path when `GTX_MCP_KEY` is set (no wallet needed):
73
73
 
74
74
  ```bash
75
75
  npx -y gtxagent-mcp
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ // gtxagent-mcp — one entry point, two modes.
3
+ //
4
+ // GTX_X402_BUYER_KEY set -> wallet bridge (zero account, pays per call from your Base wallet)
5
+ // GTX_MCP_KEY set -> hosted bridge (prepaid tenant key, eleven data tools)
6
+ //
7
+ // The mode is chosen by the environment so `npx -y gtxagent-mcp` is the only command a user needs.
8
+ import { spawn } from 'node:child_process';
9
+
10
+ const wallet = (process.env.GTX_X402_BUYER_KEY ?? '').trim();
11
+ const hosted = (process.env.GTX_MCP_KEY ?? '').trim();
12
+
13
+ if (wallet === '' && hosted === '') {
14
+ console.error([
15
+ 'gtxagent-mcp: no credential.',
16
+ 'Wallet mode (no signup): export GTX_X402_BUYER_KEY=0x... (a funded Base wallet).',
17
+ 'Hosted mode: export GTX_MCP_KEY=gtx_mcp_... (a prepaid tenant key).',
18
+ ].join('\n'));
19
+ process.exit(1);
20
+ }
21
+
22
+ const target = wallet !== '' ? './gtxagent-mcp-wallet.mjs' : './gtxagent-mcp.mjs';
23
+ const child = spawn(process.execPath, [new URL(target, import.meta.url).pathname], {
24
+ stdio: 'inherit',
25
+ env: process.env,
26
+ });
27
+ child.on('exit', (code, signal) => process.exit(code ?? (signal ? 1 : 0)));
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ // gtxagent-mcp — stdio MCP bridge to the hosted GTXAgent x402 tools.
3
+ //
4
+ // The client (Claude Desktop, Cursor, any MCP host) speaks stdio to this process; this process
5
+ // speaks Streamable HTTP to https://app.gtxagent.com/mcp with the tenant's prepaid key. The key
6
+ // stays in the environment and is never printed. No wallet, no local GTX account.
7
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
8
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
9
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
10
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
11
+ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
12
+
13
+ const VERSION = '0.2.0';
14
+ const DEFAULT_URL = 'https://app.gtxagent.com/mcp';
15
+
16
+ function fail(message) {
17
+ console.error(`gtxagent-mcp: ${message}`);
18
+ process.exit(1);
19
+ }
20
+
21
+ function endpoint() {
22
+ const raw = process.env.GTX_MCP_URL?.trim() || DEFAULT_URL;
23
+ let url;
24
+ try {
25
+ url = new URL(raw);
26
+ } catch {
27
+ fail('GTX_MCP_URL is not a valid URL');
28
+ }
29
+ const local = url.protocol === 'http:' && (url.hostname === '127.0.0.1' || url.hostname === 'localhost');
30
+ if (url.protocol !== 'https:' && !local) fail('GTX_MCP_URL must be https (http is allowed only on localhost)');
31
+ return url;
32
+ }
33
+
34
+ const key = process.env.GTX_MCP_KEY?.trim();
35
+ if (!key) fail('GTX_MCP_KEY is required — issue a gtx_mcp_… key for your tenant first');
36
+ if (!/^gtx_mcp_[0-9a-f]{64}$/.test(key)) fail('GTX_MCP_KEY is malformed (expected gtx_mcp_ followed by 64 hex characters)');
37
+
38
+ const remote = new Client({ name: 'gtxagent-mcp', version: VERSION }, { capabilities: {} });
39
+ const transport = new StreamableHTTPClientTransport(endpoint(), {
40
+ requestInit: { headers: { Authorization: ['Bearer', key].join(' ') } },
41
+ });
42
+
43
+ try {
44
+ await remote.connect(transport);
45
+ } catch (error) {
46
+ // The SDK error can include the URL, never the Authorization header; keep the message short.
47
+ fail(`cannot reach the hosted endpoint (${error instanceof Error ? error.message : 'unknown error'})`);
48
+ }
49
+
50
+ const server = new Server(
51
+ { name: 'gtxagent', version: VERSION },
52
+ { capabilities: { tools: {} } },
53
+ );
54
+
55
+ server.setRequestHandler(ListToolsRequestSchema, async (request) => remote.listTools(request.params));
56
+ server.setRequestHandler(CallToolRequestSchema, async (request) => remote.callTool(request.params));
57
+
58
+ const shutdown = async () => {
59
+ await remote.close().catch(() => undefined);
60
+ await server.close().catch(() => undefined);
61
+ process.exit(0);
62
+ };
63
+ process.on('SIGINT', shutdown);
64
+ process.on('SIGTERM', shutdown);
65
+
66
+ await server.connect(new StdioServerTransport());
67
+ console.error(`gtxagent-mcp ${VERSION}: connected to ${endpoint().href}`);
@@ -57970,7 +57970,7 @@ function missingKeyMessage() {
57970
57970
  "GTX_X402_BUYER_KEY is missing.",
57971
57971
  "1. Use a Base wallet funded with a little USDC (the calls cost $0.02-$0.05 each).",
57972
57972
  "2. Export its private key: export GTX_X402_BUYER_KEY=0x...",
57973
- "3. Run: npx -y gtxagent-mcp-wallet",
57973
+ "3. Run: npx -y gtxagent-mcp",
57974
57974
  "No signup and no GTX account are needed. The key stays in this process."
57975
57975
  ].join("\n");
57976
57976
  }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "gtxagent-mcp",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "mcpName": "com.gtxagent/gtxagent-mcp",
5
5
  "description": "GTXAgent x402 tools for MCP clients: a zero-account wallet bridge with five decision tools (verdict, preflight, preflight full, position risk, wallet dossier) and a hosted eleven-tool mode over one prepaid key.",
6
6
  "type": "module",
7
7
  "bin": {
8
- "gtxagent-mcp": "bin/gtxagent-mcp.mjs",
8
+ "gtxagent-mcp": "bin/gtxagent-mcp-dispatch.mjs",
9
+ "gtxagent-mcp-hosted": "bin/gtxagent-mcp.mjs",
9
10
  "gtxagent-mcp-wallet": "bin/gtxagent-mcp-wallet.mjs"
10
11
  },
11
12
  "files": [
package/server.json CHANGED
@@ -2,13 +2,13 @@
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "com.gtxagent/gtxagent-mcp",
4
4
  "description": "Eleven paid x402 crypto tools for AI agents (hosted) plus a zero-account wallet bridge with five decision tools.",
5
- "version": "0.3.0",
5
+ "version": "0.3.1",
6
6
  "websiteUrl": "https://gtxagent.com/agents.html",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "gtxagent-mcp",
11
- "version": "0.3.0",
11
+ "version": "0.3.1",
12
12
  "transport": {
13
13
  "type": "stdio"
14
14
  },