Skip to main content

Overview

This template demonstrates how to mount an AixyzApp on an Express server using the toExpressMiddleware adapter. Your own Express routes coexist alongside A2A, MCP, and x402 endpoints without conflict.

Project Structure

Custom Server

The app/server.ts creates an Express app and mounts AixyzApp as middleware:
app/server.ts

Key Features

  • Express + AixyzApp coexistence — Your own Express routes alongside A2A/MCP/x402
  • toExpressMiddleware adapter — Bridges web-standard Request/Response to Express middleware
  • Mixed tool pricing — Free and paid tools on the same MCP endpoint
  • Custom facilitator — BYO x402 facilitator via app/accepts.ts
  • End-to-end tests — Full payment flow tests using testcontainers
Do not apply express.json() or other body-parsing middleware before toExpressMiddleware, as it needs access to the raw request body stream.

When to Use

Use Express integration when you need to:
  • Add AixyzApp to an existing Express application
  • Mix custom REST endpoints with A2A/MCP protocol endpoints
  • Use Express-specific middleware for some routes

Running