agentcash 0.3.5 → 0.3.7
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/run-server.cjs +15151 -13301
- package/dist/esm/{chunk-NUYR6S4R.js → chunk-7E4JDDBW.js} +4 -4
- package/dist/esm/chunk-7E4JDDBW.js.map +1 -0
- package/dist/esm/{chunk-V5JYDONS.js → chunk-ED4QVIZH.js} +2 -2
- package/dist/esm/{chunk-LDXTW6MC.js → chunk-RP5AGYAT.js} +66 -40
- package/dist/esm/chunk-RP5AGYAT.js.map +1 -0
- package/dist/esm/{chunk-LXLFCKRE.js → chunk-SBLBP4FH.js} +2 -2
- package/dist/esm/{commands-N2AA3RBV.js → commands-JXKV7VMY.js} +14 -12
- package/dist/esm/commands-JXKV7VMY.js.map +1 -0
- package/dist/esm/index.js +8 -8
- package/dist/esm/{install-DSGWSVXN.js → install-IP2RBDST.js} +2 -2
- package/dist/esm/lib.d.ts +4 -2
- package/dist/esm/lib.js +3 -3
- package/dist/esm/{server-SCEZADBF.js → server-BEKXJWYB.js} +208 -229
- package/dist/esm/server-BEKXJWYB.js.map +1 -0
- package/dist/esm/shared/operations/index.js +3 -3
- package/package.json +4 -4
- package/dist/esm/chunk-LDXTW6MC.js.map +0 -1
- package/dist/esm/chunk-NUYR6S4R.js.map +0 -1
- package/dist/esm/commands-N2AA3RBV.js.map +0 -1
- package/dist/esm/server-SCEZADBF.js.map +0 -1
- /package/dist/esm/{chunk-V5JYDONS.js.map → chunk-ED4QVIZH.js.map} +0 -0
- /package/dist/esm/{chunk-LXLFCKRE.js.map → chunk-SBLBP4FH.js.map} +0 -0
- /package/dist/esm/{install-DSGWSVXN.js.map → install-IP2RBDST.js.map} +0 -0
|
@@ -2,24 +2,22 @@ import {
|
|
|
2
2
|
buildRequest,
|
|
3
3
|
createFetchWithPayment,
|
|
4
4
|
requestSchema
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7E4JDDBW.js";
|
|
6
6
|
import {
|
|
7
|
+
TEMPO_RPC_URL,
|
|
7
8
|
checkEndpoint,
|
|
8
9
|
detectPaymentProtocols,
|
|
9
10
|
discoverResources,
|
|
10
11
|
getInputSchema,
|
|
11
|
-
getOriginIndex,
|
|
12
12
|
getSiwxExtension,
|
|
13
13
|
getTempoBalance,
|
|
14
|
-
getTempoChainId,
|
|
15
|
-
getTempoRpcUrl,
|
|
16
14
|
getWalletInfo,
|
|
17
15
|
safeCreateSIWxPayload,
|
|
18
16
|
safeGetMppChallenge,
|
|
19
17
|
safeGetPaymentRequired,
|
|
20
18
|
submitErrorReport
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-RP5AGYAT.js";
|
|
20
|
+
import "./chunk-SBLBP4FH.js";
|
|
23
21
|
import {
|
|
24
22
|
DEFAULT_NETWORK,
|
|
25
23
|
getWallet,
|
|
@@ -52,7 +50,9 @@ import { randomBytes } from "crypto";
|
|
|
52
50
|
import { z } from "zod";
|
|
53
51
|
import { x402Client, x402HTTPClient } from "@x402/core/client";
|
|
54
52
|
import { ExactEvmScheme } from "@x402/evm/exact/client";
|
|
55
|
-
import {
|
|
53
|
+
import { Mppx, tempo as tempoMethod } from "mppx/client";
|
|
54
|
+
import { createClient, http } from "viem";
|
|
55
|
+
import { tempo } from "viem/chains";
|
|
56
56
|
|
|
57
57
|
// src/server/tools/response/lib.ts
|
|
58
58
|
var parsedResponseToToolContentPart = (data) => {
|
|
@@ -124,8 +124,8 @@ var mcpError = async (err2) => {
|
|
|
124
124
|
}
|
|
125
125
|
return mcpErrorJson({ ...error });
|
|
126
126
|
};
|
|
127
|
-
var mcpErrorFetch = async (
|
|
128
|
-
return mcpError(fetchHttpErr(
|
|
127
|
+
var mcpErrorFetch = async (surface2, response) => {
|
|
128
|
+
return mcpError(fetchHttpErr(surface2, response));
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
// src/server/tools/response/success.ts
|
|
@@ -168,9 +168,9 @@ var checkBalance = async ({
|
|
|
168
168
|
amountNeeded,
|
|
169
169
|
message,
|
|
170
170
|
flags,
|
|
171
|
-
surface:
|
|
171
|
+
surface: surface2
|
|
172
172
|
}) => {
|
|
173
|
-
const balanceResult = await getBalance({ address, flags, surface:
|
|
173
|
+
const balanceResult = await getBalance({ address, flags, surface: surface2 });
|
|
174
174
|
if (balanceResult.isErr()) {
|
|
175
175
|
log.error(JSON.stringify(balanceResult.error, null, 2));
|
|
176
176
|
return;
|
|
@@ -274,11 +274,12 @@ var registerFetchTool = ({
|
|
|
274
274
|
]
|
|
275
275
|
});
|
|
276
276
|
const x402HttpClient = new x402HTTPClient(coreClient);
|
|
277
|
-
const
|
|
277
|
+
const mppxClient = Mppx.create({
|
|
278
|
+
polyfill: false,
|
|
278
279
|
methods: [
|
|
279
|
-
|
|
280
|
+
tempoMethod({
|
|
280
281
|
account,
|
|
281
|
-
|
|
282
|
+
getClient: () => createClient({ chain: tempo, transport: http(TEMPO_RPC_URL) })
|
|
282
283
|
})
|
|
283
284
|
]
|
|
284
285
|
});
|
|
@@ -313,7 +314,7 @@ var registerFetchTool = ({
|
|
|
313
314
|
});
|
|
314
315
|
const fetchResult = await createFetchWithPayment({
|
|
315
316
|
surface: toolName,
|
|
316
|
-
clients: { x402: x402HttpClient, mpp:
|
|
317
|
+
clients: { x402: x402HttpClient, mpp: mppxClient },
|
|
317
318
|
paymentMethod,
|
|
318
319
|
account,
|
|
319
320
|
flags,
|
|
@@ -504,7 +505,7 @@ var registerCheckEndpointTool = ({
|
|
|
504
505
|
toolName3,
|
|
505
506
|
{
|
|
506
507
|
title: "Check Endpoint Schema",
|
|
507
|
-
description: `Probe endpoint to check if payment-protected. By default checks
|
|
508
|
+
description: `Probe endpoint to check if payment-protected. By default checks only the HTTP methods declared in the endpoint's OpenAPI spec (falls back to all methods if no spec is available). Returns pricing, input schema, and payment methods for each method that responds with 402 or 2xx. Use before fetch to preview costs. No payment made.`,
|
|
508
509
|
inputSchema: checkEndpointInputSchema,
|
|
509
510
|
annotations: {
|
|
510
511
|
readOnlyHint: true,
|
|
@@ -754,40 +755,45 @@ function registerDiscoveryTools(server) {
|
|
|
754
755
|
import z7 from "zod";
|
|
755
756
|
import { x402HTTPClient as x402HTTPClient3 } from "@x402/core/client";
|
|
756
757
|
import { x402Client as x402Client3 } from "@x402/core/client";
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
758
|
+
var ORIGIN_METADATA = {
|
|
759
|
+
["https://enrichx402.com" /* EnrichX402 */]: {
|
|
760
|
+
title: "EnrichX402",
|
|
761
|
+
description: "People/org search, Google Maps, Grok twitter search, Exa web search, LinkedIn data, Firecrawl scrape, WhitePages, email enrichment"
|
|
762
|
+
},
|
|
763
|
+
["https://socialx402.com" /* SocialX402 */]: {
|
|
764
|
+
title: "SocialX402",
|
|
765
|
+
description: "Social media data for Twitter, Instagram, TikTok, YouTube, Facebook, Reddit"
|
|
766
|
+
},
|
|
767
|
+
["https://stablestudio.io" /* StableStudio */]: {
|
|
768
|
+
title: "StableStudio",
|
|
769
|
+
description: "Generate and edit images and videos"
|
|
770
|
+
},
|
|
771
|
+
["https://agentupload.dev" /* AgentUpload */]: {
|
|
772
|
+
title: "AgentUpload",
|
|
773
|
+
description: "Upload and share files"
|
|
774
|
+
},
|
|
775
|
+
["https://x402email.com" /* X402Email */]: {
|
|
776
|
+
title: "X402 Email",
|
|
777
|
+
description: "Send emails"
|
|
778
|
+
},
|
|
779
|
+
["https://x402scan.com" /* X402Scan */]: {
|
|
780
|
+
title: "X402 Scan",
|
|
781
|
+
description: "x402 protocol explorer"
|
|
782
|
+
},
|
|
783
|
+
["https://shirt.sh" /* Shirt */]: {
|
|
784
|
+
title: "Shirt",
|
|
785
|
+
description: "Shirt.sh"
|
|
786
|
+
},
|
|
787
|
+
["https://x402puppet.com" /* X402Puppet */]: {
|
|
788
|
+
title: "X402 Puppet",
|
|
789
|
+
description: "Browser automation"
|
|
790
|
+
},
|
|
791
|
+
["https://x402facilitator.com" /* X402Facilitator */]: {
|
|
792
|
+
title: "X402 Facilitator",
|
|
793
|
+
description: "Payment facilitation"
|
|
794
|
+
}
|
|
787
795
|
};
|
|
788
|
-
|
|
789
|
-
// src/server/resources/origins.ts
|
|
790
|
-
var surface2 = "registerOrigins";
|
|
796
|
+
var surface = "registerOrigins";
|
|
791
797
|
var wellKnownResourceItem = z7.union([
|
|
792
798
|
z7.string(),
|
|
793
799
|
z7.object({
|
|
@@ -799,170 +805,167 @@ var wellKnownResourceItem = z7.union([
|
|
|
799
805
|
var wellKnownSchema = z7.object({
|
|
800
806
|
resources: z7.array(wellKnownResourceItem)
|
|
801
807
|
});
|
|
802
|
-
var registerOrigins =
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
allResourceUrls.add(r);
|
|
834
|
-
return;
|
|
835
|
-
}
|
|
836
|
-
const url = r.path ? `${baseUrl}${r.path}` : r.url ?? "";
|
|
837
|
-
if (url) allResourceUrls.add(url);
|
|
838
|
-
};
|
|
839
|
-
if (x402WellKnown.isOk()) {
|
|
840
|
-
for (const r of x402WellKnown.value.resources) {
|
|
841
|
-
addResource(r);
|
|
842
|
-
}
|
|
808
|
+
var registerOrigins = ({ server }) => {
|
|
809
|
+
for (const origin of ORIGINS) {
|
|
810
|
+
const domain = new URL(origin).hostname;
|
|
811
|
+
const metadata = ORIGIN_METADATA[origin];
|
|
812
|
+
server.registerResource(
|
|
813
|
+
domain,
|
|
814
|
+
`api://${domain}`,
|
|
815
|
+
{
|
|
816
|
+
title: metadata?.title ?? domain,
|
|
817
|
+
description: metadata?.description ?? "",
|
|
818
|
+
mimeType: "application/json"
|
|
819
|
+
},
|
|
820
|
+
async (uri) => {
|
|
821
|
+
const baseUrl = uri.toString().replace("api://", "https://");
|
|
822
|
+
const [x402WellKnown, mppWellKnown] = await Promise.all([
|
|
823
|
+
safeFetchJson(
|
|
824
|
+
surface,
|
|
825
|
+
new Request(`${baseUrl}/.well-known/x402`),
|
|
826
|
+
wellKnownSchema
|
|
827
|
+
),
|
|
828
|
+
safeFetchJson(
|
|
829
|
+
surface,
|
|
830
|
+
new Request(`${baseUrl}/.well-known/mpp`),
|
|
831
|
+
wellKnownSchema
|
|
832
|
+
)
|
|
833
|
+
]);
|
|
834
|
+
const allResourceUrls = /* @__PURE__ */ new Set();
|
|
835
|
+
const addResource = (r) => {
|
|
836
|
+
if (typeof r === "string") {
|
|
837
|
+
allResourceUrls.add(r);
|
|
838
|
+
return;
|
|
843
839
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
840
|
+
const url = r.path ? `${baseUrl}${r.path}` : r.url ?? "";
|
|
841
|
+
if (url) allResourceUrls.add(url);
|
|
842
|
+
};
|
|
843
|
+
if (x402WellKnown.isOk()) {
|
|
844
|
+
for (const r of x402WellKnown.value.resources) {
|
|
845
|
+
addResource(r);
|
|
848
846
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
mppWellKnown.isErr() ? mppWellKnown.error : "no mpp"
|
|
854
|
-
);
|
|
855
|
-
return {
|
|
856
|
-
contents: [
|
|
857
|
-
{
|
|
858
|
-
uri: domain,
|
|
859
|
-
text: JSON.stringify(
|
|
860
|
-
{ error: "Failed to fetch well-known resources" },
|
|
861
|
-
null,
|
|
862
|
-
2
|
|
863
|
-
),
|
|
864
|
-
mimeType: "application/json"
|
|
865
|
-
}
|
|
866
|
-
]
|
|
867
|
-
};
|
|
847
|
+
}
|
|
848
|
+
if (mppWellKnown.isOk()) {
|
|
849
|
+
for (const r of mppWellKnown.value.resources) {
|
|
850
|
+
addResource(r);
|
|
868
851
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
headers: {
|
|
876
|
-
"Content-Type": "application/json"
|
|
877
|
-
}
|
|
878
|
-
})
|
|
879
|
-
);
|
|
880
|
-
if (postResult.isOk()) {
|
|
881
|
-
return postResult.value;
|
|
882
|
-
}
|
|
883
|
-
const getResult = await getResourceResponse(
|
|
884
|
-
resource,
|
|
885
|
-
new Request(resource, { method: "GET" })
|
|
886
|
-
);
|
|
887
|
-
if (getResult.isOk()) {
|
|
888
|
-
return getResult.value;
|
|
889
|
-
}
|
|
890
|
-
console.error(`Failed to get resource response for ${resource}`);
|
|
891
|
-
return null;
|
|
892
|
-
})
|
|
852
|
+
}
|
|
853
|
+
if (allResourceUrls.size === 0) {
|
|
854
|
+
console.error(
|
|
855
|
+
`Failed to fetch well-known for ${origin}:`,
|
|
856
|
+
x402WellKnown.isErr() ? x402WellKnown.error : "no x402",
|
|
857
|
+
mppWellKnown.isErr() ? mppWellKnown.error : "no mpp"
|
|
893
858
|
);
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
if (resource.mpp) {
|
|
905
|
-
entry.mpp = {
|
|
906
|
-
method: resource.mpp.method,
|
|
907
|
-
intent: resource.mpp.intent
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
if (resource.x402) {
|
|
911
|
-
const schema = getInputSchema(resource.x402.extensions);
|
|
912
|
-
entry.x402 = {
|
|
913
|
-
schema,
|
|
914
|
-
mimeType: resource.x402.mimeType
|
|
915
|
-
};
|
|
859
|
+
return {
|
|
860
|
+
contents: [
|
|
861
|
+
{
|
|
862
|
+
uri: domain,
|
|
863
|
+
text: JSON.stringify(
|
|
864
|
+
{ error: "Failed to fetch well-known resources" },
|
|
865
|
+
null,
|
|
866
|
+
2
|
|
867
|
+
),
|
|
868
|
+
mimeType: "application/json"
|
|
916
869
|
}
|
|
917
|
-
|
|
918
|
-
})
|
|
870
|
+
]
|
|
919
871
|
};
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
return {
|
|
930
|
-
contents: [
|
|
931
|
-
{
|
|
932
|
-
uri: domain,
|
|
933
|
-
text: JSON.stringify({
|
|
934
|
-
error: "Failed to stringify response"
|
|
935
|
-
}),
|
|
936
|
-
mimeType: "application/json"
|
|
872
|
+
}
|
|
873
|
+
const resources = await Promise.all(
|
|
874
|
+
Array.from(allResourceUrls).map(async (resource) => {
|
|
875
|
+
const postResult = await getResourceResponse(
|
|
876
|
+
resource,
|
|
877
|
+
new Request(resource, {
|
|
878
|
+
method: "POST",
|
|
879
|
+
headers: {
|
|
880
|
+
"Content-Type": "application/json"
|
|
937
881
|
}
|
|
938
|
-
|
|
882
|
+
})
|
|
883
|
+
);
|
|
884
|
+
if (postResult.isOk()) {
|
|
885
|
+
return postResult.value;
|
|
886
|
+
}
|
|
887
|
+
const getResult = await getResourceResponse(
|
|
888
|
+
resource,
|
|
889
|
+
new Request(resource, { method: "GET" })
|
|
890
|
+
);
|
|
891
|
+
if (getResult.isOk()) {
|
|
892
|
+
return getResult.value;
|
|
893
|
+
}
|
|
894
|
+
console.error(`Failed to get resource response for ${resource}`);
|
|
895
|
+
return null;
|
|
896
|
+
})
|
|
897
|
+
);
|
|
898
|
+
const payload = {
|
|
899
|
+
server: origin,
|
|
900
|
+
name: metadata?.title,
|
|
901
|
+
description: metadata?.description,
|
|
902
|
+
resources: resources.filter(Boolean).map((resource) => {
|
|
903
|
+
if (!resource) return null;
|
|
904
|
+
const entry = {
|
|
905
|
+
url: resource.resource,
|
|
906
|
+
protocols: resource.protocols
|
|
939
907
|
};
|
|
940
|
-
|
|
908
|
+
if (resource.mpp) {
|
|
909
|
+
entry.mpp = {
|
|
910
|
+
method: resource.mpp.method,
|
|
911
|
+
intent: resource.mpp.intent
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
if (resource.x402) {
|
|
915
|
+
const schema = getInputSchema(resource.x402.extensions);
|
|
916
|
+
entry.x402 = {
|
|
917
|
+
schema,
|
|
918
|
+
mimeType: resource.x402.mimeType
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
return entry;
|
|
922
|
+
})
|
|
923
|
+
};
|
|
924
|
+
const stringifyResult = safeStringifyJson(
|
|
925
|
+
surface,
|
|
926
|
+
payload
|
|
927
|
+
);
|
|
928
|
+
if (stringifyResult.isErr()) {
|
|
929
|
+
console.error(
|
|
930
|
+
`Failed to stringify response for ${origin}:`,
|
|
931
|
+
stringifyResult.error
|
|
932
|
+
);
|
|
941
933
|
return {
|
|
942
934
|
contents: [
|
|
943
935
|
{
|
|
944
936
|
uri: domain,
|
|
945
|
-
text:
|
|
937
|
+
text: JSON.stringify({
|
|
938
|
+
error: "Failed to stringify response"
|
|
939
|
+
}),
|
|
946
940
|
mimeType: "application/json"
|
|
947
941
|
}
|
|
948
942
|
]
|
|
949
943
|
};
|
|
950
944
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
945
|
+
return {
|
|
946
|
+
contents: [
|
|
947
|
+
{
|
|
948
|
+
uri: domain,
|
|
949
|
+
text: stringifyResult.value,
|
|
950
|
+
mimeType: "application/json"
|
|
951
|
+
}
|
|
952
|
+
]
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
);
|
|
956
|
+
}
|
|
954
957
|
};
|
|
955
958
|
var getResourceResponse = async (resource, request) => {
|
|
956
|
-
const fetchResult = await safeFetch(
|
|
959
|
+
const fetchResult = await safeFetch(surface, request);
|
|
957
960
|
if (fetchResult.isErr()) {
|
|
958
|
-
return err("fetch",
|
|
961
|
+
return err("fetch", surface, {
|
|
959
962
|
cause: "network",
|
|
960
963
|
message: `Failed to fetch resource: ${resource}`
|
|
961
964
|
});
|
|
962
965
|
}
|
|
963
966
|
const response = fetchResult.value;
|
|
964
967
|
if (response.status !== 402) {
|
|
965
|
-
return err("fetch",
|
|
968
|
+
return err("fetch", surface, {
|
|
966
969
|
cause: "not_402",
|
|
967
970
|
message: `Resource did not return 402: ${resource}`
|
|
968
971
|
});
|
|
@@ -971,7 +974,7 @@ var getResourceResponse = async (resource, request) => {
|
|
|
971
974
|
let mppInfo = null;
|
|
972
975
|
let x402Info = null;
|
|
973
976
|
if (protocols.includes("mpp")) {
|
|
974
|
-
const challengeResult = safeGetMppChallenge(
|
|
977
|
+
const challengeResult = safeGetMppChallenge(surface, response);
|
|
975
978
|
if (challengeResult.isOk()) {
|
|
976
979
|
const challenge = challengeResult.value;
|
|
977
980
|
mppInfo = { method: challenge.method, intent: challenge.intent };
|
|
@@ -980,7 +983,7 @@ var getResourceResponse = async (resource, request) => {
|
|
|
980
983
|
if (protocols.includes("x402")) {
|
|
981
984
|
const client = new x402HTTPClient3(new x402Client3());
|
|
982
985
|
const paymentRequiredResult = await safeGetPaymentRequired(
|
|
983
|
-
|
|
986
|
+
surface,
|
|
984
987
|
client,
|
|
985
988
|
response
|
|
986
989
|
);
|
|
@@ -993,7 +996,7 @@ var getResourceResponse = async (resource, request) => {
|
|
|
993
996
|
}
|
|
994
997
|
}
|
|
995
998
|
if (!mppInfo && !x402Info) {
|
|
996
|
-
return err("parse",
|
|
999
|
+
return err("parse", surface, {
|
|
997
1000
|
cause: "parse_failed",
|
|
998
1001
|
message: `Failed to parse any payment protocol for: ${resource}`
|
|
999
1002
|
});
|
|
@@ -1224,7 +1227,7 @@ import { dirname, join } from "path";
|
|
|
1224
1227
|
import { fileURLToPath } from "url";
|
|
1225
1228
|
function getVersion() {
|
|
1226
1229
|
if (true) {
|
|
1227
|
-
return "0.3.
|
|
1230
|
+
return "0.3.7";
|
|
1228
1231
|
}
|
|
1229
1232
|
const __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
1230
1233
|
const pkg = JSON.parse(
|
|
@@ -1236,42 +1239,18 @@ var MCP_VERSION = getVersion();
|
|
|
1236
1239
|
var DIST_TAG = MCP_VERSION.includes("-beta") ? "beta" : "latest";
|
|
1237
1240
|
|
|
1238
1241
|
// src/server/lib/instructions.ts
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
if (indexResult.isErr()) {
|
|
1252
|
-
log.debug(`Failed to build index for origin: ${origin}`);
|
|
1253
|
-
continue;
|
|
1254
|
-
}
|
|
1255
|
-
const index = indexResult.value;
|
|
1256
|
-
if (!index || index.length === 0) continue;
|
|
1257
|
-
const domain = new URL(origin).hostname;
|
|
1258
|
-
const lines = index.map(
|
|
1259
|
-
(e) => ` ${e.method} ${e.path} \u2014 ${e.summary}${e.price ? ` (${e.price})` : ""}`
|
|
1260
|
-
);
|
|
1261
|
-
sections.push(`${domain}:
|
|
1262
|
-
${lines.join("\n")}`);
|
|
1263
|
-
}
|
|
1264
|
-
if (sections.length === 0) return "";
|
|
1265
|
-
return [
|
|
1266
|
-
"Available APIs:",
|
|
1267
|
-
"",
|
|
1268
|
-
...sections,
|
|
1269
|
-
"",
|
|
1270
|
-
"Workflow:",
|
|
1271
|
-
"1. Use check_endpoint_schema to get the full input schema for an endpoint before calling it.",
|
|
1272
|
-
"2. Use fetch to make the request (handles payment automatically).",
|
|
1273
|
-
"3. For APIs not listed above, use discover_api_endpoints first to find available endpoints."
|
|
1274
|
-
].join("\n");
|
|
1242
|
+
function buildServerInstructions() {
|
|
1243
|
+
return `Known API origins:
|
|
1244
|
+
- ${"https://enrichx402.com" /* EnrichX402 */} \u2014 People/org search, Google Maps, Grok twitter search, Exa web search, LinkedIn data, Firecrawl scrape, WhitePages, email enrichment, Hunter email verifier
|
|
1245
|
+
- ${"https://socialx402.com" /* SocialX402 */} \u2014 Social media data (Twitter, Instagram, TikTok, YouTube, Facebook, Reddit)
|
|
1246
|
+
- ${"https://stablestudio.io" /* StableStudio */} \u2014 Generate and edit images/videos
|
|
1247
|
+
- ${"https://agentupload.dev" /* AgentUpload */} \u2014 Upload and share files
|
|
1248
|
+
- ${"https://x402email.com" /* X402Email */} \u2014 Send emails
|
|
1249
|
+
|
|
1250
|
+
Workflow:
|
|
1251
|
+
1. Use discover_api_endpoints to find available endpoints on an origin.
|
|
1252
|
+
2. Use check_endpoint_schema to get the full input schema + pricing for an endpoint.
|
|
1253
|
+
3. Use fetch to make the request (handles payment automatically).`;
|
|
1275
1254
|
}
|
|
1276
1255
|
|
|
1277
1256
|
// src/server/index.ts
|
|
@@ -1296,7 +1275,7 @@ var startServer = async (flags) => {
|
|
|
1296
1275
|
surface: "startServer"
|
|
1297
1276
|
});
|
|
1298
1277
|
}
|
|
1299
|
-
const instructions =
|
|
1278
|
+
const instructions = buildServerInstructions();
|
|
1300
1279
|
const server = new McpServer(
|
|
1301
1280
|
{
|
|
1302
1281
|
name: "agentcash",
|
|
@@ -1345,4 +1324,4 @@ var startServer = async (flags) => {
|
|
|
1345
1324
|
export {
|
|
1346
1325
|
startServer
|
|
1347
1326
|
};
|
|
1348
|
-
//# sourceMappingURL=server-
|
|
1327
|
+
//# sourceMappingURL=server-BEKXJWYB.js.map
|