Overview

The @atxp/express package is used to create MCP servers in Express with per-tool call payment processing via ATXP. You can see a complete example of how to use this package to build a monetized MCP server in the MCP server quickstart.
This package depends on types and utilities from @atxp/server. All shared types like ATXPPaymentDestination and payment utilities are documented in the server package. Commonly used functions and types like ATXPArgs and requirePayment are re-exported from @atxp/express for convenience.

Installation

npm install @atxp/express

Functions

atxpExpress

atxpExpress({
  paymentDestination: PaymentDestination,
  payeeName?: string,
  oauthDatabase?: SQLiteOAuthDatabase | RedisOAuthDatabase
}): Router
Express middleware that handles payment processing for MCP tools. Arguments Returns
router
Express Router
Express middleware router function that can be used with app.use().
Example usage
import { atxpExpress, ATXPArgs } from '@atxp/express'

const app = express()

// Read the ATXP connection string from the environment variables
// Your connection string should look like https://accounts.atxp.ai?<random_string>
// and you can find it in your ATXP account dashboard at https://accounts.atxp.ai/
const atxpConnectionString = process.env.ATXP_CONNECTION

app.use(atxpExpress({
  paymentDestination: new ATXPPaymentDestination(atxpConnectionString),
  payeeName: "Your MCP server's tool's name"
}))