Skip to content

Improve paid seed vendor discovery and MCP audit outputs #57

@JosLuis132

Description

@JosLuis132

Submission for MYA/Pyrimid jobs #25 and #26

Jobs:

This is an accepted-patch style submission because terminal push credentials are not available for the allowed GitHub account. The patch is included below and was verified locally.

Summary

  • Adds target classification for MCP audit inputs: GitHub repo, package registry, MCP endpoint, API endpoint, generic web service, or unknown.
  • Adds target-specific signals, paid tool candidates, pricing tiers, route shape, catalog metadata, risks, and integration steps to mcp-server-audit.
  • Replaces generic vendor-lead-discovery rows with segment-specific leads, rank, score, signals, pitch, suggested product, catalog fit, and discovery queries.
  • Leaves payment gating, verification, routes, and contract calls unchanged.

Verification

npm install
npm run build

Result: Next.js production build completed successfully.

Patch

diff --git a/app/api/v1/paid/[product]/route.ts b/app/api/v1/paid/[product]/route.ts
index 65076eb..f832cb7 100644
--- a/app/api/v1/paid/[product]/route.ts
+++ b/app/api/v1/paid/[product]/route.ts
@@ -24,6 +24,125 @@ function paymentRequired(req: NextRequest, product: NonNullable<ReturnType<typeo
   );
 }
 
