agentwallet-mcp 1.13.13 → 1.13.15
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/build/index.js +7 -3
- package/build/local-solana.js +17 -2
- package/package.json +5 -2
package/build/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { assertPublicUrl, safeFetch, finalUrlOf } from './ssrf-guard.js';
|
|
|
25
25
|
import { deriveX402Payment, isWithinCap, lookupTrustedDecimals, assertDeclaredDecimals, nativeDecimals, SOLANA_CHAIN_IDS, assetLabel, autopayAssetAllowed, autopayEnvCap, effectiveAutopayCap, maxAuthWindowSeconds, parseDecimalPins, approvalRefusal, authorizationResource, resolveNetworkChainId, normalizeRawAmount, parseAutopayAssets, assetSupportsExact, approvalResourceUrl, } from './x402-payment.js';
|
|
26
26
|
import { createHash } from 'node:crypto';
|
|
27
27
|
import { isLocalMode, getLocalAddress, localWalletRecord, localSend, localNativeBalance, localTokenBalance, localSignMessage, resolveRpcUrl, } from './local-wallet.js';
|
|
28
|
-
import { localSignAuthorization, localEthCall, localGetCode, localSignPermit2Upto, probeTokenDecimals } from './local-wallet.js';
|
|
28
|
+
import { localSignAuthorization, localEthCall, localGetCode, localSignPermit2Upto, probeTokenDecimals, assertRpcServesChain } from './local-wallet.js';
|
|
29
29
|
import { WRAPPED_NATIVE } from './wrapped-native.js';
|
|
30
30
|
import { buildUptoAuthorization, uptoPayload, permit2AllowanceCalldata, permit2ApproveCalldata, decodeUint, permit2Address, } from './x402-permit2.js';
|
|
31
31
|
import { assessTokenRisk } from './token-risk.js';
|
|
@@ -827,7 +827,7 @@ function resolveChainId(network) {
|
|
|
827
827
|
const AddressSchema = z.string().regex(/^(0x[a-fA-F0-9]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$/, 'Must be a 0x-prefixed 40-hex EVM address or a base58 Solana address');
|
|
828
828
|
const server = new McpServer({
|
|
829
829
|
name: 'agentwallet',
|
|
830
|
-
version: '1.13.
|
|
830
|
+
version: '1.13.15',
|
|
831
831
|
}, {
|
|
832
832
|
instructions: `AgentWallet gives AI agents their own blockchain wallets. ${anyLocalMode()
|
|
833
833
|
? 'This server runs in LOCAL (self-custody) mode: the operator supplied the key, signing happens in this process, and the only spend guards are the environment caps (AGENTWALLET_MAX_TX_NATIVE / _TOKEN / _SOL per transaction, AGENTWALLET_MAX_AUTOPAY and AGENTWALLET_AUTOPAY_ASSETS for x402, AGENTWALLET_X402_MAX_TIMEOUT for authorization windows). There is no server-side pause, daily limit or approval email; pause_wallet, unpause_wallet and delete_wallet are refused.'
|
|
@@ -1347,6 +1347,9 @@ tool('get_token_info', 'Get the name, symbol, and decimals of any ERC-20 token b
|
|
|
1347
1347
|
token: z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe('ERC-20 token contract address'),
|
|
1348
1348
|
chain_id: z.number().int().describe('Chain ID'),
|
|
1349
1349
|
}, async ({ token, chain_id }) => {
|
|
1350
|
+
// A node serving another chain used to be swallowed by the three catch() calls below into name "Unknown" (round 6); it is an error.
|
|
1351
|
+
if (isLocalMode() && !isSolanaChain(chain_id))
|
|
1352
|
+
await assertRpcServesChain(chain_id);
|
|
1350
1353
|
if (isSolanaChain(chain_id)) {
|
|
1351
1354
|
throw new Error('get_token_info is not supported on Solana. Use Solana token metadata programs to query SPL token details.');
|
|
1352
1355
|
}
|
|
@@ -1914,7 +1917,8 @@ tool('pay_x402', 'Handle an x402 payment flow. Fetches a URL, and if the server
|
|
|
1914
1917
|
let claimedAboveMax = false;
|
|
1915
1918
|
if (claimedStr && /^\d+(\.\d+)?$/.test(claimedStr)) {
|
|
1916
1919
|
try {
|
|
1917
|
-
|
|
1920
|
+
// An integer claim is read as base units, a decimal one as human units; reading an integer both ways flagged every honest base-unit claim (round 6).
|
|
1921
|
+
claimedAboveMax = /^\d+$/.test(claimedStr) ? BigInt(claimedStr) > BigInt(rawAmount) : BigInt(parseUnits(claimedStr, trustedDecimals)) > BigInt(rawAmount);
|
|
1918
1922
|
}
|
|
1919
1923
|
catch {
|
|
1920
1924
|
claimedAboveMax = false;
|
package/build/local-solana.js
CHANGED
|
@@ -99,13 +99,28 @@ const DEFAULT_SOLANA_RPC = {
|
|
|
99
99
|
901: 'https://api.devnet.solana.com',
|
|
100
100
|
902: 'https://api.testnet.solana.com',
|
|
101
101
|
};
|
|
102
|
+
/** A Solana RPC over plain http to anything but loopback exposes every query and lets an on-path host answer; refused like an EVM one (round 7). */
|
|
103
|
+
function assertSolanaScheme(url, name) {
|
|
104
|
+
let u;
|
|
105
|
+
try {
|
|
106
|
+
u = new URL(url);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
throw new Error(`${name} is not a URL: "${url}".`);
|
|
110
|
+
}
|
|
111
|
+
const loopback = u.hostname === 'localhost' || u.hostname === '127.0.0.1' || u.hostname === '[::1]';
|
|
112
|
+
if (u.protocol !== 'https:' && !(u.protocol === 'http:' && loopback)) {
|
|
113
|
+
throw new Error(`${name} must be https (got ${u.protocol}//${u.host}); plain http is allowed only for localhost.`);
|
|
114
|
+
}
|
|
115
|
+
return url;
|
|
116
|
+
}
|
|
102
117
|
export function resolveSolanaRpc(chainId = 900) {
|
|
103
118
|
const perChain = (process.env[`AGENTWALLET_SOLANA_RPC_${chainId}`] || '').trim();
|
|
104
119
|
if (perChain)
|
|
105
|
-
return perChain;
|
|
120
|
+
return assertSolanaScheme(perChain, `AGENTWALLET_SOLANA_RPC_${chainId}`);
|
|
106
121
|
const explicit = (process.env.AGENTWALLET_SOLANA_RPC || '').trim();
|
|
107
122
|
if (explicit)
|
|
108
|
-
return explicit;
|
|
123
|
+
return assertSolanaScheme(explicit, 'AGENTWALLET_SOLANA_RPC');
|
|
109
124
|
if (Object.keys(process.env).some(k => /^AGENTWALLET_SOLANA_RPC_\d+$/.test(k) && (process.env[k] || '').trim())) {
|
|
110
125
|
throw new Error(`No Solana RPC for chain ${chainId}: AGENTWALLET_SOLANA_RPC_<chainId> is set for another cluster, so the public default is not used. Set AGENTWALLET_SOLANA_RPC_${chainId} or AGENTWALLET_SOLANA_RPC.`);
|
|
111
126
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentwallet-mcp",
|
|
3
3
|
"mcpName": "io.github.hifriendbot/agentwallet",
|
|
4
|
-
"repository": {
|
|
5
|
-
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/hifriendbot/agentwallet-mcp.git"
|
|
7
|
+
},
|
|
8
|
+
"version": "1.13.15",
|
|
6
9
|
"description": "MCP server for AgentWallet: self-custody local signing on EVM and Solana, or hosted wallets. Sign, broadcast, pay x402 invoices, and accept x402 payments.",
|
|
7
10
|
"type": "module",
|
|
8
11
|
"main": "build/index.js",
|