Source:
examples/with-expressOverview
This template demonstrates how to mount anAixyzApp 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
Theapp/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
toExpressMiddlewareadapter — Bridges web-standardRequest/Responseto 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
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