@t402/mcp 2.6.0 → 2.7.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/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +302 -26
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/index.d.ts +12 -0
- package/dist/cjs/server/index.js +302 -26
- package/dist/cjs/server/index.js.map +1 -1
- package/dist/cjs/tools/index.d.ts +179 -1
- package/dist/cjs/tools/index.js +283 -25
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/esm/{chunk-3FGPOVUZ.mjs → chunk-3PMBXSJ3.mjs} +51 -3
- package/dist/esm/chunk-3PMBXSJ3.mjs.map +1 -0
- package/dist/esm/{chunk-RDQ7AMR4.mjs → chunk-B7X7H6NV.mjs} +275 -27
- package/dist/esm/chunk-B7X7H6NV.mjs.map +1 -0
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/server/index.d.mts +12 -0
- package/dist/esm/server/index.mjs +2 -2
- package/dist/esm/tools/index.d.mts +179 -1
- package/dist/esm/tools/index.mjs +21 -1
- package/package.json +4 -5
- package/dist/esm/chunk-3FGPOVUZ.mjs.map +0 -1
- package/dist/esm/chunk-RDQ7AMR4.mjs.map +0 -1
|
@@ -88,6 +88,18 @@ declare class T402McpServer {
|
|
|
88
88
|
* Handle t402/paymentPlan
|
|
89
89
|
*/
|
|
90
90
|
private handlePaymentPlan;
|
|
91
|
+
/**
|
|
92
|
+
* Handle erc8004/resolveAgent
|
|
93
|
+
*/
|
|
94
|
+
private handleErc8004ResolveAgent;
|
|
95
|
+
/**
|
|
96
|
+
* Handle erc8004/checkReputation
|
|
97
|
+
*/
|
|
98
|
+
private handleErc8004CheckReputation;
|
|
99
|
+
/**
|
|
100
|
+
* Handle erc8004/verifyWallet
|
|
101
|
+
*/
|
|
102
|
+
private handleErc8004VerifyWallet;
|
|
91
103
|
/**
|
|
92
104
|
* Handle TON bridge tool calls
|
|
93
105
|
*/
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -1156,10 +1156,10 @@ var import_zod7 = require("zod");
|
|
|
1156
1156
|
var wdkGetWalletInputSchema = import_zod7.z.object({});
|
|
1157
1157
|
async function executeWdkGetWallet(_input, wdk) {
|
|
1158
1158
|
const signer = await wdk.getSigner("ethereum");
|
|
1159
|
-
const
|
|
1159
|
+
const chains7 = wdk.getConfiguredChains();
|
|
1160
1160
|
return {
|
|
1161
1161
|
evmAddress: signer.address,
|
|
1162
|
-
chains:
|
|
1162
|
+
chains: chains7.length > 0 ? chains7 : ["ethereum"]
|
|
1163
1163
|
};
|
|
1164
1164
|
}
|
|
1165
1165
|
function executeWdkGetWalletDemo() {
|
|
@@ -1191,14 +1191,14 @@ function findTokenFormatted(tokens, symbol) {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
async function executeWdkGetBalances(input, wdk) {
|
|
1193
1193
|
const balances = await wdk.getAggregatedBalances();
|
|
1194
|
-
const
|
|
1194
|
+
const chains7 = balances.chains.filter((c) => !input.chains || input.chains.includes(c.chain)).map((c) => ({
|
|
1195
1195
|
chain: c.chain,
|
|
1196
1196
|
usdt0: findTokenFormatted(c.tokens, "USDT0"),
|
|
1197
1197
|
usdc: findTokenFormatted(c.tokens, "USDC"),
|
|
1198
1198
|
native: (0, import_viem6.formatUnits)(c.native, 18)
|
|
1199
1199
|
}));
|
|
1200
1200
|
return {
|
|
1201
|
-
chains:
|
|
1201
|
+
chains: chains7,
|
|
1202
1202
|
totalUsdt0: (0, import_viem6.formatUnits)(balances.totalUsdt0, 6),
|
|
1203
1203
|
totalUsdc: (0, import_viem6.formatUnits)(balances.totalUsdc, 6)
|
|
1204
1204
|
};
|
|
@@ -1338,7 +1338,6 @@ function formatWdkSwapResult(result) {
|
|
|
1338
1338
|
|
|
1339
1339
|
// src/tools/autoPay.ts
|
|
1340
1340
|
var import_zod11 = require("zod");
|
|
1341
|
-
var import_wdk_protocol = require("@t402/wdk-protocol");
|
|
1342
1341
|
var autoPayInputSchema = import_zod11.z.object({
|
|
1343
1342
|
url: import_zod11.z.string().url().describe("URL to fetch (may return 402 Payment Required)"),
|
|
1344
1343
|
maxAmount: import_zod11.z.string().regex(/^\d+(\.\d+)?$/).optional().describe('Maximum amount willing to pay (e.g., "10.00"). If not set, pays any amount.'),
|
|
@@ -1347,8 +1346,9 @@ var autoPayInputSchema = import_zod11.z.object({
|
|
|
1347
1346
|
)
|
|
1348
1347
|
});
|
|
1349
1348
|
async function executeAutoPay(input, wdk) {
|
|
1350
|
-
const
|
|
1351
|
-
const
|
|
1349
|
+
const chains7 = input.preferredChain ? [input.preferredChain] : ["ethereum", "arbitrum", "base"];
|
|
1350
|
+
const { T402Protocol } = await import("@t402/wdk-protocol");
|
|
1351
|
+
const protocol = await T402Protocol.create(wdk, { chains: chains7 });
|
|
1352
1352
|
const { response, receipt } = await protocol.fetch(input.url);
|
|
1353
1353
|
if (receipt && input.maxAmount) {
|
|
1354
1354
|
const paidAmount = parseFloat(receipt.amount) / 1e6;
|
|
@@ -1666,23 +1666,185 @@ ${JSON.stringify(data.result[0], null, 2)}`
|
|
|
1666
1666
|
}
|
|
1667
1667
|
}
|
|
1668
1668
|
|
|
1669
|
-
// src/tools/
|
|
1669
|
+
// src/tools/erc8004ResolveAgent.ts
|
|
1670
1670
|
var import_zod12 = require("zod");
|
|
1671
|
-
var
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1671
|
+
var import_erc80042 = require("@t402/erc8004");
|
|
1672
|
+
|
|
1673
|
+
// src/tools/erc8004Shared.ts
|
|
1674
|
+
var import_viem8 = require("viem");
|
|
1675
|
+
var chains6 = __toESM(require("viem/chains"));
|
|
1676
|
+
var import_erc8004 = require("@t402/erc8004");
|
|
1677
|
+
var CHAIN_ID_TO_VIEM = {
|
|
1678
|
+
1: chains6.mainnet,
|
|
1679
|
+
8453: chains6.base,
|
|
1680
|
+
42161: chains6.arbitrum,
|
|
1681
|
+
10: chains6.optimism,
|
|
1682
|
+
137: chains6.polygon,
|
|
1683
|
+
43114: chains6.avalanche,
|
|
1684
|
+
57073: chains6.ink,
|
|
1685
|
+
80094: chains6.berachain,
|
|
1686
|
+
130: chains6.unichain
|
|
1687
|
+
};
|
|
1688
|
+
var CHAIN_ID_TO_NETWORK = Object.fromEntries(
|
|
1689
|
+
Object.entries(CHAIN_IDS).map(([name, id]) => [id, name])
|
|
1690
|
+
);
|
|
1691
|
+
function createErc8004Client(agentRegistry, rpcUrls) {
|
|
1692
|
+
const parsed = (0, import_erc8004.parseAgentRegistry)(agentRegistry);
|
|
1693
|
+
const chainId = parseInt(parsed.chainId, 10);
|
|
1694
|
+
const viemChain = CHAIN_ID_TO_VIEM[chainId];
|
|
1695
|
+
if (!viemChain) {
|
|
1696
|
+
throw new Error(
|
|
1697
|
+
`Unsupported chain ID ${chainId} from registry ${agentRegistry}. Supported: ${Object.keys(CHAIN_ID_TO_VIEM).join(", ")}`
|
|
1698
|
+
);
|
|
1699
|
+
}
|
|
1700
|
+
const network = CHAIN_ID_TO_NETWORK[chainId];
|
|
1701
|
+
const rpcUrl = network && rpcUrls?.[network] || network && DEFAULT_RPC_URLS[network];
|
|
1702
|
+
const client = (0, import_viem8.createPublicClient)({
|
|
1703
|
+
chain: viemChain,
|
|
1704
|
+
transport: (0, import_viem8.http)(rpcUrl)
|
|
1705
|
+
});
|
|
1706
|
+
return { client, registryAddress: parsed.address };
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
// src/tools/erc8004ResolveAgent.ts
|
|
1710
|
+
var erc8004ResolveAgentInputSchema = import_zod12.z.object({
|
|
1711
|
+
agentId: import_zod12.z.number().int().nonnegative().describe("Agent NFT token ID on the Identity Registry"),
|
|
1712
|
+
agentRegistry: import_zod12.z.string().regex(/^eip155:\d+:0x[a-fA-F0-9]+$/).describe('Agent registry identifier (e.g., "eip155:8453:0xRegistryAddress")')
|
|
1676
1713
|
});
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1714
|
+
async function executeErc8004ResolveAgent(input, rpcUrls) {
|
|
1715
|
+
const { client, registryAddress } = createErc8004Client(input.agentRegistry, rpcUrls);
|
|
1716
|
+
return (0, import_erc80042.resolveAgent)(
|
|
1717
|
+
client,
|
|
1718
|
+
registryAddress,
|
|
1719
|
+
BigInt(input.agentId),
|
|
1720
|
+
input.agentRegistry
|
|
1721
|
+
);
|
|
1722
|
+
}
|
|
1723
|
+
function formatErc8004ResolveAgentResult(agent) {
|
|
1724
|
+
const lines = [
|
|
1725
|
+
`## Agent Identity (ID: ${agent.agentId})`,
|
|
1726
|
+
"",
|
|
1727
|
+
`**Registry:** ${agent.registry.id}`,
|
|
1728
|
+
`**Wallet:** \`${agent.agentWallet}\``,
|
|
1729
|
+
`**Owner:** \`${agent.owner}\``,
|
|
1730
|
+
`**Registration URI:** ${agent.agentURI}`,
|
|
1731
|
+
""
|
|
1732
|
+
];
|
|
1733
|
+
if (agent.registration) {
|
|
1734
|
+
const reg = agent.registration;
|
|
1735
|
+
lines.push("### Registration File");
|
|
1736
|
+
if (reg.name) lines.push(`- **Name:** ${reg.name}`);
|
|
1737
|
+
if (reg.description) lines.push(`- **Description:** ${reg.description}`);
|
|
1738
|
+
if (reg.image) lines.push(`- **Image:** ${reg.image}`);
|
|
1739
|
+
if (reg.x402Support !== void 0) lines.push(`- **x402 Support:** ${reg.x402Support}`);
|
|
1740
|
+
if (reg.services?.length) {
|
|
1741
|
+
lines.push("");
|
|
1742
|
+
lines.push("### Services");
|
|
1743
|
+
for (const svc of reg.services) {
|
|
1744
|
+
lines.push(`- **${svc.name}:** ${svc.endpoint}`);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
return lines.join("\n");
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
// src/tools/erc8004CheckReputation.ts
|
|
1752
|
+
var import_zod13 = require("zod");
|
|
1753
|
+
var import_erc80043 = require("@t402/erc8004");
|
|
1754
|
+
var erc8004CheckReputationInputSchema = import_zod13.z.object({
|
|
1755
|
+
agentId: import_zod13.z.number().int().nonnegative().describe("Agent NFT token ID"),
|
|
1756
|
+
agentRegistry: import_zod13.z.string().regex(/^eip155:\d+:0x[a-fA-F0-9]+$/).describe('Agent registry identifier (e.g., "eip155:8453:0xRegistryAddress")'),
|
|
1757
|
+
reputationRegistry: import_zod13.z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Reputation Registry contract address on the same chain"),
|
|
1758
|
+
trustedReviewers: import_zod13.z.array(import_zod13.z.string().regex(/^0x[a-fA-F0-9]{40}$/)).min(1).describe("Addresses whose feedback is trusted (required for Sybil resistance)")
|
|
1759
|
+
});
|
|
1760
|
+
async function executeErc8004CheckReputation(input, rpcUrls) {
|
|
1761
|
+
const { client } = createErc8004Client(input.agentRegistry, rpcUrls);
|
|
1762
|
+
return (0, import_erc80043.getReputationSummary)(
|
|
1763
|
+
client,
|
|
1764
|
+
input.reputationRegistry,
|
|
1765
|
+
BigInt(input.agentId),
|
|
1766
|
+
input.trustedReviewers
|
|
1767
|
+
);
|
|
1768
|
+
}
|
|
1769
|
+
function formatErc8004CheckReputationResult(summary) {
|
|
1770
|
+
const lines = [
|
|
1771
|
+
`## Agent Reputation (ID: ${summary.agentId})`,
|
|
1772
|
+
"",
|
|
1773
|
+
`| Metric | Value |`,
|
|
1774
|
+
`|--------|-------|`,
|
|
1775
|
+
`| Feedback Count | ${summary.count} |`,
|
|
1776
|
+
`| Raw Score | ${summary.summaryValue} |`,
|
|
1777
|
+
`| Score Decimals | ${summary.summaryValueDecimals} |`,
|
|
1778
|
+
`| **Normalized Score** | **${summary.normalizedScore}/100** |`,
|
|
1779
|
+
""
|
|
1780
|
+
];
|
|
1781
|
+
if (summary.normalizedScore >= 80) {
|
|
1782
|
+
lines.push("_High reputation \u2014 trusted agent_");
|
|
1783
|
+
} else if (summary.normalizedScore >= 50) {
|
|
1784
|
+
lines.push("_Moderate reputation_");
|
|
1785
|
+
} else if (summary.count > 0n) {
|
|
1786
|
+
lines.push("_Low reputation \u2014 exercise caution_");
|
|
1787
|
+
} else {
|
|
1788
|
+
lines.push("_No feedback recorded from trusted reviewers_");
|
|
1789
|
+
}
|
|
1790
|
+
return lines.join("\n");
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
// src/tools/erc8004VerifyWallet.ts
|
|
1794
|
+
var import_zod14 = require("zod");
|
|
1795
|
+
var import_erc80044 = require("@t402/erc8004");
|
|
1796
|
+
var erc8004VerifyWalletInputSchema = import_zod14.z.object({
|
|
1797
|
+
agentId: import_zod14.z.number().int().nonnegative().describe("Agent NFT token ID"),
|
|
1798
|
+
agentRegistry: import_zod14.z.string().regex(/^eip155:\d+:0x[a-fA-F0-9]+$/).describe('Agent registry identifier (e.g., "eip155:8453:0xRegistryAddress")'),
|
|
1799
|
+
walletAddress: import_zod14.z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Wallet address to verify (typically the payTo from PaymentRequirements)")
|
|
1800
|
+
});
|
|
1801
|
+
async function executeErc8004VerifyWallet(input, rpcUrls) {
|
|
1802
|
+
const { client, registryAddress } = createErc8004Client(input.agentRegistry, rpcUrls);
|
|
1803
|
+
const matches = await (0, import_erc80044.verifyPayToMatchesAgent)(
|
|
1804
|
+
client,
|
|
1805
|
+
registryAddress,
|
|
1806
|
+
BigInt(input.agentId),
|
|
1807
|
+
input.walletAddress
|
|
1808
|
+
);
|
|
1809
|
+
return {
|
|
1810
|
+
matches,
|
|
1811
|
+
agentId: input.agentId,
|
|
1812
|
+
walletAddress: input.walletAddress,
|
|
1813
|
+
registryAddress
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
function formatErc8004VerifyWalletResult(result) {
|
|
1817
|
+
const status = result.matches ? "VERIFIED" : "MISMATCH";
|
|
1818
|
+
const icon = result.matches ? "[PASS]" : "[FAIL]";
|
|
1819
|
+
const lines = [
|
|
1820
|
+
`## Wallet Verification: ${icon} ${status}`,
|
|
1821
|
+
"",
|
|
1822
|
+
`| Field | Value |`,
|
|
1823
|
+
`|-------|-------|`,
|
|
1824
|
+
`| Agent ID | ${result.agentId} |`,
|
|
1825
|
+
`| Wallet Address | \`${result.walletAddress}\` |`,
|
|
1826
|
+
`| Registry | \`${result.registryAddress}\` |`,
|
|
1827
|
+
`| **Result** | **${result.matches ? "Address matches on-chain agentWallet" : "Address does NOT match on-chain agentWallet"}** |`
|
|
1828
|
+
];
|
|
1829
|
+
return lines.join("\n");
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
// src/tools/unified.ts
|
|
1833
|
+
var import_zod15 = require("zod");
|
|
1834
|
+
var smartPayInputSchema = import_zod15.z.object({
|
|
1835
|
+
url: import_zod15.z.string().url().describe("URL of the 402-protected resource"),
|
|
1836
|
+
maxBridgeFee: import_zod15.z.string().regex(/^\d+(\.\d+)?$/).optional().describe("Maximum acceptable bridge fee in native token (optional)"),
|
|
1837
|
+
preferredNetwork: import_zod15.z.string().optional().describe("Preferred network for payment (optional)")
|
|
1838
|
+
});
|
|
1839
|
+
var paymentPlanInputSchema = import_zod15.z.object({
|
|
1840
|
+
paymentRequired: import_zod15.z.object({
|
|
1841
|
+
scheme: import_zod15.z.string().optional(),
|
|
1842
|
+
network: import_zod15.z.string().optional(),
|
|
1843
|
+
maxAmountRequired: import_zod15.z.string().optional(),
|
|
1844
|
+
resource: import_zod15.z.string().optional(),
|
|
1845
|
+
description: import_zod15.z.string().optional(),
|
|
1846
|
+
payTo: import_zod15.z.string().optional(),
|
|
1847
|
+
maxDeadline: import_zod15.z.number().optional()
|
|
1686
1848
|
}).passthrough().describe("The 402 PaymentRequired response")
|
|
1687
1849
|
});
|
|
1688
1850
|
var UNIFIED_TOOL_DEFINITIONS = {
|
|
@@ -1722,13 +1884,14 @@ var UNIFIED_TOOL_DEFINITIONS = {
|
|
|
1722
1884
|
};
|
|
1723
1885
|
async function executeSmartPay(input, wdk) {
|
|
1724
1886
|
const steps = [];
|
|
1725
|
-
const
|
|
1887
|
+
const chains7 = input.preferredNetwork ? [input.preferredNetwork] : ["ethereum", "arbitrum", "base"];
|
|
1726
1888
|
steps.push({
|
|
1727
1889
|
action: "check_balance",
|
|
1728
1890
|
status: "success",
|
|
1729
|
-
detail: `Checking balances on ${
|
|
1891
|
+
detail: `Checking balances on ${chains7.join(", ")}`
|
|
1730
1892
|
});
|
|
1731
|
-
const
|
|
1893
|
+
const { T402Protocol } = await import("@t402/wdk-protocol");
|
|
1894
|
+
const protocol = await T402Protocol.create(wdk, { chains: chains7 });
|
|
1732
1895
|
steps.push({
|
|
1733
1896
|
action: "fetch",
|
|
1734
1897
|
status: "success",
|
|
@@ -2220,6 +2383,81 @@ var WDK_TOOL_DEFINITIONS = {
|
|
|
2220
2383
|
}
|
|
2221
2384
|
}
|
|
2222
2385
|
};
|
|
2386
|
+
var ERC8004_TOOL_DEFINITIONS = {
|
|
2387
|
+
"erc8004/resolveAgent": {
|
|
2388
|
+
name: "erc8004/resolveAgent",
|
|
2389
|
+
description: "Look up an agent's on-chain ERC-8004 identity. Returns the agent's registered wallet address, owner, registration file (name, description, services), and verification URI. Use this to verify an agent before making a payment.",
|
|
2390
|
+
inputSchema: {
|
|
2391
|
+
type: "object",
|
|
2392
|
+
properties: {
|
|
2393
|
+
agentId: {
|
|
2394
|
+
type: "number",
|
|
2395
|
+
description: "Agent NFT token ID on the Identity Registry"
|
|
2396
|
+
},
|
|
2397
|
+
agentRegistry: {
|
|
2398
|
+
type: "string",
|
|
2399
|
+
pattern: "^eip155:\\d+:0x[a-fA-F0-9]+$",
|
|
2400
|
+
description: 'Agent registry identifier (e.g., "eip155:8453:0xRegistryAddress")'
|
|
2401
|
+
}
|
|
2402
|
+
},
|
|
2403
|
+
required: ["agentId", "agentRegistry"]
|
|
2404
|
+
}
|
|
2405
|
+
},
|
|
2406
|
+
"erc8004/checkReputation": {
|
|
2407
|
+
name: "erc8004/checkReputation",
|
|
2408
|
+
description: "Query an agent's reputation score from the on-chain Reputation Registry. Returns a normalized 0-100 score based on feedback from trusted reviewers. Requires explicit trusted reviewer addresses for Sybil resistance.",
|
|
2409
|
+
inputSchema: {
|
|
2410
|
+
type: "object",
|
|
2411
|
+
properties: {
|
|
2412
|
+
agentId: {
|
|
2413
|
+
type: "number",
|
|
2414
|
+
description: "Agent NFT token ID"
|
|
2415
|
+
},
|
|
2416
|
+
agentRegistry: {
|
|
2417
|
+
type: "string",
|
|
2418
|
+
pattern: "^eip155:\\d+:0x[a-fA-F0-9]+$",
|
|
2419
|
+
description: 'Agent registry identifier (e.g., "eip155:8453:0xRegistryAddress")'
|
|
2420
|
+
},
|
|
2421
|
+
reputationRegistry: {
|
|
2422
|
+
type: "string",
|
|
2423
|
+
pattern: "^0x[a-fA-F0-9]{40}$",
|
|
2424
|
+
description: "Reputation Registry contract address on the same chain"
|
|
2425
|
+
},
|
|
2426
|
+
trustedReviewers: {
|
|
2427
|
+
type: "array",
|
|
2428
|
+
items: { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" },
|
|
2429
|
+
minItems: 1,
|
|
2430
|
+
description: "Addresses whose feedback is trusted (required for Sybil resistance)"
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
required: ["agentId", "agentRegistry", "reputationRegistry", "trustedReviewers"]
|
|
2434
|
+
}
|
|
2435
|
+
},
|
|
2436
|
+
"erc8004/verifyWallet": {
|
|
2437
|
+
name: "erc8004/verifyWallet",
|
|
2438
|
+
description: "Verify that a payment address (payTo) matches an agent's on-chain registered wallet. Use this before paying to confirm the recipient address is legitimate and owned by the declared agent.",
|
|
2439
|
+
inputSchema: {
|
|
2440
|
+
type: "object",
|
|
2441
|
+
properties: {
|
|
2442
|
+
agentId: {
|
|
2443
|
+
type: "number",
|
|
2444
|
+
description: "Agent NFT token ID"
|
|
2445
|
+
},
|
|
2446
|
+
agentRegistry: {
|
|
2447
|
+
type: "string",
|
|
2448
|
+
pattern: "^eip155:\\d+:0x[a-fA-F0-9]+$",
|
|
2449
|
+
description: 'Agent registry identifier (e.g., "eip155:8453:0xRegistryAddress")'
|
|
2450
|
+
},
|
|
2451
|
+
walletAddress: {
|
|
2452
|
+
type: "string",
|
|
2453
|
+
pattern: "^0x[a-fA-F0-9]{40}$",
|
|
2454
|
+
description: "Wallet address to verify (typically the payTo from payment requirements)"
|
|
2455
|
+
}
|
|
2456
|
+
},
|
|
2457
|
+
required: ["agentId", "agentRegistry", "walletAddress"]
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
};
|
|
2223
2461
|
|
|
2224
2462
|
// src/server/t402Server.ts
|
|
2225
2463
|
var T402McpServer = class {
|
|
@@ -2273,7 +2511,7 @@ var T402McpServer = class {
|
|
|
2273
2511
|
* Get all tool definitions (base + WDK if configured + unified if enabled + TON bridge if registered)
|
|
2274
2512
|
*/
|
|
2275
2513
|
getToolDefinitions() {
|
|
2276
|
-
const tools = { ...TOOL_DEFINITIONS };
|
|
2514
|
+
const tools = { ...TOOL_DEFINITIONS, ...ERC8004_TOOL_DEFINITIONS };
|
|
2277
2515
|
if (this.wdk || this.config.demoMode) {
|
|
2278
2516
|
Object.assign(tools, WDK_TOOL_DEFINITIONS);
|
|
2279
2517
|
}
|
|
@@ -2326,6 +2564,13 @@ var T402McpServer = class {
|
|
|
2326
2564
|
return await this.handleSmartPay(args);
|
|
2327
2565
|
case "t402/paymentPlan":
|
|
2328
2566
|
return await this.handlePaymentPlan(args);
|
|
2567
|
+
// ERC-8004 tools
|
|
2568
|
+
case "erc8004/resolveAgent":
|
|
2569
|
+
return await this.handleErc8004ResolveAgent(args);
|
|
2570
|
+
case "erc8004/checkReputation":
|
|
2571
|
+
return await this.handleErc8004CheckReputation(args);
|
|
2572
|
+
case "erc8004/verifyWallet":
|
|
2573
|
+
return await this.handleErc8004VerifyWallet(args);
|
|
2329
2574
|
// TON bridge tools
|
|
2330
2575
|
case "ton/getBalance":
|
|
2331
2576
|
case "ton/transfer":
|
|
@@ -2551,6 +2796,37 @@ var T402McpServer = class {
|
|
|
2551
2796
|
content: [{ type: "text", text: formatPaymentPlanResult(result) }]
|
|
2552
2797
|
};
|
|
2553
2798
|
}
|
|
2799
|
+
// ---- ERC-8004 Tool Handlers ----
|
|
2800
|
+
/**
|
|
2801
|
+
* Handle erc8004/resolveAgent
|
|
2802
|
+
*/
|
|
2803
|
+
async handleErc8004ResolveAgent(args) {
|
|
2804
|
+
const input = erc8004ResolveAgentInputSchema.parse(args);
|
|
2805
|
+
const result = await executeErc8004ResolveAgent(input, this.config.rpcUrls);
|
|
2806
|
+
return {
|
|
2807
|
+
content: [{ type: "text", text: formatErc8004ResolveAgentResult(result) }]
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
/**
|
|
2811
|
+
* Handle erc8004/checkReputation
|
|
2812
|
+
*/
|
|
2813
|
+
async handleErc8004CheckReputation(args) {
|
|
2814
|
+
const input = erc8004CheckReputationInputSchema.parse(args);
|
|
2815
|
+
const result = await executeErc8004CheckReputation(input, this.config.rpcUrls);
|
|
2816
|
+
return {
|
|
2817
|
+
content: [{ type: "text", text: formatErc8004CheckReputationResult(result) }]
|
|
2818
|
+
};
|
|
2819
|
+
}
|
|
2820
|
+
/**
|
|
2821
|
+
* Handle erc8004/verifyWallet
|
|
2822
|
+
*/
|
|
2823
|
+
async handleErc8004VerifyWallet(args) {
|
|
2824
|
+
const input = erc8004VerifyWalletInputSchema.parse(args);
|
|
2825
|
+
const result = await executeErc8004VerifyWallet(input, this.config.rpcUrls);
|
|
2826
|
+
return {
|
|
2827
|
+
content: [{ type: "text", text: formatErc8004VerifyWalletResult(result) }]
|
|
2828
|
+
};
|
|
2829
|
+
}
|
|
2554
2830
|
// ---- TON Bridge Tool Handler ----
|
|
2555
2831
|
/**
|
|
2556
2832
|
* Handle TON bridge tool calls
|