Sign In

@suimpp/discovery

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@suimpp/discovery

Sui-specific discovery validation for MPP servers — validate OpenAPI documents and probe 402 payment challenges

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

@suimpp/discovery

Sui-specific discovery validation for MPP servers. Validate OpenAPI documents, check x-payment-info extensions, and probe 402 payment challenges.

npm License: MIT

CLI

# Full validation — OpenAPI + live 402 probe
npx @suimpp/discovery check mpp.t2000.ai

# List paid endpoints only
npx @suimpp/discovery discover mpp.t2000.ai

# Machine-readable JSON
npx @suimpp/discovery check mpp.t2000.ai --json

Example output

t2000 MPP Gateway v1.0.0
https://mpp.t2000.ai/openapi.json

  Endpoints: 88 total, 88 paid

  POST   /openai/v1/chat/completions  $0.01
  POST   /openai/v1/embeddings        $0.001
  ...

  Discovery
  ✓ OpenAPI valid

  Probe https://mpp.t2000.ai/openai/v1/chat/completions
  ✓ 402 with Sui payment challenge
    Recipient: 0x...
    Currency:  0xdba...::usdc::USDC
    Realm:     mpp.t2000.ai

  ✓ All checks passed

Programmatic Usage

import { check, discover, probe } from '@suimpp/discovery';

// Full validation
const result = await check('mpp.t2000.ai');
console.log(result.ok);              // true
console.log(result.summary.errors);  // 0

// Discovery only (no probe)
const disc = await discover('mpp.t2000.ai');
for (const ep of disc.endpoints) {
  console.log(ep.method, ep.path, ep.paymentInfo.price);
}

// Probe a specific endpoint
const probeResult = await probe(
  'https://mpp.t2000.ai/openai/v1/chat/completions',
  'https://mpp.t2000.ai',
);
console.log(probeResult.hasSuiPayment); // true
console.log(probeResult.recipient);     // 0x...

What it validates

OpenAPI checks

  • OpenAPI 3.1.x version
  • x-payment-info on paid operations
  • protocols includes "mpp"
  • 402 response defined
  • requestBody on POST/PUT/PATCH
  • Price format for fixed pricing
  • x-guidance or x-service-info present
  • Route count warning (>80)

Probe checks (Sui-specific)

  • Server returns 402 Payment Required
  • Payment challenge extractable (body or WWW-Authenticate header)
  • Recipient is a valid Sui address (0x...)
  • Currency is recognized Sui USDC type
  • Realm matches the server's public domain

Validation codes

CodeSeverityDescription
OPENAPI_FETCH_FAILEDerrorCould not fetch /openapi.json
OPENAPI_VERSION_INVALIDerrorNot OpenAPI 3.1.x
NO_PAID_ENDPOINTSerrorNo operations with x-payment-info
MISSING_402_RESPONSEerrorPaid operation missing 402 response
MISSING_REQUEST_BODYwarningPOST/PUT/PATCH without requestBody
MISSING_PROTOCOLSwarningNo protocols field in x-payment-info
PROTOCOL_NOT_MPPerrorprotocols does not include "mpp"
MISSING_PRICINGerrorFixed pricing with no price
HIGH_ROUTE_COUNTwarning>80 paid routes
PROBE_NOT_402errorEndpoint did not return 402
PROBE_INVALID_RECIPIENTerrorNot a valid Sui address
PROBE_UNKNOWN_CURRENCYwarningUnrecognized Sui token type
PROBE_REALM_MISMATCHerrorRealm doesn't match origin

Testing

pnpm --filter @suimpp/discovery test       # 19 tests
pnpm --filter @suimpp/discovery typecheck

License

MIT

Keywords

mpp

FAQs

Package last updated on 02 Aug 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts