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 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.
The address and payment rails that the payments will be made into. Use ATXPAccount to pay into ATXP Accounts. You must create an ATXP account in order to receive payments.
A human-readable identifier for the payee. This name will be displayed to users during the payment process and can help identify the service or tool they are paying for.
The OAuth database to use for storing tokens; either a SQLiteOAuthDatabase or RedisOAuthDatabase. If not provided, the tokens will be stored in memory.
The smallest payment that will be asked of callers. If not provided, the caller will always be asked to pay exactly the amount of requirePayment. If minimumPayment is larger, the user will be asked to pay that instead. This allows for batch payments, where the user pre-pays for multiple tool calls.
Express middleware router function that can be used with app.use().
Example usage
Copy
Ask AI
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_CONNECTIONapp.use(atxpExpress({ destination: new ATXPAccount(atxpConnectionString), payeeName: "Your MCP server's tool's name"}))