+function classifyTarget(rawUrl: string) {
+  let parsed: URL | undefined;
+  try {
+    parsed = new URL(rawUrl);
+  } catch {
+    parsed = undefined;
+  }
+
+  const host = parsed?.hostname.toLowerCase() || '';
+  const path = parsed?.pathname.toLowerCase() || '';
+
+  if (host === 'github.com') return 'github-repo';
+  if (host.includes('npmjs.com') || host.includes('jsr.io')) return 'package-registry';
+  if (path.includes('/mcp') || host.includes('mcp')) return 'mcp-endpoint';
+  if (path.includes('/api') || host.includes('api.')) return 'api-endpoint';
+  return parsed ? 'web-service' : 'unknown';
+}
+
+function targetSignals(targetType: string, rawUrl: string) {
+  const signals = ['agent-readable JSON response', 'stable HTTPS endpoint'];
+  if (targetType === 'github-repo') signals.push('repository can publish .well-known files and install docs');
+  if (targetType === 'mcp-endpoint') signals.push('existing tool surface can be split into preview and paid tools');
+  if (targetType === 'api-endpoint') signals.push('per-call API value maps directly to x402 pricing');
+  if (rawUrl.includes('github.com/modelcontextprotocol')) signals.push('high MCP ecosystem relevance');
+  return signals;
+}
+
+function paidToolCandidates(targetType: string) {
+  const candidates = [
+    {
+      name: 'preview_summary',
+      price_usdc: 0,
+      reason: 'Free discovery output lets buyer agents decide whether the paid result is worth a call.',
+    },
+    {
+      name: 'implementation_plan',
+      price_usdc: 100000,
+      reason: 'Actionable integration steps are a compact $0.10 paid result with low buyer risk.',
+    },
+  ];
+
+  if (targetType === 'github-repo') {
+    candidates.push({
+      name: 'repo_monetization_audit',
+      price_usdc: 250000,
+      reason: 'Repo analysis can inspect README, tools, package metadata, and route candidates.',
+    });
+  }
+
+  if (targetType === 'mcp-endpoint') {
+    candidates.push({
+      name: 'tool_pricing_matrix',
+      price_usdc: 50000,
+      reason: 'Existing tools can be ranked into free preview, low-cost paid, and premium paid tiers.',
+    });
+  }
+
+  return candidates;
+}
+
+function catalogTemplate(targetType: string, rawUrl: string) {
+  return {
+    vendor_id: 'vendor-slug-or-wallet',
+    product_id: `${targetType.replace(/[^a-z0-9]+/g, '-')}-paid-tool`,
+    endpoint: rawUrl,
+    method: 'GET',
+    network: 'base',
+    asset: 'USDC',
+    price_usdc: 100000,
+    affiliate_bps: 2000,
+    tags: ['mcp', 'x402', 'paid-tools', targetType],
+    output_schema: {
+      type: 'object',
+      properties: {
+        result: { type: 'object' },
+        routed_by: { const: 'pyrimid' },
+      },
+      required: ['result'],
+    },
+  };
+}
+
+const LEAD_SEGMENTS: Record<string, Array<{ target: string; score: number; signals: string[]; pitch: string; suggested_product: string }>> = {
+  mcp: [
+    {
+      target: 'remote MCP servers with data-heavy tools',
+      score: 93,
+      signals: ['already expose agent tool schemas', 'clear paid/free tool boundary', 'agent buyers can parse JSON'],
+      pitch: 'Keep discovery and previews free, then gate high-cost analysis/export tools with x402 through Pyrimid.',
+      suggested_product: 'paid MCP audit, enrichment, or export endpoint',
+    },
+    {
+      target: 'MCP directories and registries',
+      score: 84,
+      signals: ['own discovery traffic', 'can route buyers to vendors', 'benefit from affiliate bps'],
+      pitch: 'Add Pyrimid catalog metadata so directory traffic can convert into paid agent purchases.',
+      suggested_product: 'paid listing enrichment or category scout',
+    },
+  ],
+  'agent-frameworks': [
+    {
+      target: 'agent frameworks with plugin marketplaces',
+      score: 88,
+      signals: ['builders need monetization templates', 'SDK integration can be documented once', 'affiliate routing fits examples'],
+      pitch: 'Ship a paid-tool starter that uses Base USDC 402 responses and a Pyrimid catalog entry.',
+      suggested_product: 'framework paid-tool starter template',
+    },
+  ],
+  'api-tools': [
+    {
+      target: 'AI API services with per-call compute or data cost',
+      score: 91,
+      signals: ['natural usage-based pricing', 'can start with one paid endpoint', 'agents can retry after 402'],
+      pitch: 'Convert one expensive API call into a $0.05-$0.25 x402 product and publish agent discovery files.',
+      suggested_product: 'paid API route with preview endpoint',
+    },
+  ],
+};
+
 function payload(productId: string, req: NextRequest, proof: string) {
   const query = Object.fromEntries(req.nextUrl.searchParams.entries());
 
@@ -53,27 +172,59 @@ function payload(productId: string, req: NextRequest, proof: string) {
     }
     case 'vendor-lead-discovery': {
       const segment = query.segment || 'mcp';
+      const leads = LEAD_SEGMENTS[segment] || LEAD_SEGMENTS.mcp;
       return {
         segment,
-        leads: [
-          { segment: 'mcp', target: 'MCP servers with paid/data-heavy tools', pitch: 'Add optional x402 payment gate + Pyrimid catalog listing.' },
-          { segment: 'agent-frameworks', target: 'Agent frameworks with marketplace/plugin systems', pitch: 'Let builders sell tools to agents with Base USDC settlement.' },
-          { segment: 'api-tools', target: 'AI API services with per-call cost', pitch: 'Turn API calls into agent-purchasable products.' },
+        leads: leads.map((lead, index) => ({
+          rank: index + 1,
+          ...lead,
+          next_action: 'Find one live endpoint, draft a paid preview route, and submit catalog metadata to Pyrimid.',
+          catalog_fit: {
+            network: 'base',
+            asset: 'USDC',
+            recommended_price_usdc: index === 0 ? 100000 : 50000,
+            affiliate_bps: 2000,
+          },
+        })),
+        discovery_queries: [
+          `site:github.com ${segment} "mcp" "tools"`,
+          `site:github.com ${segment} "x402" OR "402 Payment Required"`,
+          `site:github.com ${segment} "agents.txt" OR "llms.txt"`,
         ],
       };
     }
     case 'mcp-server-audit': {
       const url = query.url || 'https://example.com/mcp';
+      const target_type = classifyTarget(url);
       return {
         audit: {
           url,
-          recommended_paid_tools: ['search', 'enrich', 'export', 'analyze'],
-          pricing: '$0.01-$0.25 per call depending on compute/data cost',
+          target_type,
+          readiness_score: target_type === 'unknown' ? 35 : target_type === 'web-service' ? 62 : 78,
+          matched_signals: targetSignals(target_type, url),
+          recommended_paid_tools: paidToolCandidates(target_type),
+          pricing: {
+            trial: '$0.02-$0.05 for low-cost lookups',
+            standard: '$0.10-$0.25 for audits, enrichment, and export jobs',
+            premium: '$0.50+ only when the endpoint performs expensive compute or uses paid data',
+          },
+          route_shape: {
+            preview: '/api/preview/{tool}?target=...',
+            paid: '/api/paid/{tool}?target=...',
+            unpaid_behavior: 'return HTTP 402 with X-Payment-Required and accepts[] metadata',
+          },
+          catalog_metadata: catalogTemplate(target_type, url),
+          risks: [
+            'Avoid gating all discovery; agents need a free preview to decide.',
+            'Do not log X-PAYMENT headers or signed payment payloads.',
+            'Keep product_id stable because buyer agents may cache it.',
+          ],
           integration_steps: [
-            'Add 402 response with x402 accepts[] metadata',
-            'Register vendor/product in Pyrimid catalog',
-            'Expose tool schema in MCP server card',
-            'Add affiliateBps for distribution agents',
+            'Publish a free preview route and a paid route with identical input parameters.',
+            'Return deterministic JSON and document the output schema in catalog metadata.',
+            'Add 402 response with x402 accepts[] metadata and Pyrimid vendor/product ids.',
+            'Publish .well-known/agent.json, .well-known/x402.json, agents.txt, and llms.txt.',
+            'Register the vendor/product in Pyrimid catalog and set affiliate_bps for distribution agents.',
           ],
         },
       };

Payout wallet can be provided privately on acceptance/request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions