x402scan-mcp 0.0.5 → 0.0.6

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.
Files changed (2) hide show
  1. package/dist/index.js +23 -3
  2. package/package.json +1 -2
package/dist/index.js CHANGED
@@ -742,7 +742,27 @@ async function queryEndpoint(url, httpClient, options = {}) {
742
742
  }
743
743
 
744
744
  // src/tools/query_endpoint.ts
745
- import { extractDiscoveryInfoV1, isDiscoverableV1 } from "@x402/extensions/bazaar";
745
+ function extractV1DiscoveryInfo(accept) {
746
+ const schema = accept.outputSchema;
747
+ if (!schema?.input || schema.input.type !== "http" || !schema.input.method) {
748
+ return null;
749
+ }
750
+ if (schema.input.discoverable === false) {
751
+ return null;
752
+ }
753
+ const method = schema.input.method.toUpperCase();
754
+ const isBodyMethod = ["POST", "PUT", "PATCH"].includes(method);
755
+ return {
756
+ input: {
757
+ type: "http",
758
+ method,
759
+ ...schema.input.queryParams ? { queryParams: schema.input.queryParams } : {},
760
+ ...isBodyMethod && (schema.input.body || schema.input.bodyFields) ? { bodyType: "json", body: schema.input.body || schema.input.bodyFields } : {},
761
+ ...schema.input.headers ? { headers: schema.input.headers } : {}
762
+ },
763
+ ...schema.output ? { output: { type: "json", example: schema.output } } : {}
764
+ };
765
+ }
746
766
  function registerQueryEndpointTool(server) {
747
767
  server.tool(
748
768
  "query_endpoint",
@@ -814,8 +834,8 @@ function registerQueryEndpointTool(server) {
814
834
  } else if (pr.x402Version === 1 && result.rawBody) {
815
835
  const v1Body = result.rawBody;
816
836
  const firstAccept = v1Body.accepts?.[0];
817
- if (firstAccept && isDiscoverableV1(firstAccept)) {
818
- const discoveryInfo = extractDiscoveryInfoV1(firstAccept);
837
+ if (firstAccept) {
838
+ const discoveryInfo = extractV1DiscoveryInfo(firstAccept);
819
839
  if (discoveryInfo) {
820
840
  response.bazaar = {
821
841
  info: discoveryInfo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402scan-mcp",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Generic MCP server for calling x402-protected APIs with automatic payment handling",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,6 @@
23
23
  "@modelcontextprotocol/sdk": "^1.6.1",
24
24
  "@x402/core": "^2.0.0",
25
25
  "@x402/evm": "^2.0.0",
26
- "@x402/extensions": "^2.1.0",
27
26
  "siwe": "^2.3.2",
28
27
  "viem": "^2.31.3",
29
28
  "zod": "^3.25.1"