This specification details the architecture for the MultiversX Model Context Protocol (MCP) Server. This server acts as the bridge between UCP-compliant AI Agents (Google Gemini, Claude, etc.) and the MultiversX Blockchain.
Business Goal: Achieve "Official Support" status in the UCP/MCP registries and enable native agentic commerce on MultiversX. Success Metric (6 Months): Successful listing in the MCP Server Registry and verified end-to-end "Buy/Track" flows for top MultiversX marketplaces.
AI agents currently lack a standardized way to discover and purchase assets on the MultiversX blockchain. fragmentation between different marketplace smart contracts prevents agents from providing a unified "shopping" experience.
The solution is a standalone TypeScript MCP Server.
The server will automatically index listings but use a Registry of Trusted Marketplace Contracts to ensure authenticity.
- Whitelisting: Only contracts successfully reviewed via PR or known by the core team are indexed.
- Reputation: Metadata for each tool call result will include the "Trust Level" of the source contract.
- Search: User asks agent to find an item. Agent calls
search_products. - Product Selection: User selects an item.
- Buy Initiation: Agent calls
create_purchase_transaction. - Interactive Signing: The tool returns a standardized JSON Transaction Object. The agent hands this to an "Interactive Wallet Tool".
- Tracking: After broadcast, the agent uses
track_orderto monitor status.
To serve both AI Agents and Google Merchant Center, the server will run as a Dual-Mode service:
- MCP Interface (Stdio/SSE): Exposes Tools/Resources to Claude/Gemini.
- HTTP Interface (Fastify/Express): Exposes
GET /feed.jsonfor Google Merchant Center ingestion.
Input: Keywords, Collection, Price Range. Logic:
- Passive Index: Listens for
UCPListingevents. - Metadata Enrichment: Performs an async chain query (VmQuery or API) to fetch
URIs,Names, andAttributesusing theTokenIdentifier+Noncefrom the log. It does not expect full metadata in the log event.
Input: token_identifier, nonce, quantity.
Output: Standard MultiversX Transaction JSON.
Input: transaction_hash.
Logic:
- Stateless Operation: Queries MultiversX API.
- Verification: Checks
LogEvent.addressagainst the Whitelist.
- Product ID: Represented as
TokenIdentifier-Noncefor simplicity and ecosystem alignment. - Verification Layer: The MCP server maintains a
whitelists.json(extendable via PR). During log parsing, it cross-references theLogEvent.addresswith this whitelist. - Extensibility: Merchants can submit PRs to define custom log-to-product mapping logic if they deviate from the "Standard Event" format.
To prevent rate-limiting and ensure reliability:
- Default Mode (Global Gateway): The MCP server defaults to a dedicated "MCP Gateway" (a load-balanced cluster of Observers) optimized for these query patterns.
- Custom Mode: Advanced users can configure
MVX_API_URLto point to their own Observer Node or commercial API provider (e.g., Blast, Tatum) to avoid shared limits.
- Blockchain Native Safety: We rely on the atomic nature of the blockchain. If an item is sold before the user signs:
- The Smart Contract
buyfunction will fail (revert). - The funds are never transferred (or instantly returned).
- The Smart Contract
- Metadata: The
search_productstool returns alast_updatedtimestamp. Agents should warn users if a listing is stale (>1 minute old).
- Pending States: If
track_orderis called immediately after signing, the API might return 404. The Tool must catch this and returnstatus: pending, retry_after: 5sinstead of "Failed".
- Milestone 1: Project scaffold and
search_productsfor whitelisted contracts. - Milestone 2: Transaction generation for standard
buycalls. - Milestone 3: Order tracking logic parsing on-chain events.
- Milestone 4: Submission to the Model Context Protocol global registry.