Ontwikkelaarsportaal
Thema

A2MCP Integration Guide#

What is A2MCP?#

A2MCP (Agent-to-MCP) is a service type on OKX.AI through which ASPs provide standardized services that Agents can call. Services can be free or charge per call through x402.

A2MCP services fall into two categories based on endpoint type:

Endpoint typeUse caseSource of invocation information
MCP endpointSupports the MCP protocol and enables discovery and invocation of one or more ToolsTool definitions returned by tools/list
HTTP endpointA regular HTTP APIThe endpoint and the request method and parameter definitions provided by the ASP

Confirm that your service is suitable for integration#

Services suitable for A2MCP can usually be clearly expressed as “input parameters → clear results,” with invocation and delivery handled programmatically.

CharacteristicDescriptionExamples
Structured data or capabilitiesReturns explicit results through an interface rather than purely manual processingWeather, exchange rates, maps, market data, company information
Can be exposed as toolsEach capability can be broken down into a function with parametersOrder queries, invoice generation, translation
Verifiable results and relatively low riskReturn values are relatively deterministicQuery and read-only services
Ongoing valueUsers may make repeated callsData APIs, industry knowledge bases, vertical search

Preparation before integration#

Follow the corresponding 4 steps based on how your service is implemented.

Complete service development, deployment, and testing before registration. During registration, the platform reads the information available from the endpoint and requests any necessary invocation inputs. Registration is allowed only after a successful test call. The platform does not develop or repair the service for you.

General requirements#

  • Provide a deployed, publicly accessible HTTPS endpoint with an address no longer than 512 characters. Do not use localhost, private-network, mock, or placeholder addresses, or redirect to localhost or private networks.
  • Calls with valid inputs must return complete business results consistent with the service description within 180 seconds.
  • Do not require users to provide sensitive credentials such as API keys, access tokens, private keys, or seed phrases. Configure third-party dependencies on the server side.
  1. 1
    Build an MCP Server

    Use an official MCP SDK to create a Server and register your business capabilities as Tools. If you already have a database, HTTP API, or SaaS service, you can call these capabilities from the Tool handler.

    For guidance on building an MCP Server, see Build an MCP server.

    Note on protocol versions and transports

    Official tutorials and SDKs are continuously updated. Examples may use local stdio or different protocol versions. The OKX.AI integration workflow in this guide includes the initialize handshake. Choose an implementation that can negotiate a compatible protocol version with the platform.

  2. 2
    Define tools and configure pricing

    Define MCP Tools

    Tool fieldPurpose
    nameIdentifier used to invoke the tool programmatically
    titleService name displayed on the platform
    descriptionDescribes the service purpose, capabilities, and returned results
    inputSchemaDefines parameter structure, types, required fields, and constraints

    OKX.AI requires title and description to be non-empty. Each selected tool corresponds to one service, and multiple Services can share the same MCP Endpoint.

    Configure pricing

    Configure each tool’s x402 payment requirements on the server. The platform obtains pricing through invocation verification. Charge only for tools/call; initialize and tools/list must remain free.

    Option 1: Free services

    Return business results directly when the Tool is called. No x402 implementation is required.

    Option 2: Pay-per-call services (x402)

    Payment should be triggered at the tools/call stage. We recommend using the OKX Payment SDK: OKX provides server-side SDKs (@okxweb3/x402-* supports Node.js, Go, Rust, Java, and Python). Attach payment middleware to the endpoint and configure the recipient address, network, and price. The SDK handles 402 responses and onchain verification. For the full process, see Integrate through the SDK.

    ⚠️ x402 v2 payment challenges must be base64-encoded and placed in the PAYMENT-REQUIRED response header. The marketplace validates the response header, not the response body. Using the SDK is recommended to avoid errors in the challenge format or placement.

    json
    {
      "x402Version": 2,
      "resource": {
        "url": "https://<your-public-endpoint>/...",
        "description": "<service-description>",
        "mimeType": "application/json"
      },
      "accepts": [
        {
          "scheme": "exact",
          "network": "eip155:196",
          "asset": "0x779ded0c9e1022225f8e0630b35a9b54be713736",
          "amount": "10000",
          "payTo": "0x<your-x-layer-wallet>",
          "maxTimeoutSeconds": 300,
          "extra": { "name": "USD₮0", "version": "1" }
        }
      ]
    }
    

    Paid endpoints should validate required parameters before returning payment requirements, to avoid users paying for invalid requests. The network, payment scheme, asset, token name and version, amount, and recipient address in the payment challenge must be complete. The actual amount must match the price parsed by the platform.

  3. 3
    Deploy and verify the MCP service

    After deployment, use the official MCP Inspector or a compatible MCP Client to connect to the public HTTPS MCP address, such as https://your-domain.example/mcp, and verify the following workflow:

    text
    Client initialize
    → Server returns the initialization result
    → Client notifications/initialized
    → tools/list retrieves tool definitions
    → tools/call invokes the specified tool with valid arguments
  4. 4
    Register on OKX.AI

    Submit the Endpoint following the ASP registration process.